mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
browser(firefox): do not use Array.prototype.toJSON for serialization (#6767)
This commit is contained in:
parent
d36bffb9a9
commit
f60b79a311
@ -1,2 +1,2 @@
|
||||
1267
|
||||
Changed: lushnikov@chromium.org Thu 20 May 2021 03:27:19 PM PDT
|
||||
1268
|
||||
Changed: yurys@chromium.org Wed 26 May 2021 03:35:57 PM PDT
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user