Bug 1413098 - part3 : fix returning wrong result from SpecialPowers.getPrivilegedProps. r=jmaher
☠☠ backed out by 4024c45ceac8 ☠ ☠
authorAlastor Wu <alwu@mozilla.com>
Wed, 13 Dec 2017 15:50:23 -0600
changeset 420692 49ef875bd65ef3776cde50c223c4d2f6d1699a09
parent 420691 747764af7143667f473fb1853aa50ba943b4b12d
child 420693 b12730d42016a38c7869dfc50a4646198c9002df
push id34077
push usernerli@mozilla.com
push dateThu, 31 May 2018 21:51:59 +0000
treeherdermozilla-central@42880a726964 [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;
   },