browser(firefox): fixed Array.prototype.toJSON workaround (#7018)
References #7015
This commit is contained in:
parent
3b1bae8a40
commit
9b9091b3fe
|
|
@ -1,2 +1,2 @@
|
||||||
1262
|
1263
|
||||||
Changed: max@schmitt.mx Tue Jun 8 21:07:04 UTC 2021
|
Changed: max@schmitt.mx Thu Jun 10 14:40:52 UTC 2021
|
||||||
|
|
|
||||||
|
|
@ -295,10 +295,12 @@ class ExecutionContext {
|
||||||
this._id = generateId();
|
this._id = generateId();
|
||||||
this._auxData = auxData;
|
this._auxData = auxData;
|
||||||
this._jsonStringifyObject = this._debuggee.executeInGlobal(`((stringify, object) => {
|
this._jsonStringifyObject = this._debuggee.executeInGlobal(`((stringify, object) => {
|
||||||
const oldToJson = Date.prototype.toJSON;
|
const oldToJSON = Date.prototype.toJSON;
|
||||||
Date.prototype.toJSON = undefined;
|
Date.prototype.toJSON = undefined;
|
||||||
const oldArrayToJson = Array.prototype.toJSON;
|
const oldArrayToJSON = Array.prototype.toJSON;
|
||||||
Array.prototype.toJSON = undefined;
|
const oldArrayHadToJSON = Array.prototype.hasOwnProperty('toJSON');
|
||||||
|
if (oldArrayHadToJSON)
|
||||||
|
Array.prototype.toJSON = undefined;
|
||||||
|
|
||||||
let hasSymbol = false;
|
let hasSymbol = false;
|
||||||
const result = stringify(object, (key, value) => {
|
const result = stringify(object, (key, value) => {
|
||||||
|
|
@ -307,8 +309,9 @@ class ExecutionContext {
|
||||||
return value;
|
return value;
|
||||||
});
|
});
|
||||||
|
|
||||||
Date.prototype.toJSON = oldToJson;
|
Date.prototype.toJSON = oldToJSON;
|
||||||
Array.prototype.toJSON = oldArrayToJson;
|
if (oldArrayHadToJSON)
|
||||||
|
Array.prototype.toJSON = oldArrayToJSON;
|
||||||
|
|
||||||
return hasSymbol ? undefined : result;
|
return hasSymbol ? undefined : result;
|
||||||
}).bind(null, JSON.stringify.bind(JSON))`).return;
|
}).bind(null, JSON.stringify.bind(JSON))`).return;
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
1270
|
1271
|
||||||
Changed: max@schmitt.mx Tue Jun 8 20:11:01 UTC 2021
|
Changed: max@schmitt.mx Thu Jun 10 14:39:06 UTC 2021
|
||||||
|
|
|
||||||
|
|
@ -295,10 +295,12 @@ class ExecutionContext {
|
||||||
this._id = generateId();
|
this._id = generateId();
|
||||||
this._auxData = auxData;
|
this._auxData = auxData;
|
||||||
this._jsonStringifyObject = this._debuggee.executeInGlobal(`((stringify, object) => {
|
this._jsonStringifyObject = this._debuggee.executeInGlobal(`((stringify, object) => {
|
||||||
const oldToJson = Date.prototype.toJSON;
|
const oldToJSON = Date.prototype.toJSON;
|
||||||
Date.prototype.toJSON = undefined;
|
Date.prototype.toJSON = undefined;
|
||||||
const oldArrayToJson = Array.prototype.toJSON;
|
const oldArrayToJSON = Array.prototype.toJSON;
|
||||||
Array.prototype.toJSON = undefined;
|
const oldArrayHadToJSON = Array.prototype.hasOwnProperty('toJSON');
|
||||||
|
if (oldArrayHadToJSON)
|
||||||
|
Array.prototype.toJSON = undefined;
|
||||||
|
|
||||||
let hasSymbol = false;
|
let hasSymbol = false;
|
||||||
const result = stringify(object, (key, value) => {
|
const result = stringify(object, (key, value) => {
|
||||||
|
|
@ -307,8 +309,9 @@ class ExecutionContext {
|
||||||
return value;
|
return value;
|
||||||
});
|
});
|
||||||
|
|
||||||
Date.prototype.toJSON = oldToJson;
|
Date.prototype.toJSON = oldToJSON;
|
||||||
Array.prototype.toJSON = oldArrayToJson;
|
if (oldArrayHadToJSON)
|
||||||
|
Array.prototype.toJSON = oldArrayToJSON;
|
||||||
|
|
||||||
return hasSymbol ? undefined : result;
|
return hasSymbol ? undefined : result;
|
||||||
}).bind(null, JSON.stringify.bind(JSON))`).return;
|
}).bind(null, JSON.stringify.bind(JSON))`).return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue