1
0
Fork 0
firefox/dom/url/tests/protocol_worker.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

27 lines
562 B
JavaScript

/* 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();