worker_network_basics.js (605B)
1 function ok(a, msg) { 2 postMessage({ type: "status", status: !!a, msg }); 3 } 4 5 function is(a, b, msg) { 6 ok(a === b, msg); 7 } 8 9 function finish() { 10 postMessage({ type: "finish" }); 11 } 12 13 ok("connection" in navigator, "navigator.connection should exist"); 14 15 ok(navigator.connection, "navigator.connection returns an object"); 16 17 ok( 18 navigator.connection instanceof EventTarget, 19 "navigator.connection is a EventTarget object" 20 ); 21 22 ok("type" in navigator.connection, "type should be a Connection attribute"); 23 is( 24 navigator.connection.type, 25 "none", 26 "By default connection.type equals to none" 27 ); 28 finish();