Location.toString() should be enumerable
[WebKit-https.git] / LayoutTests / js / dom / toString-dontEnum.html
1 <html>
2 <head>
3     <script type="text/javascript" charset="utf-8">
4         function log(msg)
5         {
6             document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
7         }
8
9         function test(element, name)
10         {
11             var didPass = true;
12             for (prop in element) {
13                 if (prop == "toString")
14                     didPass = false;
15             }
16             if (didPass)
17                 log("PASS: the toString function is not enumerable for " + name + ".");
18             else
19                 log("FAIL: the toString function is enumerable for " + name + " and should not be.");
20         }
21
22         function runTests()
23         {
24             if (window.testRunner)
25                 testRunner.dumpAsText();
26
27             // DOM objects with custom toString() functions
28             test(window.getSelection(), "Selection");
29
30             // Other DOM objects
31             test(document.createElement('div'), "HTMLDivElement");
32             test(document, "HTMLDocument");
33
34             // JS objects
35             test({}, "Object");
36             test([], "Array");
37         }
38     </script>
39 </head>
40 <body onload="runTests();">
41     <p>This tests that the toString() function does not enumerate.</p>
42     <pre id="console"></pre>
43 </body>
44 </html>