Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
browser(firefox): fixed Array.prototype.toJSON workaround (#7018)
Max Schmitt9b9091b3fed4
diff --git a/browser_patches/firefox-beta/BUILD_NUMBER b/browser_patches/firefox-beta/BUILD_NUMBERindex 1044a570b1..d66d2bcf90 100644--- a/browser_patches/firefox-beta/BUILD_NUMBER+++ b/browser_patches/firefox-beta/BUILD_NUMBER@@ -1,2 +1,2 @@-1262-Changed: [email protected] Tue Jun 8 21:07:04 UTC 2021+1263+Changed: [email protected] Thu Jun 10 14:40:52 UTC 2021diff --git a/browser_patches/firefox-beta/juggler/content/Runtime.js b/browser_patches/firefox-beta/juggler/content/Runtime.jsindex 5a37469510..ab5ddb6918 100644--- a/browser_patches/firefox-beta/juggler/content/Runtime.js+++ b/browser_patches/firefox-beta/juggler/content/Runtime.js@@ -295,10 +295,12 @@ class ExecutionContext {this._id = generateId();this._auxData = auxData;this._jsonStringifyObject = this._debuggee.executeInGlobal(`((stringify, object) => {- const oldToJson = Date.prototype.toJSON;+ const oldToJSON = Date.prototype.toJSON;Date.prototype.toJSON = undefined;- const oldArrayToJson = Array.prototype.toJSON;- Array.prototype.toJSON = undefined;+ const oldArrayToJSON = Array.prototype.toJSON;+ const oldArrayHadToJSON = Array.prototype.hasOwnProperty('toJSON');+ if (oldArrayHadToJSON)+ Array.prototype.toJSON = undefined;let hasSymbol = false;const result = stringify(object, (key, value) => {@@ -307,8 +309,9 @@ class ExecutionContext {return value;});- Date.prototype.toJSON = oldToJson;- Array.prototype.toJSON = oldArrayToJson;+ Date.prototype.toJSON = oldToJSON;+ if (oldArrayHadToJSON)+ Array.prototype.toJSON = oldArrayToJSON;return hasSymbol ? undefined : result;}).bind(null, JSON.stringify.bind(JSON))`).return;diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBERindex cadea36ceb..56893356b3 100644--- a/browser_patches/firefox/BUILD_NUMBER+++ b/browser_patches/firefox/BUILD_NUMBER@@ -1,2 +1,2 @@-1270-Changed: [email protected] Tue Jun 8 20:11:01 UTC 2021+1271+Changed: [email protected] Thu Jun 10 14:39:06 UTC 2021diff --git a/browser_patches/firefox/juggler/content/Runtime.js b/browser_patches/firefox/juggler/content/Runtime.jsindex 5a37469510..ab5ddb6918 100644--- a/browser_patches/firefox/juggler/content/Runtime.js+++ b/browser_patches/firefox/juggler/content/Runtime.js@@ -295,10 +295,12 @@ class ExecutionContext {this._id = generateId();this._auxData = auxData;this._jsonStringifyObject = this._debuggee.executeInGlobal(`((stringify, object) => {- const oldToJson = Date.prototype.toJSON;+ const oldToJSON = Date.prototype.toJSON;Date.prototype.toJSON = undefined;- const oldArrayToJson = Array.prototype.toJSON;- Array.prototype.toJSON = undefined;+ const oldArrayToJSON = Array.prototype.toJSON;+ const oldArrayHadToJSON = Array.prototype.hasOwnProperty('toJSON');+ if (oldArrayHadToJSON)+ Array.prototype.toJSON = undefined;let hasSymbol = false;const result = stringify(object, (key, value) => {@@ -307,8 +309,9 @@ class ExecutionContext {return value;});- Date.prototype.toJSON = oldToJson;- Array.prototype.toJSON = oldArrayToJson;+ Date.prototype.toJSON = oldToJSON;+ if (oldArrayHadToJSON)+ Array.prototype.toJSON = oldArrayToJSON;return hasSymbol ? undefined : result;}).bind(null, JSON.stringify.bind(JSON))`).return;