javascriptfirefox-addonfirefox-addon-webextensions

Firefox extension for android mobile permissions error


I am working on an extension for Firefox for Android, but I am running into issues with permissions. I have this piece of code that checks what permissions the extension has.

const bookmarks = await browser.permissions.contains({ permissions: ['bookmarks'] });
const downloads = await browser.permissions.contains({ permissions: ['downloads'] });
const history = await browser.permissions.contains({ permissions: ['history'] });
const notifications = await browser.permissions.contains({ permissions: ['notifications'] });
const webNavigation = await browser.permissions.contains({ permissions: ['webNavigation'] });

The problem is that when debugging on mobile I get this error for the bookmarks and history lines.

Error: Type error for parameter permissions (Error processing permissions.0: Value "bookmarks" must either: must either [must either [must either [be one of ["idle"], be one of ["activeTab"], be one of ["cookies"], be one of ["scripting"], or be one of ["webRequest", "webRequestAuthProvider", "webRequestBlocking", "webRequestFilterResponse", "webRequestFilterResponse.serviceWorkerScript"]], must either [be one of ["mozillaAddons"], be one of ["geckoViewAddons", "nativeMessagingFromContent"], be one of ["activityLog"], be one of ["networkStatus"], or be one of ["telemetry"]], be one of ["alarms", "storage", "unlimitedStorage"], be one of ["declarativeNetRequestWithHostAccess"], be one of ["dns"], or be one of ["theme"]], must either [must either [be one of ["idle"], be one of ["activeTab"], be one of ["cookies"], be one of ["scripting"], or be one of ["webRequest", "webRequestAuthProvider", "webRequestBlocking", "webRequestFilterResponse", "webRequestFilterResponse.serviceWorkerScript"]], be one of ["clipboardRead", "clipboardWrite", "geolocation", "notifications"], be one of ["browsingData"], be one of ["tabs"], be one of ["browserSettings"], be one of ["declarativeNetRequestFeedback"], be one of ["downloads", "downloads.open"], be one of ["management"], be one of ["privacy"], be one of ["proxy"], be one of ["webNavigation"], or be one of ["nativeMessaging"]], be one of ["declarativeNetRequest"], or match the pattern /^experiments(\.\w+)+$/], or must either [be one of [], be one of ["userScripts"], or be one of ["trialML"]]) for permissions.contains.

Bookmarks and history are in the optional permissions in the manifest.json file, but I tried moving them to the permissions and it did not fix anything.


Solution

  • Firefox for Android does not support the bookmarks and history APIs (yet, maybe some day), not even as optional permissions.