1 <p>This page tests function calls whose argument expressions overwrite the callee.
</p>
2 <p>If the test passes, you'll see PASS messages below.
4 <pre id=
"console"></pre>
9 document
.getElementById("console").appendChild(document
.createTextNode(s
+ "\n"));
12 function shouldBe(aDescription
, a
, b
)
15 log("PASS: " + aDescription
+ " should be " + b
+ " and is.");
17 log("FAIL: " + aDescription
+ " should be " + b
+ " but instead is " + a
+ ".");
21 function test1(callback
, x
) {
23 return callback
.apply(this, [ callback
= x
]);
29 function test2(callback
, x
) {
31 return callback(callback
= x
);
38 if (window
.testRunner
)
39 testRunner
.dumpAsText();
41 var callback
= function callback(x
) {
45 shouldBe("test1(callback, 1)", test1(callback
, 1), 1);
46 shouldBe("test2(callback, 1)", test2(callback
, 1), 1);