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 804091 4f79c817377c0f75179ef189fa0aea28e332be0a
parent 804090 f99e6152df75ce0443a6d9a912264ae133eeb735
child 804092 ca0241cca7a5cd4fa0c50da7763a228f4dacef27
push id112312
push userbmo:standard8@mozilla.com
push dateTue, 05 Jun 2018 16:07:56 +0000
reviewersjmaher
bugs1413098
milestone62.0a1
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;
   },