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

View file

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