Closed Bug 1912405 Opened 2 months ago Closed 2 months ago

gProtectionsHandler onClick does not work due to bubbling

Categories

(Firefox :: Protections UI, defect, P3)

defect

Tracking

()

VERIFIED FIXED
131 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- unaffected
firefox129 --- unaffected
firefox130 + verified
firefox131 + verified

People

(Reporter: tschuster, Assigned: tschuster)

References

(Regressed 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(2 files)

onClick reacts to specific ids, but if somone clicks on children elements of those elements it might not work? I need to test this.

See Also: → 1911342

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

Hi, could you please verify this Paul, I think its because HTML onClicks are not allowed and EventListener would be need instead.

Flags: needinfo?(pbz)

This could only break if we changed the element on which we added the handler and passed the event along to some existing function, right? Looking at https://searchfox.org/mozilla-central/rev/b1b87f95ecea00828298d1b3cd3d8718f9fcc3fc/browser/base/content/browser-siteProtections.js#2043-2053 we only do this for onHeaderClicked which passes things to https://searchfox.org/mozilla-central/rev/b1b87f95ecea00828298d1b3cd3d8718f9fcc3fc/browser/base/content/browser-siteProtections.js#1782 which eventually passes it as triggerEvent to PanelMultiView.openPopup which won't care about the exact target ID, only about whether it was a click or keypress that triggered opening a panel.

So I think we're fine? I also audited the other patches in bug 1904798 and I think they're all good. But maybe I'm missing something?

Flags: needinfo?(tschuster)

So, I think the problem is the following:

  • The user clicks on "Site information for example.com" (<html:span id="protections-popup-mainView-panel-header-span"/>)
  • The onClick function runs
  • The event.target.id is protections-popup-mainView-panel-header-span , so the case for protections-popup-mainView-panel-header doesn't match
  • Thus onHeaderClicked doesn't run
Flags: needinfo?(tschuster)

I can reproduce the issue

STR:

  1. Visit example.com
  2. open the protections panel
  3. Toggle ETP off or on
  4. When the toast appears click it

Expected:
The protections panel opens

Actual: The toast disappears after a while but the protections panel does not open.

Severity: -- → S3
Flags: needinfo?(pbz)
Priority: -- → P3

Tom since you're the author of the regressing bug, would you like to take this one?

Flags: needinfo?(tschuster)
Assignee: nobody → tschuster
Flags: needinfo?(tschuster)
Pushed by tschuster@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f817754b1da7 Use individual event listeners for gProtectionsHandler click handlers. r=Gijs

This needs a tests.

Flags: needinfo?(tschuster)
Flags: needinfo?(tschuster)
Summary: gProtectionsHandler onClick might not work? → gProtectionsHandler onClick does not work due to bubbling
Flags: needinfo?(tschuster)

[Tracking Requested - why for this release]: Broken UI interactions.

Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 131 Branch

FYI, we build beta8 tomorrow, so an uplift request soon would be appreciated!

Flags: in-testsuite?

Comment on attachment 9419580 [details]
Bug 1912405 - Use individual event listeners for gProtectionsHandler click handlers. r?pbz,Gijs

Beta/Release Uplift Approval Request

  • User impact if declined: Some UI interactions with the protections menu (the shield icon in the URL bar) would be broken
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: See https://bugzilla.mozilla.org/show_bug.cgi?id=1912405#c5
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): The new code is simpler and closer to the original code
  • String changes made/needed:
  • Is Android affected?: No
Flags: needinfo?(tschuster)
Attachment #9419580 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Flags: needinfo?(tschuster)

Comment on attachment 9419580 [details]
Bug 1912405 - Use individual event listeners for gProtectionsHandler click handlers. r?pbz,Gijs

Approved for 130.0b8.

Attachment #9419580 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [qa-triaged]
Flags: needinfo?(tschuster)
Pushed by tschuster@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a26dbdf29960 Test that clicking the protection mini panel opens the whole panel. r=pbz

Reproduced this issue on an affected nightly build from 2024-08-09, on Win 10 using the STR from Comment 5.
Verified as fixed on Firefox Nightly 131.0a1 (20240820214025) and Beta 130.0b8 (20240821091813) on Win 10, macOS 11 and Ubuntu 22.04. The protection panel opens when clicking the toast.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Flags: in-testsuite? → in-testsuite+
Regressions: 1914793
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: