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

Commit c7a4a5a

Browse files
committed
this fixes #198
1 parent 8492980 commit c7a4a5a

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

js/async.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,11 @@ function onMessageHandler(request, sender, callback) {
219219
break;
220220

221221
case 'gotoURL':
222-
chrome.tabs.create({ url: request.url });
222+
if ( request.tabId ) {
223+
chrome.tabs.update(request.tabId, { url: request.url });
224+
} else {
225+
chrome.tabs.create({ url: request.url });
226+
}
223227
break;
224228

225229
case 'localAssetUpdated':

js/start.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,28 @@ HTTPSB.turnOn();
2828
/******************************************************************************/
2929

3030
function onUpdatedTabsHandler(tabId, changeInfo, tab) {
31-
// Can this happen?
32-
if ( !tab.url || !tab.url.length ) {
33-
return;
34-
}
35-
36-
var pageURL = uriTools.normalizeURI(tab.url);
37-
38-
// console.debug('tabs.onUpdated > tabId=%d changeInfo=%o tab=%o', tabId, changeInfo, tab);
39-
var protocol = uriTools.schemeFromURI(pageURL);
40-
if ( protocol !== 'http' && protocol !== 'https' ) {
41-
return;
42-
}
43-
4431
// Following code is for script injection, which makes sense only if
4532
// web page in tab is completely loaded.
4633
if ( changeInfo.status !== 'complete' ) {
4734
return;
4835
}
4936

37+
// Can this happen?
38+
if ( !tab.url || !tab.url.length ) {
39+
return;
40+
}
41+
5042
// rhill 2013-12-23: Compute state after whole page is loaded. This is
5143
// better than building a state snapshot dynamically when requests are
5244
// recorded, because here we are not afflicted by the browser cache
5345
// mechanism.
54-
var pageStats = HTTPSB.pageStatsFromPageUrl(pageURL);
46+
47+
// rhill 2014-03-05: Use tab id instead of page URL: this allows a
48+
// blocked page using HTTPSB internal data URI-based page to be properly
49+
// unblocked when user un-blacklist the hostname.
50+
// https://github.com/gorhill/httpswitchboard/issues/198
51+
52+
var pageStats = HTTPSB.pageStatsFromTabId(tabId);
5553
if ( pageStats ) {
5654
pageStats.state = HTTPSB.computeTabState(tabId);
5755
}

0 commit comments

Comments
 (0)