-
Notifications
You must be signed in to change notification settings - Fork 3.6k
HTML: Snapshot timing of iframe referrerpolicy for location.ancestorOrigins #56675
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
base: master
Are you sure you want to change the base?
Conversation
...owsers/history/the-location-interface/location-ancestor-origins-referrerpolicy-snapshot.html
Show resolved
Hide resolved
...owsers/history/the-location-interface/location-ancestor-origins-referrerpolicy-snapshot.html
Show resolved
Hide resolved
| document.body.append(iframe); | ||
| // The referrerpolicy attribute was snapshotted when the initial about:blank doc was created | ||
| // https://html.spec.whatwg.org/#the-iframe-element:create-a-new-child-navigable | ||
| // https://html.spec.whatwg.org/#child-navigables:creating-a-new-browsing-context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we change these links to http://html.spec.whatwg.org/multipage/nav-history-apis.html#the-location-interface:attr-iframe-referrerpolicy, which is what https://whatpr.org/html/11560/90c74b7...cef3330/nav-history-apis.html#the-location-interface:attr-iframe-referrerpolicy is now, and what the real link will be when the PR lands?
I think that's more accurate.
| assert_array_equals(Array.from(iframe.contentWindow.location.ancestorOrigins), ['null']); | ||
| iframe.referrerPolicy = ''; | ||
| await loaded; | ||
| // The referrerpolicy attribute was snapshotted again when the response becomes available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part I don't think is true, but I'l continue the discussion in the HTML PR thread.
|
This test will be synced upstream from firefox repo. Comments in the test may change a bit to reflect what the intention is better, but the test itself gives the (now) expected results. Maybe @domfarolino could take a quick look when you have time? It's basically just changing results from [null], [window.origin], to [null] and [null], because we're expecting the snap shot to happen at the moment in time when it's done for normal navigation's, therefore this race should not be seen. |
| // https://html.spec.whatwg.org/#populating-a-session-history-entry:loading-a-document | ||
| // https://html.spec.whatwg.org/#populating-a-session-history-entry:navigate-html | ||
| // https://html.spec.whatwg.org/#read-html:initialise-the-document-object | ||
| assert_array_equals(Array.from(iframe.contentWindow.location.ancestorOrigins), [window.origin]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused about this. In #56675 (comment) you say:
but the test itself gives the (now) expected results. [...] It's basically just changing results from [null], [window.origin], to [null] and [null]
But I still see ['null'] above, and [window.origin] here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As previously stated, the fixed test will be upstreamed from the repo
I don't have write access to overwrite what @zcorpan did.
| // https://html.spec.whatwg.org/#the-iframe-element:create-a-new-child-navigable | ||
| // https://html.spec.whatwg.org/#child-navigables:creating-a-new-browsing-context | ||
| assert_array_equals(Array.from(iframe.contentWindow.location.ancestorOrigins), ['null']); | ||
| iframe.referrerPolicy = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe let's leave a comment here saying that this should have no effect, because the referrer policy used for ancestor origin redaction (and embedder-initiated iframe src fetching) is snapshotted at navigation time, since that's the direction the PR went.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is what I needed input on on the version that is about to be upstreamed from you guys, to see if my comments (see below) were accurately describing what we are attempting to test here or if we should word it differently.
The test now is:
promise_test(async () => {
assert_implements(location.ancestorOrigins);
const iframe = document.createElement('iframe');
iframe.src = '/common/blank.html?pipe=trickle(d1)';
iframe.referrerPolicy = 'no-referrer';
const loaded = new Promise(resolve => iframe.onload = resolve);
document.body.append(iframe);
// initial about:blank should see 'no-referrer' results
assert_array_equals(Array.from(iframe.contentWindow.location.ancestorOrigins), ['null']);
iframe.referrerPolicy = '';
await loaded;
// The referrerpolicy attribute get snapshotted at step 16 of "beginning navigation"
// https://html.spec.whatwg.org/#beginning-navigation and result should therefore,
// still be ["null"], here.
assert_array_equals(Array.from(iframe.contentWindow.location.ancestorOrigins), ["null"]);
});
See whatwg/html#11560