Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / toString-dontEnum.html
blobd376d538c8ca7ce14ab97c76b093e3770cd985c4
1 <html>
2 <head>
3 <script type="text/javascript" charset="utf-8">
4 function log(msg)
6 document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
9 function test(element, name)
11 var didPass = true;
12 for (prop in element) {
13 if (prop == "toString")
14 didPass = false;
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.");
22 function runTests()
24 if (window.testRunner)
25 testRunner.dumpAsText();
27 // DOM objects with custom toString() functions
28 test(document.createElement('a'), "HTMLAnchorElement");
29 test(window.location, "Location");
30 test(window.getSelection(), "Selection");
32 // Other DOM objects
33 test(document.createElement('div'), "HTMLDivElement");
34 test(document, "HTMLDocument");
36 // JS objects
37 test({}, "Object");
38 test([], "Array");
40 </script>
41 </head>
42 <body onload="runTests();">
43 <p>This tests that the toString() function does not enumerate.</p>
44 <pre id="console"></pre>
45 </body>
46 </html>