Bug 766687 - specialpowers pushprefenv fails while trying to get the originalvalue if the pref doesn't exist. r=jmaher
authorMartijn Wargers <mwargers@mozilla.com>
Thu, 29 Aug 2013 22:18:53 +0200
changeset 145010 0f939ca1606802376cd4193e8a96900e11f4fcc8
parent 145009 9d925d047ba50e5312ccab8b48b6b5237bb4e35b
child 145011 6ec9bb4eedf8353cfd70265e3d63e1e266e99d59
push id33120
push userryanvm@gmail.com
push dateThu, 29 Aug 2013 20:47:56 +0000
treeherdermozilla-inbound@0f939ca16068 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs766687
milestone26.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 766687 - specialpowers pushprefenv fails while trying to get the originalvalue if the pref doesn't exist. r=jmaher
testing/specialpowers/content/SpecialPowersObserverAPI.js
--- a/testing/specialpowers/content/SpecialPowersObserverAPI.js
+++ b/testing/specialpowers/content/SpecialPowersObserverAPI.js
@@ -161,16 +161,20 @@ SpecialPowersObserverAPI.prototype = {
         var prefs = Services.prefs;
         var prefType = aMessage.json.prefType.toUpperCase();
         var prefName = aMessage.json.prefName;
         var prefValue = "prefValue" in aMessage.json ? aMessage.json.prefValue : null;
 
         if (aMessage.json.op == "get") {
           if (!prefName || !prefType)
             throw new SpecialPowersException("Invalid parameters for get in SPPrefService");
+
+          // return null if the pref doesn't exist
+          if (prefs.getPrefType(prefName) == prefs.PREF_INVALID)
+            return;
         } else if (aMessage.json.op == "set") {
           if (!prefName || !prefType  || prefValue === null)
             throw new SpecialPowersException("Invalid parameters for set in SPPrefService");
         } else if (aMessage.json.op == "clear") {
           if (!prefName)
             throw new SpecialPowersException("Invalid parameters for clear in SPPrefService");
         } else {
           throw new SpecialPowersException("Invalid operation for SPPrefService");