Closed Bug 1703472 Opened 5 years ago Closed 5 years ago

"Opening multiple popups was blocked due to lack of user activation" when JS-focussing user activated popup window

Categories

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

Firefox 85
x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
89 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox87 --- wontfix
firefox88 --- wontfix
firefox89 --- fixed

People

(Reporter: mnyromyr, Assigned: emilio)

References

(Regression)

Details

(Keywords: perf-alert, regression, Whiteboard: [perf:alert:?])

Attachments

(3 files)

Attached file Testcase (JS in HTML) —

FF 88b on Linux with default popup blocking settings, i.e. dom.disable_window_flip is true.

Setting & former expected outcome:
HTML with button to open a popup and JS code to redirect user interaction from the opener to the popup (see attached demo).
Clicking the button would open the popup, clicking somewhere else in the opener window would then just refocus the popup.

This did still work in FF 84.0.2, but not from 85.0 onwards, and is currently still broken in 88 beta. It (still) works in other browsers, e.g. Chrome 89.0.4389.114.

Currently broken behaviour:
Opening the popup by clicking the button will open the popup, but subsequent clicks into the opener window won't refocus the popup. Instead, they just generate an "Opening multiple popups was blocked due to lack of user activation" on the popup's(!) JS console, relating to the .focus call.
Since the popup was opened by a user action, it should allow .focus calls.

(Note: the demo is based on code taken from Xinha 0.95's dialog.js, stripped down to the broken part.)

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: General → DOM: Core & HTML
Product: Firefox → Core

Are you using wayland by any chance? This is supposed to work (I fixed this in bug 1691214, basically), and does work on OSX and X11 at least, but it's known not to work on wayland because of bug 1692119.

Assignee: nobody → emilio
Flags: needinfo?(mnyromyr)

loginctl says Type=x11, so no.
I'm on lubuntu 20.10 with LXDE, fwiw.

Does my testcase work for you?

Flags: needinfo?(mnyromyr)

It does (on Nightly and 87 at least). ni?ing myself to check beta, but I don't see why it wouldn't work. Does it work on Nightly for you?

Flags: needinfo?(mnyromyr)
Flags: needinfo?(emilio)

Ah, I think I know what's going on. I can't reproduce if I enable fission (site isolation), but I can reproduce if I disable it, for some reason.

Flags: needinfo?(mnyromyr)

Bisection points to bug 1679456 which is a bit surprising, even if not totally unexpected.

Regressed by: 1679456
Has Regression Range: --- → yes

Just like how for window.open() it's checked on the opener, of course.

Note that when sending the focus request via IPC, we trust the check
done on the child (bug 1677899).

Do we have a good test to extend to cover this case?

Right, so bug 1679456 made us use the user-interaction state, which is window-local, and we were doing the check on the wrong window, effectively.

Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/db92ea730300 For window.focus, popup abuse level should be checked on the caller. r=smaug,hsivonen https://hg.mozilla.org/integration/autoland/rev/cc986541595b Add an automated test for this. r=smaug
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch

Yep, fixed in firefox-89.0a1.en-US.linux-x86_64.tar.bz2.
Thank you very much!

== Change summary for alert #29623 (as of Thu, 08 Apr 2021 18:01:55 GMT) ==

Improvements:

Ratio Suite Test Platform Options Absolute values (old vs new)
8% Images macosx1015-64-shippable-qr 6,547,448.13 -> 6,055,230.04
6% Images windows10-64-shippable tp6 9,478,328.99 -> 8,872,563.88

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=29623

I think that might be misattributed, I don't know how this patch could speed up the images perf test.

Flags: needinfo?(aionescu)

Did some retriggers, thanks!

Flags: needinfo?(aionescu)
Flags: needinfo?(aionescu)
Flags: needinfo?(aionescu)
Whiteboard: [perf:alert:?]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: