Skip to content

Commit 011d7cd

Browse files
committed
this fixes gorhill#67
1 parent cbb075d commit 011d7cd

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

js/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ var HTTPSB = {
8484

8585
// record what chromium is soing behind the scene
8686
behindTheSceneURL: 'http://chromium.behind.the.scene',
87-
behindTheSceneTabId: 0x7FFFFFFFFFFFFFFF,
87+
behindTheSceneTabId: 0x7FFFFFFF,
8888
behindTheSceneMaxReq: 250,
8989

9090
// Popup menu

js/start.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function onUpdatedTabsHandler(tabId, changeInfo, tab) {
107107
// Ensure we have a url stats store and that the tab is bound to it.
108108
var pageStats = pageStatsFromTabId(tab.id);
109109
if ( !pageStats ) {
110-
return;
110+
pageStats = bindTabToPageStats(tab.id, pageUrl);
111111
}
112112

113113
// Chrome webstore can't be injected with foreign code, following is to
@@ -173,10 +173,15 @@ load();
173173

174174
/******************************************************************************/
175175

176-
// Virtual tab to collect behind the scene traffic: we want to know what is
177-
// going on in there.
176+
// rhill 2013-11-24: bind behind-the-scene virtual tab/url manually, since the
177+
// normal way forbid binding behind the scene tab.
178+
// https://github.com/gorhill/httpswitchboard/issues/67
178179

179-
bindTabToPageStats(HTTPSB.behindTheSceneTabId, HTTPSB.behindTheSceneURL);
180+
(function(tabId, pageUrl) {
181+
var pageStats = createPageStats(pageUrl);
182+
HTTPSB.pageUrlToTabId[pageUrl] = tabId;
183+
HTTPSB.tabIdToPageUrl[tabId] = pageUrl;
184+
})(HTTPSB.behindTheSceneTabId, HTTPSB.behindTheSceneURL);
180185

181186
/******************************************************************************/
182187

js/tab.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,17 @@ function bindTabToPageStats(tabId, pageUrl) {
305305
if ( !pageStats ) {
306306
return undefined;
307307
}
308+
308309
// console.debug('bindTabToPageStats > dispatching traffic in tab id %d to url stats store "%s"', tabId, pageUrl);
309-
unbindTabFromPageStats(tabId);
310-
HTTPSB.pageUrlToTabId[pageUrl] = tabId;
311-
HTTPSB.tabIdToPageUrl[tabId] = pageUrl;
310+
// rhill 2013-11-24: Never ever rebind chromium-behind-the-scene
311+
// virtual tab.
312+
// https://github.com/gorhill/httpswitchboard/issues/67
313+
if ( tabId !== HTTPSB.behindTheSceneTabId ) {
314+
unbindTabFromPageStats(tabId);
315+
HTTPSB.pageUrlToTabId[pageUrl] = tabId;
316+
HTTPSB.tabIdToPageUrl[tabId] = pageUrl;
317+
}
318+
312319
return pageStats;
313320
}
314321

0 commit comments

Comments
 (0)