Location.toString() should be enumerable
[WebKit-https.git] / LayoutTests / fast / dom / toString_attributes.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../resources/js-test-pre.js"></script>
5 <script>
6 description("Test that the toString() stringifier has the right attributes");
7
8 function testStringifier(object, isUnforgeable)
9 {
10     unforgeable = isUnforgeable;
11     descriptor = Object.getOwnPropertyDescriptor(unforgeable ? object : object.__proto__, "toString");
12     shouldBeType("descriptor.value", "Function");
13     shouldBe("descriptor.writable", "!unforgeable");
14     shouldBeTrue("descriptor.enumerable");
15     shouldBe("descriptor.configurable", "!unforgeable");
16 }
17
18 debug("* HTMLAnchorElement");
19 var anchor = document.createElement("a");
20 testStringifier(anchor, false);
21
22 debug("");
23 debug("* HTMLAreaElement");
24 var area = document.createElement("area");
25 testStringifier(area, false);
26
27 debug("");
28 debug("* Location");
29 testStringifier(window.location, true);
30 </script>
31 <script src="../../resources/js-test-post.js"></script>
32 </body>
33 </html>