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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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