diff options
author | Moonchild <moonchild@palemoon.org> | 2021-02-05 12:44:26 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-02-05 12:44:26 +0000 |
commit | 66d028942c3246f17f3f86ce40c230041556d27d (patch) | |
tree | fd948b4a70ddb224b0e95d6a11f0398e8601715e /js/src/tests | |
parent | bd9fdeccc7f731450188dce4d7ec21643306988c (diff) | |
download | UXP-66d028942c3246f17f3f86ce40c230041556d27d.tar UXP-66d028942c3246f17f3f86ce40c230041556d27d.tar.gz UXP-66d028942c3246f17f3f86ce40c230041556d27d.tar.lz UXP-66d028942c3246f17f3f86ce40c230041556d27d.tar.xz UXP-66d028942c3246f17f3f86ce40c230041556d27d.zip |
Issue #1732 - Implement JSON superset proposal.
This change makes unicode line and paragraph separators allowed in JS strings,
removing the only quirk of the JS string definition that made JSON not a valid
subset of JS.
Resolves #1732
Diffstat (limited to 'js/src/tests')
-rw-r--r-- | js/src/tests/ecma_5/eval/line-terminator-paragraph-terminator.js | 59 |
1 files changed, 5 insertions, 54 deletions
diff --git a/js/src/tests/ecma_5/eval/line-terminator-paragraph-terminator.js b/js/src/tests/ecma_5/eval/line-terminator-paragraph-terminator.js index 61047fb10..9a904073a 100644 --- a/js/src/tests/ecma_5/eval/line-terminator-paragraph-terminator.js +++ b/js/src/tests/ecma_5/eval/line-terminator-paragraph-terminator.js @@ -3,7 +3,9 @@ //----------------------------------------------------------------------------- var BUGNUMBER = 657367; -var summary = "eval must not parse strings containing U+2028 or U+2029"; +var summary = + "eval via the JSON parser should parse strings containing U+2028/U+2029 " + + "(as of <https://tc39.github.io/proposal-json-superset/>, that is)"; print(BUGNUMBER + ": " + summary); @@ -11,59 +13,8 @@ print(BUGNUMBER + ": " + summary); * BEGIN TEST * **************/ -function esc(s) -{ - return s.split("").map(function(v) - { - var code = - ("000" + v.charCodeAt(0).toString(16)).slice(-4); - return "\\u" + code; - }).join(""); -} - -try -{ - var r = eval('"\u2028"'); - throw new Error("\"\\u2028\" didn't throw, returned " + esc(r)); -} -catch (e) -{ - assertEq(e instanceof SyntaxError, true, - "U+2028 is not a valid string character"); -} - -try -{ - var r = eval('("\u2028")'); - throw new Error("(\"\\u2028\") didn't throw, returned " + esc(r)); -} -catch (e) -{ - assertEq(e instanceof SyntaxError, true, - "U+2028 is not a valid string character"); -} - -try -{ - var r = eval('"\u2029"'); - throw new Error("\"\\u2029\" didn't throw, returned " + esc(r)); -} -catch (e) -{ - assertEq(e instanceof SyntaxError, true, - "U+2029 is not a valid string character"); -} - -try -{ - var r = eval('("\u2029")'); - throw new Error("(\"\\u2029\") didn't throw, returned " + esc(r)); -} -catch (e) -{ - assertEq(e instanceof SyntaxError, true, - "U+2029 is not a valid string character"); -} +assertEq(eval('("\u2028")'), "\u2028"); +assertEq(eval('("\u2029")'), "\u2029"); /******************************************************************************/ |