mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
fix #3077
This commit is contained in:
parent
e1ba1a39c2
commit
e7e390d2e2
3 changed files with 15 additions and 19 deletions
|
|
@ -33,7 +33,8 @@
|
||||||
{
|
{
|
||||||
"matches":[
|
"matches":[
|
||||||
"http://*/*",
|
"http://*/*",
|
||||||
"https://*/*"
|
"https://*/*",
|
||||||
|
"file://*/*"
|
||||||
],
|
],
|
||||||
"js":[
|
"js":[
|
||||||
"js/vapi-client.js",
|
"js/vapi-client.js",
|
||||||
|
|
|
||||||
|
|
@ -1114,20 +1114,10 @@ vAPI.domCollapser = (function() {
|
||||||
var send = function() {
|
var send = function() {
|
||||||
processTimer = undefined;
|
processTimer = undefined;
|
||||||
toCollapse.set(resquestIdGenerator, toProcess);
|
toCollapse.set(resquestIdGenerator, toProcess);
|
||||||
// https://github.com/gorhill/uBlock/issues/1927
|
|
||||||
// Normalize hostname to avoid trailing dot of FQHN.
|
|
||||||
var pageHostname = window.location.hostname || '';
|
|
||||||
if (
|
|
||||||
pageHostname.length &&
|
|
||||||
pageHostname.charCodeAt(pageHostname.length - 1) === 0x2e
|
|
||||||
) {
|
|
||||||
pageHostname = pageHostname.slice(0, -1);
|
|
||||||
}
|
|
||||||
var msg = {
|
var msg = {
|
||||||
what: 'getCollapsibleBlockedRequests',
|
what: 'getCollapsibleBlockedRequests',
|
||||||
id: resquestIdGenerator,
|
id: resquestIdGenerator,
|
||||||
pageURL: window.location.href,
|
frameURL: window.location.href,
|
||||||
pageHostname: pageHostname,
|
|
||||||
resources: toFilter,
|
resources: toFilter,
|
||||||
hash: cachedBlockedSetHash
|
hash: cachedBlockedSetHash
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -699,21 +699,26 @@ PageStore.prototype.filterLargeMediaElement = function(size) {
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
PageStore.prototype.getBlockedResources = function(request, response) {
|
PageStore.prototype.getBlockedResources = function(request, response) {
|
||||||
var resources = request.resources;
|
var µburi = µb.URI,
|
||||||
|
normalURL = µb.normalizePageURL(this.tabId, request.frameURL),
|
||||||
|
frameHostname = µburi.hostnameFromURI(normalURL),
|
||||||
|
resources = request.resources;
|
||||||
|
// Force some resources to go through the filtering engine in order to
|
||||||
|
// populate the blocked-resources cache. This is required because for
|
||||||
|
// some resources it's not possible to detect whether they were blocked
|
||||||
|
// content script-side (i.e. `iframes` -- unlike `img`).
|
||||||
if ( Array.isArray(resources) && resources.length !== 0 ) {
|
if ( Array.isArray(resources) && resources.length !== 0 ) {
|
||||||
var context = this.createContextFromFrameHostname(request.pageHostname);
|
var context = this.createContextFromFrameHostname(frameHostname);
|
||||||
for ( var resource of resources ) {
|
for ( var resource of resources ) {
|
||||||
context.requestType = resource.type;
|
context.requestType = resource.type;
|
||||||
context.requestHostname = µb.URI.hostnameFromURI(resource.url);
|
context.requestHostname = µburi.hostnameFromURI(resource.url);
|
||||||
context.requestURL = resource.url;
|
context.requestURL = resource.url;
|
||||||
this.filterRequest(context);
|
this.filterRequest(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( this.netFilteringCache.hash === response.hash ) {
|
if ( this.netFilteringCache.hash === response.hash ) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
response.hash = this.netFilteringCache.hash;
|
response.hash = this.netFilteringCache.hash;
|
||||||
response.blockedResources = this.netFilteringCache.lookupAllBlocked(request.pageHostname);
|
response.blockedResources = this.netFilteringCache.lookupAllBlocked(frameHostname);
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue