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