Skip to content

Commit d87ebc5

Browse files
author
Beatriz Rizental
authored
Merge pull request #1210 from brizental/1723130-webext-permissions-check
Bug 1723130 - Provide comprehensive error message when permissions are incorrect for webexts
2 parents dc3e4fb + aaadcf9 commit d87ebc5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ cannot be negative numbers.
1212
* When offline Glean will not attempt to install glean_parser.
1313
* [#1178](https://github.com/mozilla/glean.js/pull/1178): Enable running the `glean` command with as many or as little arguments as wanted.
1414
* Previously the command could only be run with 3 commands, even though all glean_parser commands would have been valid commands for the `glean` CLI.
15+
* [#1210](https://github.com/mozilla/glean.js/pull/1210): Show comprehensive error message when missing `storage` permissions for Glean on web extensions.
1516

1617
# v0.31.0 (2022-01-25)
1718

glean/src/platform/browser/webext/storage.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ class WebExtStore implements Store {
6969
the webextension-polyfill peer dependency. To do so, run \`npm i webextension-polyfill\`.`
7070
);
7171
}
72+
73+
if (typeof browser.storage.local === "undefined") {
74+
throw Error(
75+
`Unable to access web extension storage.
76+
This is probably happening due to missing \`storage\` API permissions.
77+
Make sure this permission was set on the manifest.json file.`
78+
);
79+
}
80+
7281
this.store = browser.storage.local;
7382
this.rootKey = rootKey;
7483
this.logTag = `${LOG_TAG}.${rootKey}`;

0 commit comments

Comments
 (0)