1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-16 23:42:39 +01:00
This commit is contained in:
Chris 2015-04-08 01:16:28 -06:00
parent ff3a3b14b1
commit 42dae93ff0

View File

@ -69,14 +69,10 @@ var onBeforeRequest = function(details) {
// 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 ) {
// https://github.com/gorhill/uBlock/issues/1025
// Google Hangout popup opens without a root frame. So for now we will
// just discard that best-guess root frame if it is too far in the
// future, at which point it ceases to be a "best guess".
if ( (Date.now() - mostRecentRootDocURLTimestamp) >= 500 ) { if ( (Date.now() - mostRecentRootDocURLTimestamp) >= 500 ) {
mostRecentRootDocURL = ''; mostRecentRootDocURL = '';
} }
if ( !pageStore ) {
// https://github.com/gorhill/uBlock/issues/1001 // https://github.com/gorhill/uBlock/issues/1001
// Not a behind-the-scene request, yet no page store found for the // Not a behind-the-scene request, yet no page store found for the
// tab id: we will thus bind the last-seen root document to the // tab id: we will thus bind the last-seen root document to the
@ -120,6 +116,9 @@ var onBeforeRequest = function(details) {
requestContext.requestURL = requestURL; requestContext.requestURL = requestURL;
requestContext.requestHostname = details.hostname; requestContext.requestHostname = details.hostname;
requestContext.requestType = requestType; requestContext.requestType = requestType;
if(!isFrame && mostRecentRootDocURL !== '') {
requestContext.pageHostname = µb.URI.hostnameFromURI(mostRecentRootDocURL);
}
var result = pageStore.filterRequest(requestContext); var result = pageStore.filterRequest(requestContext);