|
1 /** |
|
2 * Any copyright is dedicated to the Public Domain. |
|
3 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
4 */ |
|
5 var supportedProps = [ |
|
6 "appCodeName", |
|
7 "appName", |
|
8 "appVersion", |
|
9 "platform", |
|
10 "product", |
|
11 "taintEnabled", |
|
12 "userAgent", |
|
13 "onLine" |
|
14 ]; |
|
15 |
|
16 for (var prop in navigator) { |
|
17 // Make sure the list is current! |
|
18 if (supportedProps.indexOf(prop) == -1) { |
|
19 throw "Navigator has the '" + prop + "' property that isn't in the list!"; |
|
20 } |
|
21 } |
|
22 |
|
23 var obj; |
|
24 |
|
25 for (var index = 0; index < supportedProps.length; index++) { |
|
26 var prop = supportedProps[index]; |
|
27 |
|
28 if (typeof navigator[prop] == "undefined") { |
|
29 throw "Navigator has no '" + prop + "' property!"; |
|
30 } |
|
31 |
|
32 obj = { |
|
33 name: prop, |
|
34 value: prop === "taintEnabled" ? navigator[prop]() : navigator[prop] |
|
35 }; |
|
36 |
|
37 postMessage(JSON.stringify(obj)); |
|
38 } |
|
39 |
|
40 obj = { |
|
41 name: "testFinished" |
|
42 }; |
|
43 |
|
44 postMessage(JSON.stringify(obj)); |