Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browser.permissions.request doesn't return a promise #38

Closed
olsh opened this issue Jun 3, 2017 · 4 comments
Closed

browser.permissions.request doesn't return a promise #38

olsh opened this issue Jun 3, 2017 · 4 comments

Comments

@olsh
Copy link

olsh commented Jun 3, 2017

Browser: Chrome 58
Library version: 0.1.1

I'm using this code on an extension options page:

browser.permissions.request({
            origins: ["<all_urls>"]
        }).then(function (granted) {
                // do something
            })

The popup request is showing, but the code throws the error:

Uncaught TypeError: Cannot read property 'then' of undefined
@shatgupt
Copy link

Encountered this issue while trying to use optional permissions.

@romantaraban
Copy link

romantaraban commented Jul 14, 2017

The library is missing definitions for permissions API in api-metadata.json, please see #44

@sladiri
Copy link

sladiri commented May 4, 2019

Could you please explain how this issue is resolved? I cannot get my version of this permissions example to work, since browser.permissions.request({ permissions: ['history'] }) never resolves. If I try to grant this permission in my extension, it also breaks the original exmple extension (the permission popup never appears).
Firefox 67.0b16 (64-bit)

https://github.com/mdn/webextensions-examples/blob/master/permissions/page.js

I created a repo with my code:
https://github.com/sladiri/web-extension-test/blob/master/src/permissions.js#L13

@sladiri
Copy link

sladiri commented May 5, 2019

I was unaware that this API is new and seems to be not really consistent yet. So I guess I just have to wait, I have the same experience as in this answer on SO https://stackoverflow.com/a/47729896/7309920
I understand that such an API requires careful design so that it cannot be abused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants