https://github.com/web-platform-tests/wpt
Raw File
Tip revision: c2b8c888626597462c9e9261aa1bedd4c4edb850 authored by Frédéric Wang on 27 June 2018, 07:37:03 UTC
Convert to manual test, add a version where the click happens from a subframe
Tip revision: c2b8c88
url-origin.html
<!doctype html>
<meta charset=utf-8>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…");

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 + ">")
  }
}
</script>
back to top