mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-22 10:22:51 +01:00
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;
|
const XHRBefore = XMLHttpRequest.prototype;
|
||||||
self.XMLHttpRequest = class extends self.XMLHttpRequest {
|
self.XMLHttpRequest = class extends self.XMLHttpRequest {
|
||||||
open(method, url, defer, ...args) {
|
open(method, url, ...args) {
|
||||||
xhrInstances.delete(this);
|
xhrInstances.delete(this);
|
||||||
if ( warOrigin !== undefined && url.startsWith(warOrigin) ) {
|
if ( warOrigin !== undefined && url.startsWith(warOrigin) ) {
|
||||||
return super.open(method, url, defer, ...args);
|
return super.open(method, url, ...args);
|
||||||
}
|
}
|
||||||
const haystack = { method, url };
|
const haystack = { method, url };
|
||||||
if ( propsToMatch === '' && directive === '' ) {
|
if ( propsToMatch === '' && directive === '' ) {
|
||||||
safe.uboLog(logPrefix, `Called: ${safe.JSON_stringify(haystack, null, 2)}`);
|
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) ) {
|
if ( matchObjectProperties(propNeedles, haystack) ) {
|
||||||
const xhrDetails = Object.assign(haystack, {
|
const xhrDetails = Object.assign(haystack, {
|
||||||
xhr: this,
|
xhr: this,
|
||||||
defer,
|
defer: args.length === 0 || !!args[0],
|
||||||
directive,
|
directive,
|
||||||
headers: {
|
headers: {
|
||||||
'date': '',
|
'date': '',
|
||||||
@ -1646,7 +1646,7 @@ function preventXhrFn(
|
|||||||
});
|
});
|
||||||
xhrInstances.set(this, xhrDetails);
|
xhrInstances.set(this, xhrDetails);
|
||||||
}
|
}
|
||||||
return super.open(method, url, defer, ...args);
|
return super.open(method, url, ...args);
|
||||||
}
|
}
|
||||||
send(...args) {
|
send(...args) {
|
||||||
const xhrDetails = xhrInstances.get(this);
|
const xhrDetails = xhrInstances.get(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user