refreshAllTabs should always try to refresh the main page

This commit is contained in:
tophf 2017-12-09 21:19:03 +03:00
parent 2fe4c0793c
commit e41dda1b68
2 changed files with 7 additions and 3 deletions

View File

@ -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) {

View File

@ -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() {