From 4291c874d9bdfe3d6997afdf5863c532f463e877 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 17 Oct 2024 12:11:50 -0400 Subject: [PATCH] Fix regression in `prevent-xhr` scriptlet Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/3418 --- assets/resources/scriptlets.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index 8db2877fc..3a7511ba9 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -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);