| 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 |
} |
| 25 |
assertEq(inFile1(), "in file in with"); |
| 26 |
assertEq("set" in Object.getOwnPropertyDescriptor(obj, "inFile1"), true); |
| 27 |
assertEq(called, false); |
| 28 |
|
| 29 |
evaluate("function notInFile1() { return 'not in file'; }"); |
| 30 |
called = false; |
| 31 |
obj = { set notInFile1(v) { called = true; return "not in file 2"; } }; |
| 32 |
with (obj) { |
| 33 |
function notInFile1() { return "not in file in with"; }; |
| 34 |
} |
| 35 |
assertEq(notInFile1(), "not in file in with"); |
| 36 |
assertEq("set" in Object.getOwnPropertyDescriptor(obj, "notInFile1"), true); |
| 37 |
assertEq(called, false); |
| 38 |
|
| 39 |
function inFile2() { return "in file 1"; } |
| 40 |
called = false; |
| 41 |
obj = |
| 42 |
Object.defineProperty({}, "inFile2", |
| 43 |
{ value: 42, configurable: false, enumerable: false }); |
| 44 |
with (obj) { |
| 45 |
function inFile2() { return "in file 2"; }; |
| 46 |
} |
| 47 |
assertEq(inFile2(), "in file 2"); |
| 48 |
assertEq(obj.inFile2, 42); |
| 49 |
|
| 50 |
|
| 51 |
/******************************************************************************/ |
| 52 |
|
| 53 |
if (typeof reportCompare === "function") |
| 54 |
reportCompare(true, true); |
| 55 |
|
| 56 |
print("All tests passed!"); |