Closed Bug 1685807 Opened 2 months ago Closed 2 months ago

window.name resetting drops name when loading about:blank to a window which had non-about:blank loaded to it

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: smaug, Assigned: timhuang)

References

(Depends on 1 open bug)

Details

Attachments

(2 files)

(This is currently Nightly only, since privacy.window.name.update.enabled is enabled only there.)
When about:blank is same origin, I don't think loading it explicitly should reset window.name.

Test is in http://mozilla.pettay.fi/moztests/window_name_test_initial.html
Steps:

  1. Click 'Open a noopener window'. A new window opens.
  2. Click 'open another window which has opener pointing to this one'. A new window opens.
  3. Check what is logged at the top of the page, especially see opener's name
  4. Click 'Load about:blank to opener'.
  5. Check what is logged at the top of the page and compare what was there before.
Severity: -- → S3
Priority: -- → P3

We should also test a variant where you set document.domain before step 4 I suppose, in which case you would expect name to be reset.

We might also want to test blob URLs, though as suggested in https://github.com/w3c/FileAPI/issues/153 we might want to force noopener for them so I'm not sure how much I care if we reset name there.

Assignee: nobody → tihuang
Status: NEW → ASSIGNED

This patch changes the checking condition about the cases that we don't
need to reset the window.name. It makes the window.name to not be reset
if we load an about:blank page to a window which had loaded a
non-about:blank page.

Also, we take the domain into account when checking the principals of
the ola and new documents. This would make the window.name to be
reset if the document.domain was changed to a cross-origin.

Attachment #9196387 - Attachment description: Bug 1685807 - Part 2: Add a test. r?smaug → Bug 1685807 - Part 2: Add tests including a mochitest and a web platform test. r?smaug
Pushed by tihuang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/441e3606b512
Part 1: Not to reset the window.name if it's navigating to an about:blank page from a non-about:blank page. r=smaug
https://hg.mozilla.org/integration/autoland/rev/bc08003d6b4c
Part 2: Add tests including a mochitest and a web platform test. r=smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/27203 for changes under testing/web-platform/tests
Depends on: 1687029
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
Upstream PR merged by moz-wptsync-bot

Is there a follow-up bug on the Android failures?

I haven't opened it yet. I want to first figure out the root cause of it and then open the bug.

You need to log in before you can comment on or make changes to this bug.