• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!doctype html>
2<meta charset=utf-8>
3<script src=/resources/testharness.js></script>
4<script src=/resources/testharnessreport.js></script>
5<div id=log></div>
6<script>
7promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…");
8
9function bURL(url, base) {
10  return new URL(url, base || "about:blank")
11}
12
13function runURLTests(urltests) {
14  for(var i = 0, l = urltests.length; i < l; i++) {
15    var expected = urltests[i]
16    if (typeof expected === "string" || !("origin" in expected)) continue
17
18    test(function() {
19      var url = bURL(expected.input, expected.base)
20      assert_equals(url.origin, expected.origin, "origin")
21    }, "Origin parsing: <" + expected.input + "> against <" + expected.base + ">")
22  }
23}
24</script>
25