Closed Bug 1722145 Opened 2 months ago Closed 2 months ago

browser.permissions.remove() permanently removes devtools panel

Categories

(WebExtensions :: Developer Tools, defect, P1)

Firefox 90
defect

Tracking

(firefox-esr78 wontfix, firefox90 wontfix, firefox91 verified, firefox92 verified)

VERIFIED FIXED
92 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox90 --- wontfix
firefox91 --- verified
firefox92 --- verified

People

(Reporter: me, Assigned: rpl)

References

(Regression)

Details

(Keywords: regression)

Attachments

(5 files)

Attached file repro.zip

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15

Steps to reproduce:

In a web extension:

  1. Add optional origin permission
  2. Revoke permission

What doesn't affect this:

  • context (it if .remove() is called in the background or in a page)
  • user interaction (it happens even if I call .remove() from the console)
  • permissions (regardless of whether I specify devtools in the manifest's permissions list)
  • quirks mode (the attached repro is minimal, but my extension is not in regular mode)

Actual results:

The dev tools panel is gone and will not reappear until a restart or removal of the extension.

Expected results:

The panel should not be affected

Attached image demo.gif

What doesn't affect this:

  • i
Summary: permissions.remove({origin}) permanently removes devtools panel → permissions.remove() permanently removes devtools panel

The comment above was submitted too early.

What doesn't affect this:

  • the type of permission revoked (the bug appears whether I remove an origin or a regular permission, like "notifications")
Component: Untriaged → Developer Tools
Product: Firefox → WebExtensions
Summary: permissions.remove() permanently removes devtools panel → browser.permissions.remove() permanently removes devtools panel

Hello,

I reproduced the issue on the latest Release (90.0.2/20210721174149), Beta (91.0b7/20210725190237) and Nightly (92.0a1/20210725212334) under Windows 10 x64 and Ubuntu 16.04 LTS.

Once the permission is removed, the dev tools panel disappears, as illustrated in the attached gif from Comment 1.

Status: UNCONFIRMED → NEW
Ever confirmed: true

I didn't run mozregression to bisect the regressing bug, but this is very likely a regression introduced by Bug 1606862.

In Bug 1606862 two listeners for "add-permissions" and "remove-permissions" have been added in ext-devtools.js, but the about:config pref related to the extension devtools page is set to true/false in the listeners before checking if the devtools permission is granted or not (and so it is reacting to any "add-permissions"/"remove-permissions" event and it is disabling the devtools page and panel when an unrelated permission is removed, and also re-enabling it again if an unrelated optional permission is granted).

The attached patch currently includes only the fix for the issue reported, but I want to add explicit coverage for this scenario and so I marked it as work-in-progress. I'll open it up for review asap (as soon as I added test coverage).

Assignee: nobody → lgreco
Status: NEW → ASSIGNED
Has Regression Range: --- → yes
Has STR: --- → yes
Keywords: regression
Regressed by: 1606862
Severity: -- → S2
Priority: -- → P1
Attachment #9233097 - Attachment description: WIP: Bug 1722145 - extension devtools page and panels should not be enabled/disabled when unrelated optional permissions are granted/revoked. r?mixedpuppy! → Bug 1722145 - extension devtools page and panels should not be enabled/disabled when unrelated optional permissions are granted/revoked. r?mixedpuppy!

As a side note:

the devtools page and panels are being destroyed because of the underlying issue described in comment 6, but the extension will still be listed in the DevTools Settings panel and the user will be able to re-enable the devtools part of the extension from there (without having to remove and reinstall the extension).

See Also: → 1722370
Pushed by luca.greco@alcacoop.it:
https://hg.mozilla.org/integration/autoland/rev/b48f19cfdb0e
extension devtools page and panels should not be enabled/disabled when unrelated optional permissions are granted/revoked. r=mixedpuppy,robwu

Luca, do you want to ask for uplift?

Flags: needinfo?(lgreco)

(In reply to Marco Castelluccio [:marco] from comment #9)

Luca, do you want to ask for uplift?

Hi Marco,
it would be good if we can get it uplifted, and so I was planning to ask an uplift to beta once the patch has got to mozilla-central.

should I create it sooner even if the patch didn't got to central yet? (e.g. because we are pretty near to the end of the current beta cycle and asking the uplift now would increase the chances to not be too late to be acceptable?)

Flags: needinfo?(lgreco)

(In reply to Luca Greco [:rpl] [:luca] [:lgreco] from comment #10)

(In reply to Marco Castelluccio [:marco] from comment #9)

Luca, do you want to ask for uplift?

Hi Marco,
it would be good if we can get it uplifted, and so I was planning to ask an uplift to beta once the patch has got to mozilla-central.

should I create it sooner even if the patch didn't got to central yet? (e.g. because we are pretty near to the end of the current beta cycle and asking the uplift now would increase the chances to not be too late to be acceptable?)

I think so, but redirecting to Pascal.

Flags: needinfo?(pascalc)

It's OK to request the uplift now even though it isn't on central yet but it won't make it into beta 8 which builds in a few hours and I won't uplift it before it lands on mozilla-central.

Flags: needinfo?(pascalc)

Comment on attachment 9233097 [details]
Bug 1722145 - extension devtools page and panels should not be enabled/disabled when unrelated optional permissions are granted/revoked. r?mixedpuppy!

Beta/Release Uplift Approval Request

  • User impact if declined: The devtools part of an extension may be wrongly disabled or re-enabled when the extension request or revoke an unrelated optional permission (also when the extensions isn't explicitly using "devtools" as an optional permission).

The users would still be able to re-enable the devtools part of the extension from the Developer Tools Settings UI, but given that the users that got into this issue are not actively disabling the extension from the Developer Tools Settings UI, they may not realize that they can enable it back and assume that it is broken.

  • 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: not strictly necessary because the patch also include automated tests that should be covering the fix appropriately, but it may be good to also explicitly verify the fix.
    The STR is the one described in comment 0 (along with the test extension attached to the same comment).
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): The fix is just a few lines, only touching the part of ext-devtools.js that was triggering the issue, and the automated tests included along with the fix should also making sure that the issue is fixed and the other behaviors are still working as expected.
  • String changes made/needed:
Attachment #9233097 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 92 Branch
QA Whiteboard: [qa-triaged]

Comment on attachment 9233097 [details]
Bug 1722145 - extension devtools page and panels should not be enabled/disabled when unrelated optional permissions are granted/revoked. r?mixedpuppy!

It's coming late in the cycle but it's a small patch, has automated tests and it fixes a P1/S2 regression, let's take it in our last beta, thanks.

Attachment #9233097 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Verified the fix on the latest Nightly (92.0a1/20210727214000) under Windows 10 x64 and Ubuntu 16.04 LTS.

Once the permission is revoked, the dev tools panel no longer disappears, confirming the fix.

For further details, see the attached video.

Status: RESOLVED → VERIFIED
Attached video 2021-07-28_11h35_41.mp4

Verified the fix on the latest Beta (91.0b9/20210729185755) under Windows 10 x64 and Ubuntu 16.04 LTS.

Once the permission is revoked, the dev tools panel no longer disappears, confirming the fix.

Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.