|
1 // |reftest| skip-if(!xulRuntime.shell) -- needs evaluate() |
|
2 /* |
|
3 * Any copyright is dedicated to the Public Domain. |
|
4 * http://creativecommons.org/licenses/publicdomain/ |
|
5 */ |
|
6 |
|
7 //----------------------------------------------------------------------------- |
|
8 var BUGNUMBER = 577325; |
|
9 var summary = 'Implement the ES5 algorithm for processing function statements'; |
|
10 |
|
11 print(BUGNUMBER + ": " + summary); |
|
12 |
|
13 /************** |
|
14 * BEGIN TEST * |
|
15 **************/ |
|
16 |
|
17 var called, obj; |
|
18 |
|
19 function inFile1() { return "in file"; } |
|
20 called = false; |
|
21 obj = { set inFile1(v) { called = true; } }; |
|
22 with (obj) |
|
23 function inFile1() { return "in file in with"; }; |
|
24 assertEq(inFile1(), "in file in with"); |
|
25 assertEq("set" in Object.getOwnPropertyDescriptor(obj, "inFile1"), true); |
|
26 assertEq(called, false); |
|
27 |
|
28 evaluate("function notInFile1() { return 'not in file'; }"); |
|
29 called = false; |
|
30 obj = { set notInFile1(v) { called = true; return "not in file 2"; } }; |
|
31 with (obj) |
|
32 function notInFile1() { return "not in file in with"; }; |
|
33 assertEq(notInFile1(), "not in file in with"); |
|
34 assertEq("set" in Object.getOwnPropertyDescriptor(obj, "notInFile1"), true); |
|
35 assertEq(called, false); |
|
36 |
|
37 function inFile2() { return "in file 1"; } |
|
38 called = false; |
|
39 obj = |
|
40 Object.defineProperty({}, "inFile2", |
|
41 { value: 42, configurable: false, enumerable: false }); |
|
42 with (obj) |
|
43 function inFile2() { return "in file 2"; }; |
|
44 assertEq(inFile2(), "in file 2"); |
|
45 assertEq(obj.inFile2, 42); |
|
46 |
|
47 |
|
48 /******************************************************************************/ |
|
49 |
|
50 if (typeof reportCompare === "function") |
|
51 reportCompare(true, true); |
|
52 |
|
53 print("All tests passed!"); |