blob: f707e93ea8fcda626ed70d3478b087ed395283e4 [file] [log] [blame]
<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),
'{"ancestorOrigins":{},"href":"http://127.0.0.1:8000/dom/location-stringify.html","origin":"http://127.0.0.1:8000","protocol":"http:","host":"127.0.0.1:8000","hostname":"127.0.0.1","port":"8000","pathname":"/dom/location-stringify.html","search":"","hash":""}');
}
</script>
</head>
<body onload="runTests();">
<p>
Tests that Location interface is [LegacyUnforgeable], thus JSON.stringify() works well for Location objects.
</p>
<ul id="console" dir=ltr></ul>
</body>
</html>