1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 04:49:12 +02:00
This commit is contained in:
gorhill 2016-01-05 10:08:28 -05:00
parent 2ca410452e
commit 0b0b88684a
2 changed files with 15 additions and 5 deletions

View File

@ -81,8 +81,9 @@ vAPI.shutdown = (function() {
}
var filters = self.rpc({
fnName: 'getScriptTagFilters',
url: location.href,
hostname: hostname
rootURL: self.top.location.href,
frameURL: self.location.href,
frameHostname: hostname
});
if ( typeof filters !== 'string' || filters === '' ) {
return;

View File

@ -38,12 +38,21 @@ if ( typeof vAPI.rpcReceiver !== 'object' ) {
vAPI.rpcReceiver.getScriptTagFilters = function(details) {
var µb = µBlock;
var cfe = µb.cosmeticFilteringEngine;
if ( !cfe ) { return; }
var hostname = details.hostname;
return cfe.retrieveScriptTagRegex(
if ( !cfe ) {
return;
}
// Fetching the script tag filters first: assuming it is faster than
// checking whether the site is whitelisted.
var hostname = details.frameHostname;
var r = cfe.retrieveScriptTagRegex(
µb.URI.domainFromHostname(hostname) || hostname,
hostname
);
// https://github.com/gorhill/uBlock/issues/838
// Disable script tag filtering if document URL is whitelisted.
if ( r !== undefined && µb.getNetFilteringSwitch(details.rootURL) ) {
return r;
}
};
/******************************************************************************/