Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / dom / location-stringify.html
blob9ef1ce71cadc5078b34b3ed3e9d5fa356cbd5407
1 <html>
2 <head>
3 <script>
4 function log(str)
6 var li = document.createElement("li");
7 li.appendChild(document.createTextNode(str));
8 var console = document.getElementById("console");
9 console.appendChild(li);
12 function assertEqual(message, actual, expected)
14 if (actual != expected)
15 log("\n" + message + ": Failure, actual: " + actual + "; expected: " + expected);
16 else
17 log("\n" + message + ": Success");
20 function runTests() {
21 if (window.testRunner) {
22 testRunner.dumpAsText();
24 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":{}}');
26 </script>
27 </head>
28 <body onload="runTests();">
29 <p>
30 Tests that Location interface is [Unforgeable], thus JSON.stringify() works well for Location objects.
31 </p>
32 <ul id="console" dir=ltr></ul>
33 </body>
34 </html>