Skip to content

Commit

Permalink
fix trusted-replace-xhr-response
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed May 16, 2023
1 parent ef04555 commit a0e0db1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/scriptlets/trusted-replace-xhr-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,15 @@ export function trustedReplaceXhrResponse(source, pattern = '', replacement = ''
// Manually put required values into target XHR object
// as thisArg can't be redefined and XHR objects can't be (re)assigned or copied
Object.defineProperties(thisArg, {
readyState: { value: readyState },
response: { value: modifiedContent },
responseText: { value: modifiedContent },
responseURL: { value: responseURL },
responseXML: { value: responseXML },
status: { value: status },
statusText: { value: statusText },
// original values
readyState: { value: readyState, writable: false },
responseURL: { value: responseURL, writable: false },
responseXML: { value: responseXML, writable: false },
status: { value: status, writable: false },
statusText: { value: statusText, writable: false },
// modified values
response: { value: modifiedContent, writable: false },
responseText: { value: modifiedContent, writable: false },
});

// Mock events
Expand Down

0 comments on commit a0e0db1

Please sign in to comment.