3 <script src=
"../../../resources/js-test.js"></script>
4 <script type=
"text/javascript" src=
"resources/window-properties.js"></script>
7 <p id=
"description"></p>
10 <iframe src=
"about:blank"></iframe>
14 <input id=
"MYINPUT" value=
"Hello World" type=
"text"/>
17 <div id=
"console"></div>
20 description('Tests lookup precedence for properties on Window objects in the presence of a child frame, and that IDL properties defined in the prototype (window.location, window.focus, etc) have higher lookup precedence than named document elements (such as input elements).');
22 var win
= window
.window
;
23 var myInput
= document
.getElementById("MYINPUT");
24 var subframe
= win
.frames
[0];
26 function checkValue(name
, original
) {
27 // Handle a correct Location, as well as any numerical values (screenX and
28 // so on), separately to avoid depending on the test file or window
30 if ((name
.toLowerCase() == "location" || typeof original
== "number")
31 && win
[name
] == original
)
32 testPassed("win['" + name
+ "'] matched original");
34 shouldEvaluateTo("win['" + name
+ "']", original
);
37 function check(prop
) {
39 var original
= win
[name
];
40 if (name
!= "location") { // Avoid navigating the subframe.
41 // Check subframe precedence.
43 subframe
[name
] = name
;
45 debug("Unable to set subframe[" + name
+ "]: " + e
);
48 checkValue(name
, original
);
50 // Check prototype precedence.
51 myInput
.setAttribute("id", name
);
52 checkValue(name
, original
);
55 var originalWindowOnError
= window
.onerror
;
56 window
.onerror
= null;
58 for (var i
= 0; i
< propertyInfo
.length
; ++i
) {
59 check(propertyInfo
[i
]);
62 window
.onerror
= originalWindowOnError
;