Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / url / tests / url_exceptions_worker.js
blob8bbd641136c5c82278f6b1607a174dd1edbf3714
1 function ok(a, msg) {
2   postMessage({ type: "status", status: !!a, msg });
5 onmessage = function () {
6   // URL.href throws
7   var url = new URL("http://www.example.com");
8   ok(url, "URL created");
10   var status = false;
11   try {
12     url.href = "42";
13   } catch (e) {
14     status = true;
15   }
16   ok(status, "url.href = 42 should throw");
18   url.href = "http://www.example.org";
19   ok(true, "url.href should not throw");
21   status = false;
22   try {
23     new URL("42");
24   } catch (e) {
25     status = true;
26   }
27   ok(status, "new URL(42) should throw");
29   status = false;
30   try {
31     new URL("http://www.example.com", "42");
32   } catch (e) {
33     status = true;
34   }
35   ok(status, "new URL(something, 42) should throw");
37   postMessage({ type: "finish" });