fregante / webext-permission-toggle

Browser-action context menu to request permission for the current tab.
https://fregante.github.io/webext-permission-toggle/
MIT License
70 stars 5 forks source link

Throws on mobile Firefox #52

Closed fregante closed 3 months ago

fregante commented 3 months ago

According to MDN, the API:

Returns null for missing values, and removes unsupported keys

This means that it probably removes the "contextMenus" permission. This makes it difficult to detect when the author simply forgot to add it. The safest way would be to use fetch(chrome.runtime.getURL('manifest.json')) and read it directly, but that's annoying and makes the function async :(

00:13:02.267 Uncaught Error: webext-permission-toggle requires the `contextMenus` permission
    addPermissionToggle moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5183
    <anonymous> moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5857
    <anonymous> moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5961
    <anonymous> moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5963
background.js:5183:15
    addPermissionToggle moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5183
    <anonymous> moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5857
    <anonymous> moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5961
    <anonymous> moz-extension://24fb74ed-aa72-4132-a59d-33a31291dced/assets/background.js:5963

Context:

Related: