Bug 1441927 part 2. Move the is* constants to the top of test_interfaces.js so we can use them in our property lists. r=bkelly

MozReview-Commit-ID: FXqx6tn4W32
This commit is contained in:
Boris Zbarsky 2018-03-01 12:32:33 -05:00
Родитель 2ec9ec7f7c
Коммит 503cf68b4b
2 изменённых файлов: 21 добавлений и 10 удалений

Просмотреть файл

@ -20,6 +20,21 @@
// ];
//
// See createInterfaceMap() below for a complete list of properties.
//
// The values of the properties need to be either literal true/false
// (e.g. indicating whether something is enabled on a particular
// channel/OS) or one of the is* constants below (in cases when
// exposure is affected by channel or OS in a nontrivial way).
const version = SpecialPowers.Cc["@mozilla.org/xre/app-info;1"].getService(SpecialPowers.Ci.nsIXULAppInfo).version;
const isNightly = version.endsWith("a1");
const isRelease = !version.includes("a");
const isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
const isMac = /Mac OS/.test(navigator.oscpu);
const isWindows = /Windows/.test(navigator.oscpu);
const isAndroid = navigator.userAgent.includes("Android");
const isLinux = /Linux/.test(navigator.oscpu) && !isAndroid;
const isInsecureContext = !window.isSecureContext;
// IMPORTANT: Do not change this list without review from
// a JavaScript Engine peer!
@ -1267,16 +1282,6 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change the list above without review from a DOM peer!
function createInterfaceMap(isXBLScope) {
var version = SpecialPowers.Cc["@mozilla.org/xre/app-info;1"].getService(SpecialPowers.Ci.nsIXULAppInfo).version;
var isNightly = version.endsWith("a1");
var isRelease = !version.includes("a");
var isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
var isMac = /Mac OS/.test(navigator.oscpu);
var isWindows = /Windows/.test(navigator.oscpu);
var isAndroid = navigator.userAgent.includes("Android");
var isLinux = /Linux/.test(navigator.oscpu) && !isAndroid;
var isInsecureContext = !window.isSecureContext;
var interfaceMap = {};
function addInterfaces(interfaces)

Просмотреть файл

@ -18,6 +18,12 @@
// ];
//
// See createInterfaceMap() below for a complete list of properties.
//
// The values of the properties need to be literal true/false
// (e.g. indicating whether something is enabled on a particular
// channel/OS). If we ever end up in a situation where a propert
// value needs to depend on channel or OS, we will need to make sure
// we have that information before setting up the property lists.
// IMPORTANT: Do not change this list without review from
// a JavaScript Engine peer!