11cb0ef41Sopenharmony_ci<!doctype html> 21cb0ef41Sopenharmony_ci<meta charset=utf-8> 31cb0ef41Sopenharmony_ci<script src=/resources/testharness.js></script> 41cb0ef41Sopenharmony_ci<script src=/resources/testharnessreport.js></script> 51cb0ef41Sopenharmony_ci<div id=log></div> 61cb0ef41Sopenharmony_ci<script> 71cb0ef41Sopenharmony_cipromise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…"); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_cifunction bURL(url, base) { 101cb0ef41Sopenharmony_ci return new URL(url, base || "about:blank") 111cb0ef41Sopenharmony_ci} 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_cifunction runURLTests(urltests) { 141cb0ef41Sopenharmony_ci for(var i = 0, l = urltests.length; i < l; i++) { 151cb0ef41Sopenharmony_ci var expected = urltests[i] 161cb0ef41Sopenharmony_ci if (typeof expected === "string" || !("origin" in expected)) continue 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci test(function() { 191cb0ef41Sopenharmony_ci var url = bURL(expected.input, expected.base) 201cb0ef41Sopenharmony_ci assert_equals(url.origin, expected.origin, "origin") 211cb0ef41Sopenharmony_ci }, "Origin parsing: <" + expected.input + "> against <" + expected.base + ">") 221cb0ef41Sopenharmony_ci } 231cb0ef41Sopenharmony_ci} 241cb0ef41Sopenharmony_ci</script> 25