Closed Bug 1689853 Opened 3 years ago Closed 3 years ago

Bookmarklet using window.open triggers popup blocker

Categories

(Firefox :: Untriaged, defect)

Firefox 85
defect

Tracking

()

VERIFIED FIXED
87 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox85 --- wontfix
firefox86 --- verified
firefox87 --- verified

People

(Reporter: jscher2000, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0

Steps to reproduce:

Run a bookmarklet that uses window.open(). For example:

javascript:void(window.open(location.href, "_blank"));

Actual results:

Popup blocker prevents the new window from opening, and Firefox presents the yellow bar.

Web Console reports: "Opening multiple popups was blocked due to lack of user activation."

Expected results:

This is a change from Firefox 84; the desired behavior is to recognize user approval via running the bookmarklet.

Mozregression points to "Bug 1679456 - Consume user activation on popup opening and remove popup opening tokens."

Users have reported the issue on SUMO and Reddit:

Regressed by: 1679456
Has Regression Range: --- → yes
Assignee: nobody → emilio
Status: UNCONFIRMED → NEW
Ever confirmed: true

I'll simplify all the popup-blocking setup in a follow-up, but this is
the low-risk change.

Need to add a test for this of course. Kinda baffled we did not have
any.

This will make easier to add more tests in the future.

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/16c796643d52
Fake a user interaction when handling LOAD_FLAGS_ALLOW_POPUPS. r=edgar
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f37f0997d677
Cleanup browser_multiple_popups.js. r=edgar

Comment on attachment 9200256 [details]
Bug 1689853 - Fake a user interaction when handling LOAD_FLAGS_ALLOW_POPUPS. r=edgar,smaug

Beta/Release Uplift Approval Request

  • User impact if declined: comment 0
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: comment 0
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Special-case loads triggered by the browser UI which already had a flag to also fake a user interaction, in order to make popups work.
  • String changes made/needed: none
Attachment #9200256 - Flags: approval-mozilla-beta?
Attachment #9200258 - Flags: approval-mozilla-beta?
Flags: qe-verify+

Comment on attachment 9200258 [details]
Bug 1689853 - Cleanup browser_multiple_popups.js. r=edgar,smaug

The test-only cleanup shouldn't need to be in beta, probably...

Attachment #9200258 - Flags: approval-mozilla-beta?

Set release status flags based on info from the regressing bug 1679456

It seems we're timing out at the end of the test run. Not sure why my test would cause that off-hand.

Flags: needinfo?(emilio)

Waiting for the load event on the popup window fixed it.

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1b3b3291fe1b
Fake a user interaction when handling LOAD_FLAGS_ALLOW_POPUPS. r=edgar
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1f1cf37833df
Cleanup browser_multiple_popups.js. r=edgar

While we're at it...

Could we test whether this resolves an issue in the WordPress editor's Preview function (SUMO). It seems to be that window.focus() doesn't work after window.open() with a named window if the window was already open. Test page:

https://www.jeffersonscher.com/res/focusnamedtab.html

  • first click, opens second tab and Firefox focuses it
  • return to the first tab, click again, the second tabs reloads, but is not focused

Mozregression points to the same: Bug 1679456 - Consume user activation on popup opening and remove popup opening tokens.

Can you file a new bug for that and ni? me? This won't address it.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
QA Whiteboard: [qa-triaged]

Comment on attachment 9200256 [details]
Bug 1689853 - Fake a user interaction when handling LOAD_FLAGS_ALLOW_POPUPS. r=edgar,smaug

Approved for 86 beta 5, thanks.

Attachment #9200256 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9200258 - Flags: approval-mozilla-beta+

Reproduced with Fx 87.0a1 (2021-01-30) on Windows 10.
Verified fixed with Fx 87.0a1 (2021-02-02) and Fx 86.0b5 (treeherder build) on Windows 10, macOS 10.15 and Ubuntu 18.04.

Status: RESOLVED → VERIFIED
Flags: qe-verify+

So, this should be resolved with the next release?

Yes.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #20)

Yes.

On a more organizational than programming note, this appears to pop up on a semi-regular basis. (Every few years)

Is there something missing in the review of new releases that needs to be added?

Well, we apparently didn't have an automated test for this, so I added one. It should hopefully prevent this from happening again.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #22)

Well, we apparently didn't have an automated test for this, so I added one. It should hopefully prevent this from happening again.

Thanks.

I'm actually so old school that I was thinking of an aviation style paper checklist.

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

Attachment

General

Created:
Updated:
Size: