4 <script src=
"resources/WindowProperties.js"></script>
7 testRunner
.dumpAsText();
9 function log(message
, color
)
11 var paragraph
= document
.createElement("div");
12 paragraph
.appendChild(document
.createTextNode(message
));
13 paragraph
.style
.fontFamily
= "monospace";
15 paragraph
.style
.color
= color
;
16 document
.getElementById("console").appendChild(paragraph
);
19 function shouldBe(a
, b
, printOnlyOnFailure
)
28 if (!printOnlyOnFailure
)
29 log("PASS: " + a
+ " should be " + b
+ " and is.", "green");
31 log("FAIL: " + a
+ " should be " + b
+ " but instead is " + evalA
, "red");
34 function testFunction(functionName
)
36 var iframe
= document
.createElement('iframe');
37 iframe
.src
= "about:blank";
38 iframe
.name
= functionName
;
39 document
.body
.appendChild(iframe
);
41 shouldBe("typeof window." + functionName
, "function");
43 document
.body
.removeChild(iframe
);
48 for (var func
in windowFunctions
) {
49 testFunction(windowFunctions
[func
])
52 window
.myFunction = function() { return "myFunction"; }
53 testFunction("myFunction");
54 window
.__proto__
.myPrototypeFunction = function() { return "myPrototypeFunction"; }
55 testFunction("myPrototypeFunction");
59 <body onload=
"runTests();">
60 <p>This tests that functions of the window object and it's prototype have precedence in lookup over frames with name's of the same name.
</p>
61 <pre id=
"console"></pre>