From ddb5977c48d1b4655d2cfad2d9fcc80884d1c6da Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Wed, 26 Feb 2025 11:27:02 -0500 Subject: [PATCH] Scaffold: Remove 2028/2029 fix Hasn't been an issue since ES2019. --- chrome/content/scaffold/scaffold.js | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/chrome/content/scaffold/scaffold.js b/chrome/content/scaffold/scaffold.js index e87e8b4554..678b12bce1 100644 --- a/chrome/content/scaffold/scaffold.js +++ b/chrome/content/scaffold/scaffold.js @@ -37,26 +37,6 @@ ChromeUtils.defineLazyGetter(lazy, 'shellPathPromise', () => { .then(s => s.trimEnd()); }); -// Fix JSON stringify 2028/2029 "bug" -// Borrowed from http://stackoverflow.com/questions/16686687/json-stringify-and-u2028-u2029-check -if (JSON.stringify(["\u2028\u2029"]) !== '["\\u2028\\u2029"]') { - JSON.stringify = function (stringify) { - return function () { - var str = stringify.apply(this, arguments); - if (str && str.indexOf('\u2028') != -1) str = str.replace(/\u2028/g, '\\u2028'); - if (str && str.indexOf('\u2029') != -1) str = str.replace(/\u2029/g, '\\u2029'); - return str; - }; - }(JSON.stringify); -} - -// To be used elsewhere (e.g. varDump) -function fix2028(str) { - if (str.indexOf('\u2028') != -1) str = str.replace(/\u2028/g, '\\u2028'); - if (str.indexOf('\u2029') != -1) str = str.replace(/\u2029/g, '\\u2029'); - return str; -} - var Scaffold = new function () { var _browser; var _translatorsLoadedPromise; @@ -1268,7 +1248,7 @@ var Scaffold = new function () { var output = document.getElementById('output'); if (typeof string != "string") { - string = fix2028(Zotero.Utilities.varDump(string)); + string = Zotero.Utilities.varDump(string); } // Put off actually building the log message and appending it to the console until the next animation frame