protocol_worker.js (562B)
1 /* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */ 2 3 function ok(a, msg) { 4 postMessage({ type: "status", status: !!a, msg }); 5 } 6 7 function is(a, b, msg) { 8 ok(a === b, msg); 9 } 10 11 function finish() { 12 postMessage({ type: "finish" }); 13 } 14 15 let url = new URL("http://example.com"); 16 is(url.protocol, "http:", "http: expected"); 17 18 url.protocol = "https:"; 19 is(url.protocol, "https:", "http: -> https:"); 20 21 url.protocol = "ftp:"; 22 is(url.protocol, "ftp:", "https: -> ftp:"); 23 24 url.protocol = "https:"; 25 is(url.protocol, "https:", "ftp: -> https:"); 26 27 finish();