Skip to content
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
merged 1 commit into from Jul 30, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Use origin of final HTTP response as document origin.

  • Loading branch information
jdm committed Jul 30, 2019
commit bfd9bbe82a8fd74a2fa91e0a5538c8839141ebdd
@@ -3128,7 +3128,7 @@ impl ScriptThread {
incomplete.pipeline_id,
incomplete.parent_info,
incomplete.window_size,
origin,
origin.clone(),
incomplete.navigation_start,
incomplete.navigation_start_precise,
self.webgl_chan.as_ref().map(|chan| chan.channel()),
@@ -3212,7 +3212,7 @@ impl ScriptThread {
&window,
HasBrowsingContext::Yes,
Some(final_url.clone()),
incomplete.origin,
origin,
is_html_document,
content_type,
last_modified,
@@ -9534,6 +9534,9 @@
"mozilla/details_ui_opened_ref.html": [
[]
],
"mozilla/document_origin_redirect_subpage.html": [
[]
],
"mozilla/duplicated_scroll_ids_ref.html": [
[]
],
@@ -11527,6 +11530,12 @@
{}
]
],
"mozilla/document_origin_redirect.html": [
[
"mozilla/document_origin_redirect.html",
{}
]
],
"mozilla/document_readystate.html": [
[
"mozilla/document_readystate.html",
@@ -18601,6 +18610,14 @@
"3a0172826d4ff2d9a754ffb6a437055bb2cf6ec9",
"testharness"
],
"mozilla/document_origin_redirect.html": [
"009c899a45482b835dad186a822859f12e0e53fd",
"testharness"
],
"mozilla/document_origin_redirect_subpage.html": [
"3e68ff395f5475e2b618147f270117f576a5b7bd",
"support"
],
"mozilla/document_readystate.html": [
"7ff8f66cdf74430f86ed7028294530229809d8de",
"testharness"
@@ -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);

This comment has been minimized.

Copy link
@gterzian

gterzian Jul 31, 2019

Member

Looks like the wpt linter didn't cover this one. #23897

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.
You can’t perform that action at this time.