Skip to content

Commit

Permalink
origOpen to nativeOpen, same for Send
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Oct 21, 2022
1 parent dee24bd commit 94a419f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/scriptlets/trusted-replace-xhr-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export function trustedReplaceXhrResponse(source, pattern = '', replacement = ''

// eslint-disable-next-line no-console
const log = console.log.bind(console);
const origOpen = window.XMLHttpRequest.prototype.open;
const origSend = window.XMLHttpRequest.prototype.send;
const nativeOpen = window.XMLHttpRequest.prototype.open;
const nativeSend = window.XMLHttpRequest.prototype.send;

const MATCH_ALL_CHARACTERS_REGEX = /[\s\S]/;

Expand Down Expand Up @@ -176,7 +176,7 @@ export function trustedReplaceXhrResponse(source, pattern = '', replacement = ''
hit(source);
});

origOpen.apply(secretXhr, [xhrData.method, xhrData.url]);
nativeOpen.apply(secretXhr, [xhrData.method, xhrData.url]);

// Mimic request headers before sending
// setRequestHeader can only be called on open request objects
Expand All @@ -188,7 +188,7 @@ export function trustedReplaceXhrResponse(source, pattern = '', replacement = ''
});
requestHeaders = [];

origSend.call(secretXhr, args);
nativeSend.call(secretXhr, args);
return undefined;
};

Expand Down

0 comments on commit 94a419f

Please sign in to comment.