tizen beta release
[profile/ivi/webkit-efl.git] / LayoutTests / fast / dom / getter-on-window-object2.html
1 <script src="../js/resources/js-test-pre.js"></script>
2
3 <script>
4 description("This page tests what happens when a getter / setter on the window object conflicts with another property or declared variable");
5
6 var x = 1;
7 try {
8     window.__defineGetter__("x", function() { return "window.x __getter__"; });
9 } catch(e) { debug(e); }
10
11 shouldBe("window.x", "1");
12 shouldBe("typeof window.__lookupGetter__('x')", "'undefined'");
13 shouldBe("typeof Object.getOwnPropertyDescriptor(window, 'x').get", "'undefined'");
14 debug("");
15
16
17 try {
18 window.__defineSetter__("x", function() { debug("window.x __setter__ called"); });
19 } catch(e) { debug(e); }
20 x = 2;
21
22 shouldBe("window.x", "2");
23 shouldBe("typeof window.__lookupGetter__('x')", "'undefined'");
24 shouldBe("typeof Object.getOwnPropertyDescriptor(window, 'x').get", "'undefined'");
25 debug("");
26
27
28 window.y = 1;
29 try {
30     window.__defineGetter__("y", function() { return "window.y __getter__"; });
31 } catch(e) { debug(e); }
32
33 shouldBe("window.y", "'window.y __getter__'");
34 shouldBe("typeof window.__lookupGetter__('y')", "'function'");
35 shouldBe("typeof Object.getOwnPropertyDescriptor(window, 'y').get", "'function'");
36 debug("");
37
38
39 try {
40 window.__defineSetter__("y", function() { "window.y __setter__ called"; });
41 } catch(e) { debug(e); }
42 window.y = 2;
43
44 shouldBe("window.y", "'window.y __getter__'");
45 shouldBe("typeof window.__lookupGetter__('y')", "'function'");
46 shouldBe("typeof Object.getOwnPropertyDescriptor(window, 'y').get", "'function'");
47 debug("");
48
49
50 try {
51 window.__defineSetter__("z", function() { "window.z __setter__ called"; });
52 } catch(e) { debug(e); }
53 window.z = 1;
54
55 shouldBeUndefined("window.z");
56 shouldBe("typeof window.__lookupSetter__('z')", "'function'");
57 shouldBe("typeof Object.getOwnPropertyDescriptor(window, 'z').set", "'function'");
58
59 </script>