diff -r 000000000000 -r 6474c204b198 dom/workers/test/navigator_worker.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dom/workers/test/navigator_worker.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,44 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ +var supportedProps = [ + "appCodeName", + "appName", + "appVersion", + "platform", + "product", + "taintEnabled", + "userAgent", + "onLine" +]; + +for (var prop in navigator) { + // Make sure the list is current! + if (supportedProps.indexOf(prop) == -1) { + throw "Navigator has the '" + prop + "' property that isn't in the list!"; + } +} + +var obj; + +for (var index = 0; index < supportedProps.length; index++) { + var prop = supportedProps[index]; + + if (typeof navigator[prop] == "undefined") { + throw "Navigator has no '" + prop + "' property!"; + } + + obj = { + name: prop, + value: prop === "taintEnabled" ? navigator[prop]() : navigator[prop] + }; + + postMessage(JSON.stringify(obj)); +} + +obj = { + name: "testFinished" +}; + +postMessage(JSON.stringify(obj));