New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use origin of final HTTP response as document origin #23887
Merged
+73
−2
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
Loading status checks…
Use origin of final HTTP response as document origin.
- Loading branch information
commit bfd9bbe82a8fd74a2fa91e0a5538c8839141ebdd
| @@ -0,0 +1,22 @@ | ||
| <html> | ||
| <head> | ||
| <title>A document's origin should match the origin of the final HTTP response</title> | ||
| <script src="/resources/testharness.js"></script> | ||
| <script src="/resources/testharnessreport.js"></script> | ||
| <script src="/common/get-host-info.sub.js"></script> | ||
| <body> | ||
| <script> | ||
| async_test(function(t) { | ||
| var path = new URL("document_origin_redirect_subpage.html", document.location).pathname; | ||
| var CROSS_ORIGIN_URL = new URL(path, get_host_info().HTTP_REMOTE_ORIGIN); | ||
| var SAME_ORIGIN_URL = "/common/redirect.py?location=" + CROSS_ORIGIN_URL; | ||
| console.log(SAME_ORIGIN_URL); | ||
|
||
| var iframe = document.createElement('iframe'); | ||
| iframe.src = SAME_ORIGIN_URL; | ||
| document.body.appendChild(iframe); | ||
| onmessage = t.step_func_done(function(e) { | ||
| assert_true(e.data[0]); | ||
| assert_true(e.data[1]); | ||
| }); | ||
| }); | ||
| </script> | ||
| @@ -0,0 +1,32 @@ | ||
| <script src="/common/get-host-info.sub.js"></script> | ||
| <canvas></canvas> | ||
| <canvas></canvas> | ||
| <img src="2x2.png" onload="dotest()"> | ||
| <script> | ||
| function dotest() { | ||
| var c = document.querySelector('canvas'); | ||
| var ctx = c.getContext('2d'); | ||
|
|
||
| var i = document.querySelector('img'); | ||
| ctx.drawImage(i, 0, 0); | ||
| var sameorigin2d = false; | ||
| try { | ||
| c.toDataURL(); | ||
| sameorigin2d = true; | ||
| } catch (x) { | ||
| } | ||
|
|
||
| var c = document.querySelectorAll('canvas')[1]; | ||
| var gl = c.getContext('webgl'); | ||
| const texture = gl.createTexture(); | ||
| gl.bindTexture(gl.TEXTURE_2D, texture); | ||
| var sameorigin3d = false; | ||
| try { | ||
| gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, i); | ||
| sameorigin3d = true; | ||
| } catch(x) { | ||
| } | ||
|
|
||
| parent.postMessage([sameorigin2d, sameorigin3d], '*'); | ||
| } | ||
| </script> |
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Looks like the wpt linter didn't cover this one. #23897