Skip to content
This repository was archived by the owner on Nov 15, 2017. It is now read-only.

Commit 9f52830

Browse files
committed
if main_frame is newly blocked, page needs reload
1 parent 04eaa64 commit 9f52830

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

js/tab.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,13 +403,18 @@ HTTPSB.smartReloadTab = function(tabId) {
403403
// https://github.com/gorhill/httpswitchboard/issues/94
404404
// https://github.com/gorhill/httpswitchboard/issues/141
405405
if ( !mustReload ) {
406+
var reloadNewlyBlockedTypes = {
407+
'main_frame': true,
408+
'script' : true,
409+
'sub_frame': true
410+
};
406411
var blockRuleType;
407412
for ( blockRule in newState ) {
408413
if ( !newState.hasOwnProperty(blockRule) ) {
409414
continue;
410415
}
411416
blockRuleType = blockRule.slice(0, blockRule.indexOf('|'));
412-
if ( blockRuleType !== 'script' && blockRuleType !== 'sub_frame' ) {
417+
if ( !reloadNewlyBlockedTypes[blockRuleType] ) {
413418
continue;
414419
}
415420
if ( !oldState[blockRule] ) {
@@ -420,6 +425,8 @@ HTTPSB.smartReloadTab = function(tabId) {
420425
}
421426
}
422427

428+
// console.log('old state: %o\nnew state: %o', oldState, newState);
429+
423430
if ( mustReload ) {
424431
chrome.tabs.reload(tabId);
425432
}

0 commit comments

Comments
 (0)