| <html> |
| <head> |
| <script> |
| function log(str) |
| { |
| var li = document.createElement("li"); |
| li.appendChild(document.createTextNode(str)); |
| var console = document.getElementById("console"); |
| console.appendChild(li); |
| } |
| |
| function assertEqual(message, actual, expected) |
| { |
| if (actual != expected) |
| log("\n" + message + ": Failure, actual: " + actual + "; expected: " + expected); |
| else |
| log("\n" + message + ": Success"); |
| } |
| |
| function runTests() { |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| } |
| assertEqual("stringify", JSON.stringify(window.location), '{"hash":"","search":"","pathname":"/dom/location-stringify.html","port":"8000","hostname":"127.0.0.1","host":"127.0.0.1:8000","protocol":"http:","origin":"http://127.0.0.1:8000","href":"http://127.0.0.1:8000/dom/location-stringify.html","ancestorOrigins":{}}'); |
| } |
| </script> |
| </head> |
| <body onload="runTests();"> |
| <p> |
| Tests that Location interface is [Unforgeable], thus JSON.stringify() works well for Location objects. |
| </p> |
| <ul id="console" dir=ltr></ul> |
| </body> |
| </html> |