try as much as possible to bind root doc to tab (#1001)

This commit is contained in:
gorhill 2015-03-13 08:36:12 -04:00
parent 6dd4a244fc
commit 0f206fd602
1 changed files with 8 additions and 2 deletions

View File

@ -201,12 +201,19 @@ var onHeadersReceived = function(details) {
return;
}
var requestURL = details.url;
// Lookup the page store associated with this tab id.
var µb = µBlock;
var pageStore = µb.pageStoreFromTabId(tabId);
if ( !pageStore ) {
if ( details.type === 'main_frame' && details.parentFrameId === -1 ) {
pageStore = µb.bindTabToPageStats(tabId, requestURL, 'beforeRequest');
}
if ( !pageStore ) {
return;
}
}
// https://github.com/gorhill/uBlock/issues/384
// https://github.com/gorhill/uBlock/issues/540
@ -215,7 +222,6 @@ var onHeadersReceived = function(details) {
// pageStore.skipLocalMirroring = headerStartsWith(details.responseHeaders, 'content-security-policy') !== '';
//}
var requestURL = details.url;
var requestHostname = details.hostname;
// https://github.com/gorhill/uBlock/issues/525