Bug 1413098 - part3 : fix returning wrong result from SpecialPowers.getPrivilegedProps. r=jmaher
authorAlastor Wu <alwu@mozilla.com>
Wed, 13 Dec 2017 15:50:23 -0600
changeset 421278 4f79c817377c0f75179ef189fa0aea28e332be0a
parent 421277 f99e6152df75ce0443a6d9a912264ae133eeb735
child 421279 ca0241cca7a5cd4fa0c50da7763a228f4dacef27
push id34091
push userbtara@mozilla.com
push dateTue, 05 Jun 2018 13:52:34 +0000
treeherdermozilla-central@752465b44c79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1413098
milestone62.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 1413098 - part3 : fix returning wrong result from SpecialPowers.getPrivilegedProps. r=jmaher If result is zero, getPrivilegedProps() would incorrectly return null. MozReview-Commit-ID: 57JMaFwDpGW
testing/specialpowers/content/specialpowersAPI.js
--- a/testing/specialpowers/content/specialpowersAPI.js
+++ b/testing/specialpowers/content/specialpowersAPI.js
@@ -1712,17 +1712,17 @@ SpecialPowersAPI.prototype = {
     syncXHR.send();
   },
 
   // :jdm gets credit for this.  ex: getPrivilegedProps(window, 'location.href');
   getPrivilegedProps(obj, props) {
     var parts = props.split(".");
     for (var i = 0; i < parts.length; i++) {
       var p = parts[i];
-      if (obj[p]) {
+      if (obj[p] != undefined) {
         obj = obj[p];
       } else {
         return null;
       }
     }
     return obj;
   },