blob: f9d4b3d821dfe8e8a3c091ff8b4d51218c192eb7 [file] [log] [blame]
<!doctype html>
<meta charset=utf-8>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
function runURLOriginTests() {
var setup = async_test("Loading data…")
setup.step(function() {
var request = new XMLHttpRequest()
request.open("GET", "urltestdata.json")
request.send()
request.responseType = "json"
request.onload = setup.step_func(function() {
runURLTests(request.response)
setup.done()
})
})
}
function bURL(url, base) {
return new URL(url, base || "about:blank")
}
function runURLTests(urltests) {
for(var i = 0, l = urltests.length; i < l; i++) {
var expected = urltests[i]
if (typeof expected === "string" || !("origin" in expected)) continue
test(function() {
var url = bURL(expected.input, expected.base)
assert_equals(url.origin, expected.origin, "origin")
}, "Origin parsing: <" + expected.input + "> against <" + expected.base + ">")
}
}
runURLOriginTests()
</script>