Skip to content

Conversation

@zcorpan
Copy link
Member

@zcorpan zcorpan commented Dec 11, 2025

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

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.

@theIDinside
Copy link
Contributor

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]);
Copy link
Member

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.

Copy link
Contributor

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 = '';
Copy link
Member

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.

Copy link
Contributor

@theIDinside theIDinside Dec 22, 2025

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"]);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants