Skip to content

Commit

Permalink
Wraps chrome.storage with try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Slapbox authored Jun 4, 2021
1 parent c220fd1 commit a5c1384
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/browser/extension/options/syncOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,24 @@ const migrateOldOptions = (oldOptions) => {
const get = callback => {
if (options) callback(options);
else {
chrome.storage.sync.get({
useEditor: 0,
editor: '',
projectPath: '',
maxAge: 50,
filter: FilterState.DO_NOT_FILTER,
whitelist: '',
blacklist: '',
shouldCatchErrors: false,
inject: true,
urls: '^https?://localhost|0\\.0\\.0\\.0:\\d+\n^https?://.+\\.github\\.io',
showContextMenus: true
}, function(items) {
options = migrateOldOptions(items);
callback(options);
});
try {
chrome.storage.sync.get({
useEditor: 0,
editor: '',
projectPath: '',
maxAge: 50,
filter: FilterState.DO_NOT_FILTER,
whitelist: '',
blacklist: '',
shouldCatchErrors: false,
inject: true,
urls: '^https?://localhost|0\\.0\\.0\\.0:\\d+\n^https?://.+\\.github\\.io',
showContextMenus: true
}, function(items) {
options = migrateOldOptions(items);
callback(options);
});
} catch (err) {}; // Fixes issue #767
}
};

Expand Down

0 comments on commit a5c1384

Please sign in to comment.