js/src/tests/ecma_5/extensions/string-literal-getter-setter-decompilation.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

     1 // Any copyright is dedicated to the Public Domain.
     2 // http://creativecommons.org/licenses/publicdomain/
     4 var f;
     5 try
     6 {
     7   f = eval("(function literalInside() { return { set 'c d e'(v) { } }; })");
     8 }
     9 catch (e)
    10 {
    11   assertEq(true, false,
    12            "string-literal property name in setter in object literal in " +
    13            "function statement failed to parse: " + e);
    14 }
    16 var fstr = "" + f;
    17 assertEq(fstr.indexOf("set") < fstr.indexOf("c d e"), true,
    18          "should be using new-style syntax with string literal in place of " +
    19          "property identifier");
    20 assertEq(fstr.indexOf("setter") < 0, true, "using old-style syntax?");
    22 var o = f();
    23 var ostr = "" + o;
    24 assertEq("c d e" in o, true, "missing the property?");
    25 assertEq("set" in Object.getOwnPropertyDescriptor(o, "c d e"), true,
    26          "'c d e' property not a setter?");
    27 // disabled because we still generate old-style syntax here (toSource
    28 // decompilation is as yet unfixed)
    29 // assertEq(ostr.indexOf("set") < ostr.indexOf("c d e"), true,
    30 //         "should be using new-style syntax when getting the source of a " +
    31 //         "getter/setter while decompiling an object");
    32 // assertEq(ostr.indexOf("setter") < 0, true, "using old-style syntax?");
    34 reportCompare(true, true);

mercurial