Closed Bug 1671579 Opened 7 months ago Closed 5 months ago

When the devtools optional permission is revoked and then granted, the devtools page for the extension should be automatically enabled from a toolbox perspective

Categories

(WebExtensions :: Developer Tools, defect, P3)

defect

Tracking

(firefox85 fixed)

RESOLVED FIXED
85 Branch
Tracking Status
firefox85 --- fixed

People

(Reporter: rpl, Assigned: ankushduacodes, Mentored)

References

Details

(Keywords: good-first-bug)

Attachments

(1 file)

STR:

  • install an extension that include a devtools_page property in the manifest and a "devtools" optional permission
  • grant the "devtools" optional permission (currently the extension has to request the permission using the permissions API, but once Bug 1624513 lands the user will be able to grant the devtools permission from about:addons)
  • open a new tab on a webpage and open the developer toolbox
  • expected behavior:
    • the extension is listed in the devtools toolbox settings view (in the section tools installed by add-ons) and it is enabled
  • revoke the "devtools" optional permission (same as for granting, once Bug 1624513 lands the user will be able to revoke it from about:addons)
  • expected:
    • the extension is not listed anymore in the devtools toolbox option (in the section tools installed by add-ons)
  • close the developer toolbox
  • grant the "devtools" optional permission again
  • open the developer toolbox again
  • expected behavior:
    • the extension is listed in the devtools toolbox settings view (in the section tools installed by add-ons) and it is enabled
  • actual behavior:
    • the extension is listed in the devtools toolbox settings view (in the section tools installed by add-ons) but it is disabled

The issue is triggered by the fact that when the devtools permission has been revoked we do explicitly disable the per addon about:config pref which is used by the devtools toolbox internals to decide if the "Developer Tools installed by that add-on" should be enabled or disabled:

But we are not setting it back to enabled when the user did grant the "devtools" permission again:

The fix should be applied in the add-permissions listeners linked above, and then an additional test case should be added to cover this scenario and the fix, it should be enough to expand the test case defined in the existing browser_ext_devtools_optional.js test file.

Mentor: lgreco
Severity: -- → S4
Keywords: good-first-bug
Priority: -- → P3
See Also: → 1624513

I am interested in working on this bug, Please let me know if I may 😃

(In reply to Ankush Dua from comment #1)

I am interested in working on this bug, Please let me know if I may 😃

Sure thing, in comment 0 you can find details related to how to reproduce the issue (which is important to understand what has to be fixed and how your changes are affecting the actual behavior) and where to look for the relevant code and relevant test file.

If this is the first Firefox issue you are looking into, I would suggest to also read the following documentation pages:

I am very new to firefox and I had a few initial things to ask:

  1. I don't know any extension that requires a devtools optional permission, so I downloaded extensions from here which had devtools_page property in manifest.json, but I am not sure how I can load my local addons extension to my local build of firefox, If you could point me to some resource from where I can learn to do just that, it would be wonderful. and if you have any extension that you know does have devtools_pages property in its manifest.json, that will be awsome
  2. I am new to firefox as a whole, so asking just to make sure I am getting things correctly, developer toolbox is the panel that opens up when we right click on a webpage and click inspect? (where we debug our code in browser and much more)?
  3. I could not find the following section in developer toolbox setting: ( to go to settings in developer toolbox we need to click 3 vertical dots on the top right of the toolbar right?) and could not find any addons listed there.

the extension is listed in the devtools toolbox settings view (in the section tools installed by add-ons) and it is enabled

  1. Does the extension ask for the devtools permission itself or do we have to manually go to a dedicated section to grant that permission?

Thank You!..

(In reply to Ankush Dua from comment #3)

I am very new to firefox and I had a few initial things to ask:

  1. I don't know any extension that requires a devtools optional permission, so I downloaded extensions from here which had devtools_page property in manifest.json, but I am not sure how I can load my local addons extension to my local build of firefox, If you could point me to some resource from where I can learn to do just that, it would be wonderful. and if you have any extension that you know does have devtools_pages property in its manifest.json, that will be awsome

Sure thing, you can find docs about how to develop extensions (including how to install them temporarily) in the following documentation website:

I would suggest you to take a look to this website to get a better picture of how to develop extensions.

The following doc page is the one that describes in a bit more detail how to install an extension temporarily while developing:

  1. I am new to firefox as a whole, so asking just to make sure I am getting things correctly, developer toolbox is the panel that opens up when we right click on a webpage and click inspect? (where we debug our code in browser and much more)?

Yes, the developer toolbox we refer to here is the one related to the current tab (which is the one that gets opened when a user inspect a DOM element as you are describing):

  1. I could not find the following section in developer toolbox setting: ( to go to settings in developer toolbox we need to click 3 vertical dots on the top right of the toolbar right?) and could not find any addons listed there.

the extension is listed in the devtools toolbox settings view (in the section tools installed by add-ons) and it is enabled

From what you describe I guess that your devtools_page is not creating any devtools panel, the devtools_page is actually an invisible page similar to the background page and it has to explicitly create the panels that are actually going to be visible to the user.

You may find the following MDN doc page useful to learn more about how the extension can extend the developer tools (and this doc page also mention what I briefly described above about the devtools_page being actually invisible):

You should also take a look to the existing devtools API examples in the mdn/webextensions-examples repository, because they are small and simple examples and they would also help you to get a better picture:

  1. Does the extension ask for the devtools permission itself or do we have to manually go to a dedicated section to grant that permission?

both:

  1. the extension can ask for new optional permission to be granted using the browser.permissions API (and can also revoke them, revoking doesn't need to ask to the user any confirmation, granting one does wait for the user confirmation), see the following API reference and example:
  2. Starting from Firefox 84 the user can also grant and revoke the optional permissions from the extension detail view in about:addons (you can see also a brief demo of this feature from our last Add-ons Show and Tell meeting here)

Thank You!..

You welcome, let me know if this bugzilla comment did not yet answer all your questions (and/or if they do then let me know how it is going and you got stuck on something).

As a side note: When you add a comment with questions for me on bugzilla you can also add a "Request information" assigned to me (you can find it at the bottom of the bugzilla page, check it and choose mentor in the related select popup), by doing that I will be notified that there is a question pending an answer from me (I still go through my mentored bugs during the week, but I may get to your questions sooner if I'm aware that you are waiting for my reply).

Hello,
I have submitted a patch for this bug.
Here is the link to the patch
Please let me know how it looks.

Also Please let me know if I made any mistakes while submitting it, as it was my first patch to Mozilla's repo.

Thank you for your guidance along the way :)

Flags: needinfo?(lgreco)
Assignee: nobody → ankushduacodes
Status: NEW → ASSIGNED

(In reply to Ankush Dua from comment #6)

Hello,
I have submitted a patch for this bug.
Here is the link to the patch
Please let me know how it looks.

Also Please let me know if I made any mistakes while submitting it, as it was my first patch to Mozilla's repo.

Thank you for your guidance along the way :)

Thanks for submitting a patch!
I replied on phabricator with more details about the changes needed to finalize the patch.

Flags: needinfo?(lgreco)
Attachment #9191466 - Attachment description: Bug 1671579 - patch: extension to be automatically enabled from a toolbox perspective → Bug 1671579 - Granting the devtools optional permission should also enabled the extension devtools page from a toolbox perspective
Pushed by cbrindusan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/351f9ecd353e
Granting the devtools optional permission should also enabled the extension devtools page from a toolbox perspective r=rpl
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch

Thanks for the patch, Ankush! 🙏

Many more to go, Thank you for the opportunity, Caitlin and Luca :)

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