blob: 2d21fa6f5ea6abddfbb90ad87a6dc74ec7aeeb7a (
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
28
29
30
|
function ok(a, msg) {
postMessage({ type: "status", status: !!a, msg });
}
function is(a, b, msg) {
ok(a === b, msg);
}
function finish() {
postMessage({ type: "finish" });
}
function runTests() {
ok("connection" in navigator, "navigator.connection should exist");
is(
navigator.connection.type,
"unknown",
"The connection type is spoofed correctly"
);
finish();
}
self.onmessage = function (e) {
if (e.data.type === "runTests") {
runTests();
} else {
ok(false, "Unknown message type");
}
};
|