Skip to content

Commit

Permalink
fix duplicate values
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Oct 18, 2022
1 parent 4a3bd7d commit e21452b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/scriptlets/trusted-replace-xhr-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ export function trustedReplaceXhrResponse(source, pattern, replacement, propsToM
const parsedPattern = pattern === getWildcardSymbol()
? MATCH_ALL_CHARACTERS_REGEX
: pattern;
const modifiedResponse = thisArg.responseText.replace(parsedPattern, replacement);
const modifiedResponseText = thisArg.responseText.replace(parsedPattern, replacement);

const modifiedContent = thisArg.responseText.replace(parsedPattern, replacement);

// Mock response object
Object.defineProperties(thisArg, {
readyState: { value: 4, writable: false },
response: { value: modifiedResponse, writable: false },
responseText: { value: modifiedResponseText, writable: false },
response: { value: modifiedContent, writable: false },
responseText: { value: modifiedContent, writable: false },
responseURL: { value: responseUrl, writable: false },
responseXML: { value: '', writable: false },
status: { value: 200, writable: false },
Expand Down Expand Up @@ -170,6 +170,7 @@ export function trustedReplaceXhrResponse(source, pattern, replacement, propsToM

trustedReplaceXhrResponse.names = [
'trusted-replace-xhr-response',
// trusted scriptlets support no aliases
];

trustedReplaceXhrResponse.injections = [
Expand Down

0 comments on commit e21452b

Please sign in to comment.