diff --git a/manage/import-export.js b/manage/import-export.js index 8f3a4ee4..340b2b20 100644 --- a/manage/import-export.js +++ b/manage/import-export.js @@ -291,7 +291,8 @@ function importFromString(jsonString) { function refreshTab(tab, ownTab, resolve) { const tabId = tab.id; chrome.webNavigation.getAllFrames({tabId}, frames => { - (frames || []).forEach(({frameId}) => + frames = frames && frames[0] ? frames : [{frameId: 0}]; + frames.forEach(({frameId}) => getStylesSafe({matchUrl: tab.url, enabled: true, asHash: true}).then(styles => { const message = {method: 'styleReplaceAll', tabId, frameId, styles}; if (tab.id === ownTab.id) { diff --git a/popup/hotkeys.js b/popup/hotkeys.js index 0bb1e9c5..d2813258 100644 --- a/popup/hotkeys.js +++ b/popup/hotkeys.js @@ -118,7 +118,8 @@ var hotkeys = (() => { function refreshTab(tab) { const tabId = tab.id; - chrome.webNavigation.getAllFrames({tabId}, frames => !frames && ignoreChromeError() || + chrome.webNavigation.getAllFrames({tabId}, frames => { + frames = frames && frames[0] ? frames : [{frameId: 0}]; frames.forEach(({frameId}) => getStylesSafe({matchUrl: tab.url, enabled: true, asHash: true}).then(styles => { const message = {method: 'styleReplaceAll', tabId, frameId, styles}; @@ -126,7 +127,9 @@ var hotkeys = (() => { if (frameId === 0) { setTimeout(BG.updateIcon, 0, tab, styles); } - }))); + })); + ignoreChromeError(); + }); } function initHotkeyInfo() {