mirror of https://github.com/gorhill/uBlock.git
Fix regression in `prevent-xhr` scriptlet
Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/3418
This commit is contained in:
parent
98db549bb7
commit
4291c874d9
|
@ -1617,20 +1617,20 @@ function preventXhrFn(
|
|||
};
|
||||
const XHRBefore = XMLHttpRequest.prototype;
|
||||
self.XMLHttpRequest = class extends self.XMLHttpRequest {
|
||||
open(method, url, defer, ...args) {
|
||||
open(method, url, ...args) {
|
||||
xhrInstances.delete(this);
|
||||
if ( warOrigin !== undefined && url.startsWith(warOrigin) ) {
|
||||
return super.open(method, url, defer, ...args);
|
||||
return super.open(method, url, ...args);
|
||||
}
|
||||
const haystack = { method, url };
|
||||
if ( propsToMatch === '' && directive === '' ) {
|
||||
safe.uboLog(logPrefix, `Called: ${safe.JSON_stringify(haystack, null, 2)}`);
|
||||
return super.open(method, url, defer, ...args);
|
||||
return super.open(method, url, ...args);
|
||||
}
|
||||
if ( matchObjectProperties(propNeedles, haystack) ) {
|
||||
const xhrDetails = Object.assign(haystack, {
|
||||
xhr: this,
|
||||
defer,
|
||||
defer: args.length === 0 || !!args[0],
|
||||
directive,
|
||||
headers: {
|
||||
'date': '',
|
||||
|
@ -1646,7 +1646,7 @@ function preventXhrFn(
|
|||
});
|
||||
xhrInstances.set(this, xhrDetails);
|
||||
}
|
||||
return super.open(method, url, defer, ...args);
|
||||
return super.open(method, url, ...args);
|
||||
}
|
||||
send(...args) {
|
||||
const xhrDetails = xhrInstances.get(this);
|
||||
|
|
Loading…
Reference in New Issue