Closed Bug 1901139 Opened 4 months ago Closed 2 months ago

The user activation state isn't propagted to nsDocShellLoadState for the load triggered by `window.open()`

Categories

(Core :: DOM: Navigation, defect, P3)

defect

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: edgar, Assigned: edgar)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

We found this issue while working on Text Fragment (Bug 1888756).
window.open() will consume the user activation if the popup blocker is enabled. However, the nsDocShellLoadState is built after that, so it always ends up having mHasValidUserGestureActivation set to false. The popup blocker is disabled by default while running automation tests, so we didn't catch this issue during testing. And since only the Sec-Fetch-User use that currently, it is not easily noticeable by users. And the Text Fragment has made this issue emerge.

nsWindowWatcher::OpenWindowInternal takes both a URL string and nsDocShellLoadState
as argument. In most of cases, caller passes null for nsDocShellLoadState and
nsWindowWatcher::OpenWindowInternal creates it lazily with the nsIURI which is
converted frome the URL string. The only place that passes both non-void URL string
and non-null nsDocShellLoadState is in nsDocShell::PerformRetargeting, see
https://searchfox.org/mozilla-central/rev/e74b86533c2499eb6393071aeedcfb080d84e4da/docshell/base/nsDocShell.cpp#8409.
The passed URL string is converted from the URI of the passed nsDocShellLoadState,
so they are actually equal. Therefore, the code for replacing URI is redundant.

Assignee: nobody → echen
Attachment #9410696 - Attachment description: Bug 1901139 - Stop replacing the URI of `nsDocShellLoadState` in `nsWindowWatcher::OpenWindowInternal`; → Bug 1901139 - Stop replacing the URI of `nsDocShellLoadState` in `nsWindowWatcher::OpenWindowInternal`; r?#dom-core
Status: NEW → ASSIGNED
Attachment #9410697 - Attachment description: Bug 1901139 - Create nsDocShellLoadState before the transient user activaion is consumed; → Bug 1901139 - Create nsDocShellLoadState before the transient user activaion is consumed; r?#dom-core!,ckerschb!
Pushed by jjaschke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/49087840a161 Stop replacing the URI of `nsDocShellLoadState` in `nsWindowWatcher::OpenWindowInternal`; r=dom-core,peterv https://hg.mozilla.org/integration/autoland/rev/5e76d2196972 Create nsDocShellLoadState before the transient user activaion is consumed; r=ckerschb,dom-core,peterv
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
Regressions: 1911529
Regressions: 1911530
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: