Skip to content

Commit

Permalink
fix: Request persistent storage on installation
Browse files Browse the repository at this point in the history
  • Loading branch information
birtles committed Mar 1, 2021
1 parent 964fda9 commit d34209f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,18 @@ function onTabSelect(tabId: number) {
});
}

browser.runtime.onInstalled.addListener(() => {
browser.runtime.onInstalled.addListener(async () => {
// Request persistent storage permission
let persisted = await navigator.storage.persisted();
if (!persisted) {
persisted = await navigator.storage.persist();
if (persisted) {
Bugsnag.leaveBreadcrumb('Got persistent storage permission');
} else {
Bugsnag.leaveBreadcrumb('Failed to get persistent storage permission');
}
}

Bugsnag.leaveBreadcrumb('Running initJpDict from onInstalled...');
initJpDict();
});
Expand Down

0 comments on commit d34209f

Please sign in to comment.