Bug 1036790 - Only expect pjs methods for nightly builds in test_xrayToJS.xul. r=me
authorBobby Holley <bobbyholley@gmail.com>
Sun, 20 Jul 2014 16:15:22 -0600
changeset 217137 41818430febe26dd7b5c4d1132ac35b7d4b504ad
parent 217136 ce030325f21ceb80ac5c7e1db9d433517048d79a
child 217138 ca3a8b927b9463adf102c9448c033f0bc018a933
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1036790
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1036790 - Only expect pjs methods for nightly builds in test_xrayToJS.xul. r=me
js/xpconnect/tests/chrome/test_xrayToJS.xul
--- a/js/xpconnect/tests/chrome/test_xrayToJS.xul
+++ b/js/xpconnect/tests/chrome/test_xrayToJS.xul
@@ -144,17 +144,19 @@ https://bugzilla.mozilla.org/show_bug.cg
     SimpleTest.finish();
   }
 
   // Maintain a static list of the properties that are available on each standard
   // prototype, so that we make sure to audit any new ones to make sure they're
   // Xray-safe.
   //
   // DO NOT CHANGE WTIHOUT REVIEW FROM AN XPCONNECT PEER.
-  var isReleaseBuild = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).isReleaseBuild;
+  var version = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo).version;
+  var isNightlyBuild = version.endsWith("a1");
+  var isReleaseBuild = !version.contains("a");
   var gPrototypeProperties = {};
   gPrototypeProperties['Date'] =
     ["getTime", "getTimezoneOffset", "getYear", "getFullYear", "getUTCFullYear",
     "getMonth", "getUTCMonth", "getDate", "getUTCDate", "getDay", "getUTCDay",
     "getHours", "getUTCHours", "getMinutes", "getUTCMinutes", "getSeconds",
     "getUTCSeconds", "getMilliseconds", "getUTCMilliseconds", "setTime",
     "setYear", "setFullYear", "setUTCFullYear", "setMonth", "setUTCMonth",
     "setDate", "setUTCDate", "setHours", "setUTCHours", "setMinutes",
@@ -166,19 +168,22 @@ https://bugzilla.mozilla.org/show_bug.cg
   gPrototypeProperties['Object'] = /* __proto__ is intentionally excluded here, because
                                       the JS engine filters it out of getOwnPropertyNames */
     ["constructor", "toSource", "toString", "toLocaleString", "valueOf", "watch",
      "unwatch", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable",
      "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"];
   gPrototypeProperties['Array'] =
     ["length", "toSource", "toString", "toLocaleString", "join", "reverse", "sort", "push",
       "pop", "shift", "unshift", "splice", "concat", "slice", "lastIndexOf", "indexOf",
-      "forEach", "map", "reduce", "reduceRight", "filter", "some", "every", "mapPar",
-      "reducePar", "scanPar", "scatterPar", "filterPar", "find", "findIndex", "copyWithin",
-      "fill", "@@iterator", "entries", "keys", "constructor"];
+      "forEach", "map", "reduce", "reduceRight", "filter", "some", "every", "find",
+      "findIndex", "copyWithin", "fill", "@@iterator", "entries", "keys", "constructor"];
+  if (isNightlyBuild) {
+    let pjsMethods = ['mapPar', 'reducePar', 'scanPar', 'scatterPar', 'filterPar'];
+    gPrototypeProperties['Array'] = gPrototypeProperties['Array'].concat(pjsMethods);
+  }
   for (var c of typedArrayClasses) {
     gPrototypeProperties[c] = ["constructor", "BYTES_PER_ELEMENT", "length", "buffer",
                                "byteLength", "byteOffset", "@@iterator", "subarray", "set"];
     if (!isReleaseBuild)
       gPrototypeProperties[c].push("move");
   }
   for (var c of errorObjectClasses) {
       gPrototypeProperties[c] = ["constructor", "name",
@@ -203,18 +208,18 @@ https://bugzilla.mozilla.org/show_bug.cg
   }
 
   function testXray(classname, xray, xray2, propsToSkip) {
     propsToSkip = propsToSkip || [];
     let xrayProto = Object.getPrototypeOf(xray);
     let localProto = window[classname].prototype;
     is(Object.getOwnPropertyNames(localProto).sort().toSource(),
        gPrototypeProperties[classname].sort().toSource(),
-       "A new property on the " + classname +
-       " prototype has been added! You need a security audit from an XPConnect peer");
+       "A property on the " + classname +
+       " prototype has changed! You need a security audit from an XPConnect peer");
 
     let protoProps = filterOut(Object.getOwnPropertyNames(localProto), propsToSkip).sort();
     let protoCallables = protoProps.filter(name => Object.getOwnPropertyDescriptor(localProto, name).get ||
                                                    typeof localProto[name] == 'function' &&
                                                    name != 'constructor');
     let protoGetters = protoProps.filter(name => Object.getOwnPropertyDescriptor(localProto, name).get);
     ok(protoCallables.length > 0, "Need something to test");
     is(xrayProto, iwin[classname].prototype, "Xray proto is correct");