From a5c13847693a2e5847bc83f605a04feab5fc1574 Mon Sep 17 00:00:00 2001 From: Slapbox Date: Fri, 4 Jun 2021 19:00:17 -0400 Subject: [PATCH] Wraps chrome.storage with try/catch Fixes #767 --- src/browser/extension/options/syncOptions.js | 34 +++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/browser/extension/options/syncOptions.js b/src/browser/extension/options/syncOptions.js index b04d1730..fc4a6681 100644 --- a/src/browser/extension/options/syncOptions.js +++ b/src/browser/extension/options/syncOptions.js @@ -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 } };