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.
1 /*
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/licenses/publicdomain/
4 */
6 var gTestfile = 'destructuring-__proto__-target--assignment.js';
7 var BUGNUMBER = 963641;
8 var summary =
9 "{ __proto__: target } should work as a destructuring assignment pattern";
11 print(BUGNUMBER + ": " + summary);
13 /**************
14 * BEGIN TEST *
15 **************/
17 function objectWithProtoProperty(v)
18 {
19 var obj = {};
20 return Object.defineProperty(obj, "__proto__",
21 {
22 enumerable: true,
23 configurable: true,
24 writable: true,
25 value: v
26 });
27 }
29 var { __proto__: target } = objectWithProtoProperty(null);
30 assertEq(target, null);
32 ({ __proto__: target } = objectWithProtoProperty("aacchhorrt"));
33 assertEq(target, "aacchhorrt");
35 function nested()
36 {
37 var { __proto__: target } = objectWithProtoProperty(3.141592654);
38 assertEq(target, 3.141592654);
40 ({ __proto__: target } = objectWithProtoProperty(-0));
41 assertEq(target, -0);
42 }
43 nested();
45 /******************************************************************************/
47 if (typeof reportCompare === "function")
48 reportCompare(true, true);
50 print("Tests complete");