Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

browser(firefox-stable): merge do not use Array.prototype.toJSON for serialization (#6783)

Yury Semikhatsky2f36feefc8bd
diff --git a/browser_patches/firefox-stable/BUILD_NUMBER b/browser_patches/firefox-stable/BUILD_NUMBER
index 20c6dfedf0..2e75ba1f40 100644
--- a/browser_patches/firefox-stable/BUILD_NUMBER
+++ b/browser_patches/firefox-stable/BUILD_NUMBER
@@ -1,2 +1,2 @@
-1256
-Changed: [email protected] Thu May 20 19:04:31 UTC 2021
+1257
+Changed: [email protected] Thu 27 May 2021 04:34:23 PM PDT
diff --git a/browser_patches/firefox-stable/juggler/content/Runtime.js b/browser_patches/firefox-stable/juggler/content/Runtime.js
index 373fd5d497..5a37469510 100644
--- a/browser_patches/firefox-stable/juggler/content/Runtime.js
+++ b/browser_patches/firefox-stable/juggler/content/Runtime.js
@@ -294,18 +294,24 @@ class ExecutionContext {
this._remoteObjects = new Map();
this._id = generateId();
this._auxData = auxData;
- this._jsonStringifyObject = this._debuggee.executeInGlobal(`((stringify, dateProto, object) => {
- const oldToJson = dateProto.toJSON;
- dateProto.toJSON = undefined;
+ this._jsonStringifyObject = this._debuggee.executeInGlobal(`((stringify, object) => {
+ const oldToJson = Date.prototype.toJSON;
+ Date.prototype.toJSON = undefined;
+ const oldArrayToJson = Array.prototype.toJSON;
+ Array.prototype.toJSON = undefined;
+
let hasSymbol = false;
const result = stringify(object, (key, value) => {
if (typeof value === 'symbol')
hasSymbol = true;
return value;
});
- dateProto.toJSON = oldToJson;
+
+ Date.prototype.toJSON = oldToJson;
+ Array.prototype.toJSON = oldArrayToJson;
+
return hasSymbol ? undefined : result;
- }).bind(null, JSON.stringify.bind(JSON), Date.prototype)`).return;
+ }).bind(null, JSON.stringify.bind(JSON))`).return;
}
id() {