summaryrefslogtreecommitdiffstats
path: root/dom/url/tests/protocol_worker.js
blob: 81e761ee0ef389b64d7f7a58ce94a443a938ea7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */

function ok(a, msg) {
  postMessage({ type: "status", status: !!a, msg });
}

function is(a, b, msg) {
  ok(a === b, msg);
}

function finish() {
  postMessage({ type: "finish" });
}

let url = new URL("http://example.com");
is(url.protocol, "http:", "http: expected");

url.protocol = "https:";
is(url.protocol, "https:", "http: -> https:");

url.protocol = "ftp:";
is(url.protocol, "ftp:", "https: -> ftp:");

url.protocol = "https:";
is(url.protocol, "https:", "ftp: -> https:");

finish();