From ff1d4fa60223b334e7477ce626474c7211ca591f Mon Sep 17 00:00:00 2001 From: Frank Bennett Date: Sat, 30 May 2015 09:03:24 +0900 Subject: [PATCH] Simplification of stableStringify() --- test/content/support.js | 43 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/test/content/support.js b/test/content/support.js index 2f67b97f64..8fc576f0c2 100644 --- a/test/content/support.js +++ b/test/content/support.js @@ -202,39 +202,18 @@ function resetDB() { * Equivalent to JSON.stringify, except that object properties are stringified * in a sorted order. */ -function stableStringify(obj, level, label) { - if (!level) level = 0; - let indent = '\t'.repeat(level); - - if (label) label = JSON.stringify('' + label) + ': '; - else label = ''; - - if (typeof obj == 'function' || obj === undefined) return null; - - if (typeof obj != 'object' || obj === null) return indent + label + JSON.stringify(obj); - - if (Array.isArray(obj)) { - let str = indent + label + '['; - for (let i=0; i