mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
reversing fix to #868: does not work with latest FF/Nightly
This commit is contained in:
parent
7dabe471ad
commit
7b81b82e4b
@ -210,18 +210,12 @@ var contentObserver = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//console.log('shouldLoad: type=' + type + ' url=' + location.spec);
|
//console.log('shouldLoad: type=' + type + ' url=' + location.spec);
|
||||||
var r;
|
|
||||||
if ( typeof messageManager.sendRpcMessage === 'function' ) {
|
if ( typeof messageManager.sendRpcMessage === 'function' ) {
|
||||||
// https://bugzil.la/1092216
|
// https://bugzil.la/1092216
|
||||||
r = messageManager.sendRpcMessage(this.cpMessageName, details);
|
messageManager.sendRpcMessage(this.cpMessageName, details);
|
||||||
} else {
|
} else {
|
||||||
// Compatibility for older versions
|
// Compatibility for older versions
|
||||||
r = messageManager.sendSyncMessage(this.cpMessageName, details);
|
messageManager.sendSyncMessage(this.cpMessageName, details);
|
||||||
}
|
|
||||||
|
|
||||||
// Important: hard test against `false`.
|
|
||||||
if ( Array.isArray(r) && r[0] === false ) {
|
|
||||||
return this.REJECT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.ACCEPT;
|
return this.ACCEPT;
|
||||||
|
@ -2042,7 +2042,18 @@ var httpObserver = {
|
|||||||
// http-on-opening-request
|
// http-on-opening-request
|
||||||
|
|
||||||
var pendingRequest = this.lookupPendingRequest(URI.spec);
|
var pendingRequest = this.lookupPendingRequest(URI.spec);
|
||||||
var rawtype = channel.loadInfo && channel.loadInfo.contentPolicyType || 1;
|
|
||||||
|
// https://github.com/gorhill/uMatrix/issues/390#issuecomment-155759004
|
||||||
|
var rawtype = 1;
|
||||||
|
var loadInfo = channel.loadInfo;
|
||||||
|
if ( loadInfo ) {
|
||||||
|
rawtype = loadInfo.externalContentPolicyType !== undefined ?
|
||||||
|
loadInfo.externalContentPolicyType :
|
||||||
|
loadInfo.contentPolicyType;
|
||||||
|
if ( !rawtype ) {
|
||||||
|
rawtype = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Behind-the-scene request
|
// Behind-the-scene request
|
||||||
if ( pendingRequest === null ) {
|
if ( pendingRequest === null ) {
|
||||||
@ -2186,21 +2197,6 @@ vAPI.net.registerListeners = function() {
|
|||||||
return sourceTabId;
|
return sourceTabId;
|
||||||
};
|
};
|
||||||
|
|
||||||
var shouldLoadMedia = function(details) {
|
|
||||||
var uri = Services.io.newURI(details.url, null, null);
|
|
||||||
|
|
||||||
var r = vAPI.net.onBeforeRequest.callback({
|
|
||||||
frameId: details.frameId,
|
|
||||||
hostname: uri.asciiHost,
|
|
||||||
parentFrameId: details.parentFrameId,
|
|
||||||
tabId: details.tabId,
|
|
||||||
type: 'media',
|
|
||||||
url: uri.asciiSpec
|
|
||||||
});
|
|
||||||
|
|
||||||
return typeof r !== 'object' || r === null;
|
|
||||||
};
|
|
||||||
|
|
||||||
var shouldLoadListenerMessageName = location.host + ':shouldLoad';
|
var shouldLoadListenerMessageName = location.host + ':shouldLoad';
|
||||||
var shouldLoadListener = function(e) {
|
var shouldLoadListener = function(e) {
|
||||||
// Non blocking: it is assumed that the http observer is fired after
|
// Non blocking: it is assumed that the http observer is fired after
|
||||||
@ -2221,15 +2217,6 @@ vAPI.net.registerListeners = function() {
|
|||||||
sourceTabId = shouldBlockPopup(details);
|
sourceTabId = shouldBlockPopup(details);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/gorhill/uBlock/issues/868
|
|
||||||
// Firefox quirk: for some reasons, there are instances of resources
|
|
||||||
// for `video` tag not being reported to HTTP observers.
|
|
||||||
// If blocking, do not bother creating a pending request entry, it
|
|
||||||
// won't be used anyway.
|
|
||||||
if ( details.rawtype === 15 && shouldLoadMedia(details) === false ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We are being called synchronously from the content process, so we
|
// We are being called synchronously from the content process, so we
|
||||||
// must return ASAP. The code below merely record the details of the
|
// must return ASAP. The code below merely record the details of the
|
||||||
// request into a ring buffer for later retrieval by the HTTP observer.
|
// request into a ring buffer for later retrieval by the HTTP observer.
|
||||||
|
Loading…
Reference in New Issue
Block a user