Closed Bug 1464436 Opened 7 years ago Closed 7 years ago

Can't call chrome.permissions.request() from a script in a browser action popup

Categories

(WebExtensions :: Untriaged, defect)

60 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1432083

People

(Reporter: bugzilla, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 Build ID: 20180516032328 Steps to reproduce: I checked out https://github.com/mdn/webextensions-examples/tree/master/permissions and did load unpacked add-on. I clicked the new toolbar button, I clicked "granted" next to history. Actual results: Nothing at all. Expected results: I should have gotten a popup asking me to allow/deny the history permission. I get this in stable ( Built from https://hg.mozilla.org/releases/mozilla-release/rev/03d4f76300bedeffd47c726ce7fee0221873da11 ). I get absolutely no visible effect at all in nightly ( Built from https://hg.mozilla.org/mozilla-central/rev/bf4762f10b8d3076d6862e88ca61f90271291508 ). Found when trying to use this API for https://github.com/greasemonkey/greasemonkey/issues/2962 .
I'm not entirely sure if this is a Permissions-related issue or a WebExtensions-related issue. Please correct this component if it's needed.
Component: Untriaged → Permission Manager
Product: Firefox → Core
Component: Permission Manager → WebExtensions: Untriaged
Product: Core → Toolkit
Ah, then the next thing I tried failed! My real extension (Greasemonkey) tries to put all its UI in the browser action popup. If I install the originally linked permissions example, only, it works. If I install it and (an in-development version of) Greasemonkey (which tries to call chrome.permissions.request(), from the browser action popup), it works. If I click the element which causes chrome.permissions.request() to be called, from a script in the browser action popup, it fails to do anything, and also breaks the example extension, until browser restart.
Summary: Web extension permission request broken in nightly → Can't call chrome.permissions.request() from a script in a browser action popup
(In reply to Anthony Lieuallen from comment #3) > If I click the element which causes chrome.permissions.request() to be > called, from a script in the browser action popup, it fails to do anything, > and also breaks the example extension, until browser restart. I'm not sure I follow, are you saying you use `element.click()` to script a click on some element for which the handler calls browser.permissions.request()? That won't work since a script-generated click is not a user-initiated action. As for breaking the example extension, I can't say for certain without seeing your code but I suspect the extension breaks if it does not catch the exception/rejection from permissions.request(). In any case, can you attach an extension that illustrates the problem?
Flags: needinfo?(arantius)
When I say "I click" I mean me, a human being with my hand, presses the button on my mouse, while hovering the element that has a click event listener (which calls request). Here's an XPI which (at least when unpacked and temporary loaded) triggers the bug. Click the button in its browser action then click 'grant' in the example, and (both times) nothing happens.
Flags: needinfo?(arantius)
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: