Bug 1345294 - script generated patch (+ some hand cleanup) to replace {get,set}ComplexValue for nsISupportsString by {get,set}StringPref, r=Mossop.
authorFlorian Quèze <florian@queze.net>
Thu, 16 Mar 2017 19:26:01 +0100
changeset 348173 5a8192a650e92565aa2e85721569dad58cc1922c
parent 348172 6e8fab91c7b5330502facd1317d1ddcb824c96b6
child 348174 79bacf0ea46664a09a1f09996e70d0d3a4af042d
push id39092
push userkwierso@gmail.com
push dateFri, 17 Mar 2017 18:14:05 +0000
treeherderautoland@88576fd417e7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop
bugs1345294
milestone55.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 1345294 - script generated patch (+ some hand cleanup) to replace {get,set}ComplexValue for nsISupportsString by {get,set}StringPref, r=Mossop.
browser/base/content/aboutaccounts/aboutaccounts.js
browser/base/content/browser-feeds.js
browser/base/content/browser.js
browser/base/content/test/general/browser_homeDrop.js
browser/base/content/test/newtab/head.js
browser/base/content/test/social/head.js
browser/components/customizableui/CustomizableWidgets.jsm
browser/components/customizableui/CustomizeMode.jsm
browser/components/feeds/FeedWriter.js
browser/components/feeds/WebContentConverter.js
browser/components/migration/content/migration.js
browser/components/tests/unit/test_distribution.js
browser/components/uitour/UITour.jsm
browser/extensions/pdfjs/content/PdfStreamConverter.jsm
browser/extensions/pdfjs/content/PdfjsChromeUtils.jsm
browser/extensions/pocket/bootstrap.js
browser/extensions/pocket/content/pktApi.jsm
browser/modules/SocialService.jsm
browser/modules/test/unit/social/head.js
browser/modules/test/unit/social/test_SocialServiceMigration22.js
browser/modules/test/unit/social/test_SocialServiceMigration29.js
devtools/client/commandline/test/browser_cmd_pref3.js
devtools/client/commandline/test/browser_cmd_settings.js
devtools/client/scratchpad/scratchpad.js
devtools/shared/gcli/commands/cmd.js
devtools/shared/gcli/source/lib/gcli/settings.js
extensions/pref/autoconfig/src/prefcalls.js
extensions/pref/autoconfig/test/unit/test_autoconfig_nonascii.js
extensions/universalchardet/tests/CharsetDetectionTests.js
mobile/android/chrome/content/browser.js
mobile/android/modules/FxAccountsWebChannel.jsm
services/common/tests/unit/test_hawkrequest.js
services/fxaccounts/FxAccountsWebChannel.jsm
toolkit/components/exthelper/extApplication.js
toolkit/components/passwordmgr/LoginManagerParent.jsm
toolkit/components/urlformatter/nsURLFormatter.js
toolkit/components/urlformatter/tests/unit/test_urlformatter.js
toolkit/components/viewconfig/content/config.js
toolkit/content/widgets/preferences.xml
toolkit/modules/CharsetMenu.jsm
toolkit/modules/NewTabUtils.jsm
toolkit/modules/Preferences.jsm
toolkit/modules/Troubleshoot.jsm
toolkit/mozapps/extensions/LightweightThemeManager.jsm
--- a/browser/base/content/aboutaccounts/aboutaccounts.js
+++ b/browser/base/content/aboutaccounts/aboutaccounts.js
@@ -25,27 +25,24 @@ const OBSERVER_TOPICS = [
 ];
 
 function log(msg) {
   // dump("FXA: " + msg + "\n");
 }
 
 function getPreviousAccountNameHash() {
   try {
-    return Services.prefs.getComplexValue(PREF_LAST_FXA_USER, Ci.nsISupportsString).data;
+    return Services.prefs.getStringPref(PREF_LAST_FXA_USER);
   } catch (_) {
     return "";
   }
 }
 
 function setPreviousAccountNameHash(acctName) {
-  let string = Cc["@mozilla.org/supports-string;1"]
-               .createInstance(Ci.nsISupportsString);
-  string.data = sha256(acctName);
-  Services.prefs.setComplexValue(PREF_LAST_FXA_USER, Ci.nsISupportsString, string);
+  Services.prefs.setStringPref(PREF_LAST_FXA_USER, sha256(acctName));
 }
 
 function needRelinkWarning(acctName) {
   let prevAcctHash = getPreviousAccountNameHash();
   return prevAcctHash && prevAcctHash != sha256(acctName);
 }
 
 // Given a string, returns the SHA265 hash in base64
--- a/browser/base/content/browser-feeds.js
+++ b/browser/base/content/browser-feeds.js
@@ -330,20 +330,17 @@ var FeedHandler = {
         break;
       case "FeedWriter:ShownFirstRun":
         Services.prefs.setBoolPref("browser.feeds.showFirstRunUI", false);
         break;
       case "FeedWriter:SetFeedCharPref":
         Services.prefs.setCharPref(msg.data.pref, msg.data.value);
         break;
       case "FeedWriter:SetFeedComplexString": {
-        let supportsString = Cc["@mozilla.org/supports-string;1"].
-                             createInstance(Ci.nsISupportsString);
-        supportsString.data = msg.data.value;
-        Services.prefs.setComplexValue(msg.data.pref, Ci.nsISupportsString, supportsString);
+        Services.prefs.setStringPref(msg.data.pref, msg.data.value);
         break;
       }
       case "FeedConverter:ExecuteClientApp":
         this.executeClientApp(msg.data.spec, msg.data.title,
                               msg.data.subtitle, msg.data.feedHandler);
         break;
     }
   },
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3606,21 +3606,17 @@ function openHomeDialog(aURL) {
   }
 
   var pressedVal  = Services.prompt.confirmEx(window, promptTitle, promptMsg,
                           Services.prompt.STD_YES_NO_BUTTONS,
                           null, null, null, null, {value:0});
 
   if (pressedVal == 0) {
     try {
-      var homepageStr = Components.classes["@mozilla.org/supports-string;1"]
-                        .createInstance(Components.interfaces.nsISupportsString);
-      homepageStr.data = aURL;
-      gPrefService.setComplexValue("browser.startup.homepage",
-                                   Components.interfaces.nsISupportsString, homepageStr);
+      gPrefService.setStringPref("browser.startup.homepage", aURL);
     } catch (ex) {
       dump("Failed to set the home page.\n" + ex + "\n");
     }
   }
 }
 
 var newTabButtonObserver = {
   onDragOver(aEvent) {
--- a/browser/base/content/test/general/browser_homeDrop.js
+++ b/browser/base/content/test/general/browser_homeDrop.js
@@ -30,23 +30,21 @@ add_task(function*() {
     yield BrowserTestUtils.waitForEvent(setHomepageDialog, "load", false);
 
     let setHomepagePromise = new Promise(function(resolve) {
       let observer = {
         QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
         observe(subject, topic, data) {
           is(topic, "nsPref:changed", "observed correct topic");
           is(data, HOMEPAGE_PREF, "observed correct data");
-          let modified = Services.prefs.getComplexValue(HOMEPAGE_PREF,
-                                                        Ci.nsISupportsString);
-          is(modified.data, homepage, "homepage is set correctly");
+          let modified = Services.prefs.getStringPref(HOMEPAGE_PREF);
+          is(modified, homepage, "homepage is set correctly");
           Services.prefs.removeObserver(HOMEPAGE_PREF, observer);
 
-          Services.prefs.setComplexValue(HOMEPAGE_PREF,
-                                         Ci.nsISupportsString, homepageStr);
+          Services.prefs.setStringPref(HOMEPAGE_PREF, "about:mozilla;");
 
           resolve();
         }
       };
       Services.prefs.addObserver(HOMEPAGE_PREF, observer, false);
     });
 
     setHomepageDialog.document.documentElement.acceptDialog();
@@ -82,9 +80,8 @@ add_task(function*() {
   yield* drop([[{type: "text/plain",
                  data: "http://mochi.test:8888/"}]],
               "http://mochi.test:8888/");
   yield* drop([[{type: "text/plain",
                  data: "http://mochi.test:8888/\nhttp://mochi.test:8888/b\nhttp://mochi.test:8888/c"}]],
               "http://mochi.test:8888/|http://mochi.test:8888/b|http://mochi.test:8888/c");
   yield dropInvalidURI();
 });
-
--- a/browser/base/content/test/newtab/head.js
+++ b/browser/base/content/test/newtab/head.js
@@ -248,21 +248,17 @@ function setPinnedLinks(aLinks) {
       if (id)
         return {url: "http://example" + (id != "-1" ? id : "") + ".com/",
                 title: "site#" + id,
                 type: "history"};
       return undefined;
     });
   }
 
-  let string = Cc["@mozilla.org/supports-string;1"]
-                 .createInstance(Ci.nsISupportsString);
-  string.data = JSON.stringify(links);
-  Services.prefs.setComplexValue("browser.newtabpage.pinned",
-                                 Ci.nsISupportsString, string);
+  Services.prefs.setStringPref("browser.newtabpage.pinned", JSON.stringify(links));
 
   NewTabUtils.pinnedLinks.resetCache();
   NewTabUtils.allPages.update();
 }
 
 /**
  * Restore the grid state.
  */
--- a/browser/base/content/test/social/head.js
+++ b/browser/base/content/test/social/head.js
@@ -198,20 +198,17 @@ function checkSocialUI(win) {
   if (SocialService.hasEnabledProviders) {
     ok(Social.providers.length > 0, "providers are enabled");
   } else {
     is(Social.providers.length, 0, "providers are not enabled");
   }
 }
 
 function setManifestPref(name, manifest) {
-  let string = Cc["@mozilla.org/supports-string;1"].
-               createInstance(Ci.nsISupportsString);
-  string.data = JSON.stringify(manifest);
-  Services.prefs.setComplexValue(name, Ci.nsISupportsString, string);
+  Services.prefs.setStringPref(name, JSON.stringify(manifest));
 }
 
 function getManifestPrefname(aManifest) {
   // is same as the generated name in SocialServiceInternal.getManifestPrefname
   let originUri = Services.io.newURI(aManifest.origin);
   return "social.manifest." + originUri.hostPort.replace(".", "-");
 }
 
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -1071,20 +1071,17 @@ const CustomizableWidgets = [
 
       // The behavior as implemented here is directly based off of the
       // `MultiplexHandler()` method in browser.js.
       if (section != "detectors") {
         window.BrowserSetForcedCharacterSet(value);
       } else {
         // Set the detector pref.
         try {
-          let str = Cc["@mozilla.org/supports-string;1"]
-                      .createInstance(Ci.nsISupportsString);
-          str.data = value;
-          Services.prefs.setComplexValue("intl.charset.detector", Ci.nsISupportsString, str);
+          Services.prefs.setStringPref("intl.charset.detector", value);
         } catch (e) {
           Cu.reportError("Failed to set the intl.charset.detector preference.");
         }
         // Prepare a browser page reload with a changed charset.
         window.BrowserCharsetReload();
       }
     },
     onCreated(aNode) {
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -1363,32 +1363,28 @@ CustomizeMode.prototype = {
           else
             LightweightThemeManager.currentTheme = button.theme;
           onThemeSelected(panel);
         });
         panel.insertBefore(button, recommendedLabel);
       }
 
       let lwthemePrefs = Services.prefs.getBranch("lightweightThemes.");
-      let recommendedThemes = lwthemePrefs.getComplexValue("recommendedThemes",
-                                                           Ci.nsISupportsString).data;
+      let recommendedThemes = lwthemePrefs.getStringPref("recommendedThemes");
       recommendedThemes = JSON.parse(recommendedThemes);
       let sb = Services.strings.createBundle("chrome://browser/locale/lightweightThemes.properties");
       for (let theme of recommendedThemes) {
         theme.name = sb.GetStringFromName("lightweightThemes." + theme.id + ".name");
         theme.description = sb.GetStringFromName("lightweightThemes." + theme.id + ".description");
         let button = buildToolbarButton(theme);
         button.addEventListener("command", () => {
           LightweightThemeManager.setLocalTheme(button.theme);
           recommendedThemes = recommendedThemes.filter((aTheme) => { return aTheme.id != button.theme.id; });
-          let string = Cc["@mozilla.org/supports-string;1"]
-                         .createInstance(Ci.nsISupportsString);
-          string.data = JSON.stringify(recommendedThemes);
-          lwthemePrefs.setComplexValue("recommendedThemes",
-                                       Ci.nsISupportsString, string);
+          lwthemePrefs.setStringPref("recommendedThemes",
+                                     JSON.stringify(recommendedThemes));
           onThemeSelected(panel);
         });
         panel.insertBefore(button, footer);
       }
       let hideRecommendedLabel = (footer.previousSibling == recommendedLabel);
       recommendedLabel.hidden = hideRecommendedLabel;
     }.bind(this));
   },
--- a/browser/components/feeds/FeedWriter.js
+++ b/browser/components/feeds/FeedWriter.js
@@ -695,17 +695,17 @@ FeedWriter.prototype = {
     let prefs = Services.prefs;
     let handler = prefs.getCharPref(getPrefReaderForType(feedType), "bookmarks");
 
     switch (handler) {
       case "web": {
         if (this._handlersList) {
           let url;
           try {
-            url = prefs.getComplexValue(getPrefWebForType(feedType), Ci.nsISupportsString).data;
+            url = prefs.getStringPref(getPrefWebForType(feedType));
           } catch (ex) {
             LOG("FeedWriter._setSelectedHandler: invalid or no handler in prefs");
             return;
           }
           let handlers =
             this._getWebHandlerElementsForURL(url);
           if (handlers.length == 0) {
             LOG("FeedWriter._setSelectedHandler: selected web handler isn't in the menulist")
--- a/browser/components/feeds/WebContentConverter.js
+++ b/browser/components/feeds/WebContentConverter.js
@@ -691,22 +691,17 @@ WebContentConverterRegistrar.prototype =
     this._saveContentHandlerToPrefs(contentType, uri, title);
 
     if (contentType == TYPE_MAYBE_FEED) {
       // Make the new handler the last-selected reader in the preview page
       // and make sure the preview page is shown the next time a feed is visited
       let pb = Services.prefs.getBranch(null);
       pb.setCharPref(PREF_SELECTED_READER, "web");
 
-      let supportsString =
-        Cc["@mozilla.org/supports-string;1"].
-        createInstance(Ci.nsISupportsString);
-        supportsString.data = uri;
-      pb.setComplexValue(PREF_SELECTED_WEB, Ci.nsISupportsString,
-                         supportsString);
+      pb.setStringPref(PREF_SELECTED_WEB, uri);
       pb.setCharPref(PREF_SELECTED_ACTION, "ask");
       this._setAutoHandler(TYPE_MAYBE_FEED, null);
     }
   },
 
   /**
    * Update the content type -> handler map. This mapping is not persisted, use
    * registerContentHandler or _saveContentHandlerToPrefs for that purpose.
--- a/browser/components/migration/content/migration.js
+++ b/browser/components/migration/content/migration.js
@@ -421,22 +421,18 @@ var MigrationWizard = { /* exported Migr
               // set homepage properly
               var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
                                       .getService(Components.interfaces.nsIPrefService);
               var prefBranch = prefSvc.getBranch(null);
 
               if (this._newHomePage == "DEFAULT") {
                 prefBranch.clearUserPref("browser.startup.homepage");
               } else {
-                var str = Components.classes["@mozilla.org/supports-string;1"]
-                                  .createInstance(Components.interfaces.nsISupportsString);
-                str.data = this._newHomePage;
-                prefBranch.setComplexValue("browser.startup.homepage",
-                                           Components.interfaces.nsISupportsString,
-                                           str);
+                prefBranch.setStringPref("browser.startup.homepage",
+                                         this._newHomePage);
               }
 
               var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
                                      .getService(Components.interfaces.nsIProperties);
               var prefFile = dirSvc.get("ProfDS", Components.interfaces.nsIFile);
               prefFile.append("prefs.js");
               prefSvc.savePrefFile(prefFile);
             } catch (ex) {
--- a/browser/components/tests/unit/test_distribution.js
+++ b/browser/components/tests/unit/test_distribution.js
@@ -92,17 +92,17 @@ add_task(function* () {
   // Force distribution.
   let glue = Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIObserver)
   glue.observe(null, TOPIC_BROWSERGLUE_TEST, TOPICDATA_DISTRIBUTION_CUSTOMIZATION);
 
   var defaultBranch = Services.prefs.getDefaultBranch(null);
 
   Assert.equal(defaultBranch.getCharPref("distribution.id"), "disttest");
   Assert.equal(defaultBranch.getCharPref("distribution.version"), "1.0");
-  Assert.equal(defaultBranch.getComplexValue("distribution.about", Ci.nsISupportsString).data, "Tèƨƭ δïƨƭřïβúƭïôñ ƒïℓè");
+  Assert.equal(defaultBranch.getStringPref("distribution.about"), "Tèƨƭ δïƨƭřïβúƭïôñ ƒïℓè");
 
   Assert.equal(defaultBranch.getCharPref("distribution.test.string"), "Test String");
   Assert.equal(defaultBranch.getCharPref("distribution.test.string.noquotes"), "Test String");
   Assert.equal(defaultBranch.getIntPref("distribution.test.int"), 777);
   Assert.equal(defaultBranch.getBoolPref("distribution.test.bool.true"), true);
   Assert.equal(defaultBranch.getBoolPref("distribution.test.bool.false"), false);
 
   Assert.throws(() => defaultBranch.getCharPref("distribution.test.empty"));
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -578,32 +578,28 @@ this.UITour = {
         let enginePromise = this.selectSearchEngine(data.identifier);
         enginePromise.catch(Cu.reportError);
         break;
       }
 
       case "setTreatmentTag": {
         let name = data.name;
         let value = data.value;
-        let string = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
-        string.data = value;
-        Services.prefs.setComplexValue("browser.uitour.treatment." + name,
-                                       Ci.nsISupportsString, string);
+        Services.prefs.setStringPref("browser.uitour.treatment." + name, value);
         // The notification is only meant to be used in tests.
         UITourHealthReport.recordTreatmentTag(name, value)
                           .then(() => this.notify("TreatmentTag:TelemetrySent"));
         break;
       }
 
       case "getTreatmentTag": {
         let name = data.name;
         let value;
         try {
-          value = Services.prefs.getComplexValue("browser.uitour.treatment." + name,
-                                                 Ci.nsISupportsString).data;
+          value = Services.prefs.getStringPref("browser.uitour.treatment." + name);
         } catch (ex) {}
         this.sendPageCallback(messageManager, data.callbackID, { value });
         break;
       }
 
       case "setSearchTerm": {
         let targetPromise = this.getTarget(window, "search");
         targetPromise.then(target => {
--- a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm
+++ b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm
@@ -88,17 +88,17 @@ function getIntPref(pref, def) {
     return Services.prefs.getIntPref(pref);
   } catch (ex) {
     return def;
   }
 }
 
 function getStringPref(pref, def) {
   try {
-    return Services.prefs.getComplexValue(pref, Ci.nsISupportsString).data;
+    return Services.prefs.getStringPref(pref);
   } catch (ex) {
     return def;
   }
 }
 
 function log(aMsg) {
   if (!getBoolPref(PREF_PREFIX + ".pdfBugEnabled", false)) {
     return;
--- a/browser/extensions/pdfjs/content/PdfjsChromeUtils.jsm
+++ b/browser/extensions/pdfjs/content/PdfjsChromeUtils.jsm
@@ -285,20 +285,17 @@ var PdfjsChromeUtils = {
 
   _setCharPref(aPrefName, aPrefValue) {
     this._ensurePreferenceAllowed(aPrefName);
     Services.prefs.setCharPref(aPrefName, aPrefValue);
   },
 
   _setStringPref(aPrefName, aPrefValue) {
     this._ensurePreferenceAllowed(aPrefName);
-    let str = Cc["@mozilla.org/supports-string;1"]
-                .createInstance(Ci.nsISupportsString);
-    str.data = aPrefValue;
-    Services.prefs.setComplexValue(aPrefName, Ci.nsISupportsString, str);
+    Services.prefs.setStringPref(aPrefName, aPrefValue);
   },
 
   /*
    * Svc.mime doesn't have profile information in the child, so
    * we bounce this pdfjs enabled configuration check over to the
    * parent.
    */
   isDefaultHandlerApp() {
--- a/browser/extensions/pocket/bootstrap.js
+++ b/browser/extensions/pocket/bootstrap.js
@@ -141,20 +141,17 @@ function CreatePocketWidget(reason) {
     SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
   }
 
   let origin = "https://getpocket.com";
   SocialService.getProvider(origin, provider => {
     if (provider) {
       let pref = "social.backup.getpocket-com";
       if (!Services.prefs.prefHasUserValue(pref)) {
-        let str = Cc["@mozilla.org/supports-string;1"].
-                  createInstance(Ci.nsISupportsString);
-        str.data = JSON.stringify(provider.manifest);
-        Services.prefs.setComplexValue(pref, Ci.nsISupportsString, str);
+        Services.prefs.setStringPref(pref, JSON.stringify(provider.manifest));
         SocialService.uninstallProvider(origin, () => {});
       }
     }
   });
 
 }
 
 // PocketContextMenu
--- a/browser/extensions/pocket/content/pktApi.jsm
+++ b/browser/extensions/pocket/content/pktApi.jsm
@@ -119,17 +119,17 @@ var pktApi = (function() {
      */
      function getSetting(key) {
         // TODO : Move this to sqlite or a local file so it's not editable (and is safer)
         // https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Local_Storage
 
         if (!prefBranch.prefHasUserValue(key))
             return undefined;
 
-        return prefBranch.getComplexValue(key, Components.interfaces.nsISupportsString).data;
+        return prefBranch.getStringPref(key);
      }
 
      /**
       * Wrapper for different plattforms to set a value for a given key in settings
       * @param {string} key     A string containing the name of the key you want
       *                         to create/update.
       * @param {string} value   String containing the value you want to give
       *                         the key you are creating/updating.
@@ -137,19 +137,17 @@ var pktApi = (function() {
     function setSetting(key, value) {
         // TODO : Move this to sqlite or a local file so it's not editable (and is safer)
         // https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Local_Storage
 
         if (!value)
             prefBranch.clearUserPref(key);
         else {
             // We use complexValue as tags can have utf-8 characters in them
-            var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
-            str.data = value;
-            prefBranch.setComplexValue(key, Components.interfaces.nsISupportsString, str);
+            prefBranch.setStringPref(key, value);
         }
     }
 
     /**
      * Auth
      */
 
     /*
--- a/browser/modules/SocialService.jsm
+++ b/browser/modules/SocialService.jsm
@@ -41,17 +41,17 @@ var SocialServiceInternal = {
     // Retrieve the manifests of installed providers from prefs
     let MANIFEST_PREFS = Services.prefs.getBranch("social.manifest.");
     let prefs = MANIFEST_PREFS.getChildList("", []);
     for (let pref of prefs) {
       // we only consider manifests in user level prefs to be *installed*
       if (!MANIFEST_PREFS.prefHasUserValue(pref))
         continue;
       try {
-        var manifest = JSON.parse(MANIFEST_PREFS.getComplexValue(pref, Ci.nsISupportsString).data);
+        var manifest = JSON.parse(MANIFEST_PREFS.getStringPref(pref));
         if (manifest && typeof(manifest) == "object" && manifest.origin)
           yield manifest;
       } catch (err) {
         Cu.reportError("SocialService: failed to load manifest: " + pref +
                        ", exception: " + err);
       }
     }
   },
@@ -60,17 +60,17 @@ var SocialServiceInternal = {
   },
   getManifestPrefname(origin) {
     // Retrieve the prefname for a given origin/manifest.
     // If no existing pref, return a generated prefname.
     let MANIFEST_PREFS = Services.prefs.getBranch("social.manifest.");
     let prefs = MANIFEST_PREFS.getChildList("", []);
     for (let pref of prefs) {
       try {
-        var manifest = JSON.parse(MANIFEST_PREFS.getComplexValue(pref, Ci.nsISupportsString).data);
+        var manifest = JSON.parse(MANIFEST_PREFS.getStringPref(pref));
         if (manifest.origin == origin) {
           return pref;
         }
       } catch (err) {
         Cu.reportError("SocialService: failed to load manifest: " + pref +
                        ", exception: " + err);
       }
     }
@@ -197,21 +197,18 @@ var ActiveProviders = {
   },
 
   get _deferredTask() {
     delete this._deferredTask;
     return this._deferredTask = new DeferredTask(this._persist.bind(this), 0);
   },
 
   _persist() {
-    let string = Cc["@mozilla.org/supports-string;1"].
-                 createInstance(Ci.nsISupportsString);
-    string.data = JSON.stringify(this._providers);
-    Services.prefs.setComplexValue("social.activeProviders",
-                                   Ci.nsISupportsString, string);
+    Services.prefs.setStringPref("social.activeProviders",
+                                 JSON.stringify(this._providers));
   }
 };
 
 function migrateSettings() {
   let enabled;
   if (Services.prefs.prefHasUserValue("social.enabled")) {
     enabled = Services.prefs.getBoolPref("social.enabled");
   }
@@ -219,31 +216,30 @@ function migrateSettings() {
     // migration from fx21 to fx22 or later
     // ensure any *builtin* provider in activeproviders is in user level prefs
     for (let origin in ActiveProviders._providers) {
       let prefname;
       let manifest;
       let defaultManifest;
       try {
         prefname = getPrefnameFromOrigin(origin);
-        manifest = JSON.parse(Services.prefs.getComplexValue(prefname, Ci.nsISupportsString).data);
+        manifest = JSON.parse(Services.prefs.getStringPref(prefname));
       } catch (e) {
         // Our preference is missing or bad, remove from ActiveProviders and
         // continue. This is primarily an error-case and should only be
         // reached by either messing with preferences or hitting the one or
         // two days of nightly that ran into it, so we'll flush right away.
         ActiveProviders.delete(origin);
         ActiveProviders.flush();
         continue;
       }
       let needsUpdate = !manifest.updateDate;
       // fx23 may have built-ins with shareURL
       try {
-        defaultManifest = Services.prefs.getDefaultBranch(null)
-                        .getComplexValue(prefname, Ci.nsISupportsString).data;
+        defaultManifest = Services.prefs.getDefaultBranch(null).getStringPref(prefname);
         defaultManifest = JSON.parse(defaultManifest);
       } catch (e) {
         // not a built-in, continue
       }
       if (defaultManifest) {
         if (defaultManifest.shareURL && !manifest.shareURL) {
           manifest.shareURL = defaultManifest.shareURL;
           needsUpdate = true;
@@ -257,20 +253,17 @@ function migrateSettings() {
         // the provider was installed with an older build, so we will update the
         // timestamp and ensure the manifest is in user prefs
         delete manifest.builtin;
         // we're potentially updating for share, so always mark the updateDate
         manifest.updateDate = Date.now();
         if (!manifest.installDate)
           manifest.installDate = 0; // we don't know when it was installed
 
-        let string = Cc["@mozilla.org/supports-string;1"].
-                     createInstance(Ci.nsISupportsString);
-        string.data = JSON.stringify(manifest);
-        Services.prefs.setComplexValue(prefname, Ci.nsISupportsString, string);
+        Services.prefs.setStringPref(prefname, JSON.stringify(manifest));
       }
       // as of fx 29, we no longer rely on social.enabled. migration from prior
       // versions should disable all service addons if social.enabled=false
       if (enabled === false) {
         ActiveProviders.delete(origin);
       }
     }
     ActiveProviders.flush();
@@ -286,34 +279,33 @@ function migrateSettings() {
   // primary difference from SocialServiceInternal.manifests is that we
   // only read the default branch here.
   let manifestPrefs = Services.prefs.getDefaultBranch("social.manifest.");
   let prefs = manifestPrefs.getChildList("", []);
   for (let pref of prefs) {
     try {
       let manifest;
       try {
-        manifest = JSON.parse(manifestPrefs.getComplexValue(pref, Ci.nsISupportsString).data);
+        manifest = JSON.parse(manifestPrefs.getStringPref(pref));
       } catch (e) {
         // bad or missing preference, we wont update this one.
         continue;
       }
       if (manifest && typeof(manifest) == "object" && manifest.origin) {
         // our default manifests have been updated with the builtin flags as of
         // fx22, delete it so we can set the user-pref
         delete manifest.builtin;
         if (!manifest.updateDate) {
           manifest.updateDate = Date.now();
           manifest.installDate = 0; // we don't know when it was installed
         }
 
-        let string = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
-        string.data = JSON.stringify(manifest);
         // pref here is just the branch name, set the full pref name
-        Services.prefs.setComplexValue("social.manifest." + pref, Ci.nsISupportsString, string);
+        Services.prefs.setStringPref("social.manifest." + pref,
+                                     JSON.stringify(manifest));
         ActiveProviders.add(manifest.origin);
         ActiveProviders.flush();
         // social.active was used at a time that there was only one
         // builtin, we'll assume that is still the case
         return;
       }
     } catch (err) {
       Cu.reportError("SocialService: failed to load manifest: " + pref + ", exception: " + err);
@@ -637,20 +629,18 @@ this.SocialService = {
   updateProvider(aUpdateOrigin, aManifest) {
     let installType = this.getOriginActivationType(aUpdateOrigin);
     // if we get data, we MUST have a valid manifest generated from the data
     let manifest = this._manifestFromData(installType, aManifest, aUpdateOrigin);
     if (!manifest)
       throw new Error("SocialService.installProvider: service configuration is invalid from " + aUpdateOrigin);
 
     // overwrite the preference
-    let string = Cc["@mozilla.org/supports-string;1"].
-                 createInstance(Ci.nsISupportsString);
-    string.data = JSON.stringify(manifest);
-    Services.prefs.setComplexValue(getPrefnameFromOrigin(manifest.origin), Ci.nsISupportsString, string);
+    Services.prefs.setStringPref(getPrefnameFromOrigin(manifest.origin),
+                                 JSON.stringify(manifest));
 
     // overwrite the existing provider then notify the front end so it can
     // handle any reload that might be necessary.
     if (ActiveProviders.has(manifest.origin)) {
       let provider = SocialServiceInternal.providers[manifest.origin];
       provider.enabled = false;
       provider = new SocialProvider(manifest);
       SocialServiceInternal.providers[provider.origin] = provider;
@@ -824,20 +814,18 @@ function AddonInstaller(sourceURI, aMani
   this.sourceURI = sourceURI;
   this.install = function() {
     let addon = this.addon;
     if (isNewInstall) {
       AddonManagerPrivate.callInstallListeners("onExternalInstall", null, addon, null, false);
       AddonManagerPrivate.callAddonListeners("onInstalling", addon, false);
     }
 
-    let string = Cc["@mozilla.org/supports-string;1"].
-                 createInstance(Ci.nsISupportsString);
-    string.data = JSON.stringify(aManifest);
-    Services.prefs.setComplexValue(getPrefnameFromOrigin(aManifest.origin), Ci.nsISupportsString, string);
+    Services.prefs.setStringPref(getPrefnameFromOrigin(aManifest.origin),
+                                 JSON.stringify(aManifest));
 
     if (isNewInstall) {
       AddonManagerPrivate.callAddonListeners("onInstalled", addon);
     }
     installCallback(aManifest);
   };
   this.cancel = function() {
     Services.prefs.clearUserPref(getPrefnameFromOrigin(aManifest.origin));
--- a/browser/modules/test/unit/social/head.js
+++ b/browser/modules/test/unit/social/head.js
@@ -52,20 +52,18 @@ function initApp() {
   let internalManager = Cc["@mozilla.org/addons/integration;1"].
                      getService(Ci.nsIObserver).
                      QueryInterface(Ci.nsITimerCallback);
 
   internalManager.observe(null, "addons-startup", null);
 }
 
 function setManifestPref(manifest) {
-  let string = Cc["@mozilla.org/supports-string;1"].
-               createInstance(Ci.nsISupportsString);
-  string.data = JSON.stringify(manifest);
-  Services.prefs.setComplexValue("social.manifest." + manifest.origin, Ci.nsISupportsString, string);
+  Services.prefs.setStringPref("social.manifest." + manifest.origin,
+                               JSON.stringify(manifest));
 }
 
 function do_wait_observer(obsTopic, cb) {
   function observer(subject, topic, data) {
     Services.obs.removeObserver(observer, topic);
     cb();
   }
   Services.obs.addObserver(observer, obsTopic, false);
@@ -86,24 +84,21 @@ function do_initialize_social(enabledOnS
   initApp();
 
   if (enabledOnStartup) {
     // set prefs before initializing social
     manifests.forEach(function(manifest) {
       setManifestPref(manifest);
     });
     // Set both providers active and flag the first one as "current"
-    let activeVal = Cc["@mozilla.org/supports-string;1"].
-               createInstance(Ci.nsISupportsString);
     let active = {};
     for (let m of manifests)
       active[m.origin] = 1;
-    activeVal.data = JSON.stringify(active);
-    Services.prefs.setComplexValue("social.activeProviders",
-                                   Ci.nsISupportsString, activeVal);
+    Services.prefs.setStringPref("social.activeProviders",
+                                 JSON.stringify(active));
 
     do_register_cleanup(function() {
       manifests.forEach(function(manifest) {
         Services.prefs.clearUserPref("social.manifest." + manifest.origin);
       });
       Services.prefs.clearUserPref("social.activeProviders");
     });
 
--- a/browser/modules/test/unit/social/test_SocialServiceMigration22.js
+++ b/browser/modules/test/unit/social/test_SocialServiceMigration22.js
@@ -17,25 +17,22 @@ function run_test() {
     name: "provider 1",
     origin: "https://example1.com",
     builtin: true // as of fx22 this should be true for default prefs
   };
 
   DEFAULT_PREFS.setCharPref(manifest.origin, JSON.stringify(manifest));
 
   // Set both providers active and flag the first one as "current"
-  let activeVal = Cc["@mozilla.org/supports-string;1"].
-             createInstance(Ci.nsISupportsString);
   let active = {};
   active[manifest.origin] = 1;
   // bad.origin tests that a missing manifest does not break migration, bug 859715
   active["bad.origin"] = 1;
-  activeVal.data = JSON.stringify(active);
-  Services.prefs.setComplexValue("social.activeProviders",
-                                 Ci.nsISupportsString, activeVal);
+  Services.prefs.setStringPref("social.activeProviders",
+                               JSON.stringify(active));
 
   Cu.import("resource:///modules/SocialService.jsm");
 
   let runner = new AsyncRunner();
   let next = runner.next.bind(runner);
   runner.appendIterator(testMigration(manifest, next));
   runner.next();
 }
--- a/browser/modules/test/unit/social/test_SocialServiceMigration29.js
+++ b/browser/modules/test/unit/social/test_SocialServiceMigration29.js
@@ -15,23 +15,20 @@ function run_test() {
   let manifest = { // normal provider
     name: "provider 1",
     origin: "https://example1.com",
   };
 
   MANIFEST_PREFS.setCharPref(manifest.origin, JSON.stringify(manifest));
 
   // Set both providers active and flag the first one as "current"
-  let activeVal = Cc["@mozilla.org/supports-string;1"].
-             createInstance(Ci.nsISupportsString);
   let active = {};
   active[manifest.origin] = 1;
-  activeVal.data = JSON.stringify(active);
-  Services.prefs.setComplexValue("social.activeProviders",
-                                 Ci.nsISupportsString, activeVal);
+  Services.prefs.setStringPref("social.activeProviders",
+                               JSON.stringify(active));
 
   // social.enabled pref is the key focus of this test. We set the user pref,
   // and then migration should a) remove the provider from activeProviders and
   // b) unset social.enabled
   Services.prefs.setBoolPref("social.enabled", false);
 
   Cu.import("resource:///modules/SocialService.jsm");
 
@@ -48,14 +45,13 @@ function* testMigration(manifest, next) 
   do_check_true(MANIFEST_PREFS.prefHasUserValue(manifest.origin));
   // we need to access the providers for everything to initialize
   yield SocialService.getProviderList(next);
   do_check_false(SocialService.enabled);
   do_check_false(Services.prefs.prefHasUserValue("social.enabled"));
   do_check_true(Services.prefs.prefHasUserValue("social.activeProviders"));
 
   let activeProviders;
-  let pref = Services.prefs.getComplexValue("social.activeProviders",
-                                            Ci.nsISupportsString).data;
+  let pref = Services.prefs.getStringPref("social.activeProviders");
   activeProviders = JSON.parse(pref);
   do_check_true(activeProviders[manifest.origin] == undefined);
   do_check_true(MANIFEST_PREFS.prefHasUserValue(manifest.origin));
 }
--- a/devtools/client/commandline/test/browser_cmd_pref3.js
+++ b/devtools/client/commandline/test/browser_cmd_pref3.js
@@ -15,18 +15,17 @@ const TEST_URI = "data:text/html;charset
 function test() {
   return Task.spawn(spawnTest).then(finish, helpers.handleError);
 }
 
 function* spawnTest() {
   let options = yield helpers.openTab(TEST_URI);
   yield helpers.openToolbar(options);
 
-  let remoteHostOrig = prefBranch.getComplexValue("devtools.debugger.remote-host",
-                                                  Ci.nsISupportsString).data;
+  let remoteHostOrig = prefBranch.getStringPref("devtools.debugger.remote-host");
   info("originally: devtools.debugger.remote-host = " + remoteHostOrig);
 
   yield helpers.audit(options, [
     {
       setup: "pref show devtools.debugger.remote-host",
       check: {
         args: {
           setting: {
@@ -60,18 +59,17 @@ function* spawnTest() {
             value: options.requisition.system.settings.get("devtools.debugger.remote-host")
           }
         },
       },
       exec: {
         output: new RegExp("^devtools\.debugger\.remote-host: e.com$"),
       },
       post: function () {
-        var ecom = prefBranch.getComplexValue("devtools.debugger.remote-host",
-                                              Ci.nsISupportsString).data;
+        var ecom = prefBranch.getStringPref("devtools.debugger.remote-host");
         is(ecom, "e.com", "devtools.debugger.remote-host is e.com");
       }
     },
     {
       setup: "pref set devtools.debugger.remote-host moz.foo",
       check: {
         args: {
           setting: {
@@ -92,18 +90,17 @@ function* spawnTest() {
             value: options.requisition.system.settings.get("devtools.debugger.remote-host")
           }
         },
       },
       exec: {
         output: new RegExp("^devtools\.debugger\.remote-host: moz.foo$"),
       },
       post: function () {
-        var mozfoo = prefBranch.getComplexValue("devtools.debugger.remote-host",
-                                                Ci.nsISupportsString).data;
+        var mozfoo = prefBranch.getStringPref("devtools.debugger.remote-host");
         is(mozfoo, "moz.foo", "devtools.debugger.remote-host is moz.foo");
       }
     },
   ]);
 
   supportsString.data = remoteHostOrig;
   prefBranch.setComplexValue("devtools.debugger.remote-host",
                              Ci.nsISupportsString, supportsString);
--- a/devtools/client/commandline/test/browser_cmd_settings.js
+++ b/devtools/client/commandline/test/browser_cmd_settings.js
@@ -30,19 +30,18 @@ function* spawnTest() {
   let settings = system.settings;
 
   let hideIntroEnabled = settings.get("devtools.gcli.hideIntro");
   let tabSize = settings.get("devtools.editor.tabsize");
   let remoteHost = settings.get("devtools.debugger.remote-host");
 
   let hideIntroOrig = prefBranch.getBoolPref("devtools.gcli.hideIntro");
   let tabSizeOrig = prefBranch.getIntPref("devtools.editor.tabsize");
-  let remoteHostOrig = prefBranch.getComplexValue(
-          "devtools.debugger.remote-host",
-          Components.interfaces.nsISupportsString).data;
+  let remoteHostOrig = prefBranch.getStringPref(
+          "devtools.debugger.remote-host");
 
   info("originally: devtools.gcli.hideIntro = " + hideIntroOrig);
   info("originally: devtools.editor.tabsize = " + tabSizeOrig);
   info("originally: devtools.debugger.remote-host = " + remoteHostOrig);
 
   // Actual tests
   is(hideIntroEnabled.value, hideIntroOrig, "hideIntroEnabled default");
   is(tabSize.value, tabSizeOrig, "tabSize default");
--- a/devtools/client/scratchpad/scratchpad.js
+++ b/devtools/client/scratchpad/scratchpad.js
@@ -1283,18 +1283,17 @@ var Scratchpad = {
   {
     let branch = Services.prefs.getBranch("devtools.scratchpad.");
     let filePaths = [];
 
     // WARNING: Do not use getCharPref here, it doesn't play nicely with
     // Unicode strings.
 
     if (branch.prefHasUserValue("recentFilePaths")) {
-      let data = branch.getComplexValue("recentFilePaths",
-        Ci.nsISupportsString).data;
+      let data = branch.getStringPref("recentFilePaths");
       filePaths = JSON.parse(data);
     }
 
     return filePaths;
   },
 
   /**
    * Save a recent file in a JSON parsable string.
@@ -1331,26 +1330,18 @@ var Scratchpad = {
     // If we are not storing the file and the 'recent files'-list is full,
     // remove the oldest file from the list.
     else if (filesCount === maxRecent) {
       filePaths.shift();
     }
 
     filePaths.push(aFile.path);
 
-    // WARNING: Do not use setCharPref here, it doesn't play nicely with
-    // Unicode strings.
-
-    let str = Cc["@mozilla.org/supports-string;1"]
-      .createInstance(Ci.nsISupportsString);
-    str.data = JSON.stringify(filePaths);
-
-    let branch = Services.prefs.getBranch("devtools.scratchpad.");
-    branch.setComplexValue("recentFilePaths",
-      Ci.nsISupportsString, str);
+    Services.prefs.getBranch("devtools.scratchpad.")
+            .setStringPref("recentFilePaths", JSON.stringify(filePaths));
   },
 
   /**
    * Populates the 'Open Recent'-menu.
    */
   populateRecentFilesMenu: function SP_populateRecentFilesMenu()
   {
     let maxRecent = Services.prefs.getIntPref(PREF_RECENT_FILES_MAX);
@@ -1407,26 +1398,18 @@ var Scratchpad = {
    * @param integer aLength
    *        Number of files from the index 'aIndex' to remove.
    */
   clearFiles: function SP_clearFile(aIndex, aLength)
   {
     let filePaths = this.getRecentFiles();
     filePaths.splice(aIndex, aLength);
 
-    // WARNING: Do not use setCharPref here, it doesn't play nicely with
-    // Unicode strings.
-
-    let str = Cc["@mozilla.org/supports-string;1"]
-      .createInstance(Ci.nsISupportsString);
-    str.data = JSON.stringify(filePaths);
-
-    let branch = Services.prefs.getBranch("devtools.scratchpad.");
-    branch.setComplexValue("recentFilePaths",
-      Ci.nsISupportsString, str);
+    Services.prefs.getBranch("devtools.scratchpad.")
+            .setStringPref("recentFilePaths", JSON.stringify(filePaths));
   },
 
   /**
    * Clear all recent files.
    */
   clearRecentFiles: function SP_clearRecentFiles()
   {
     Services.prefs.clearUserPref("devtools.scratchpad.recentFilePaths");
--- a/devtools/shared/gcli/commands/cmd.js
+++ b/devtools/shared/gcli/commands/cmd.js
@@ -26,18 +26,17 @@ loader.lazyImporter(this, "NetUtil", "re
 const PREF_DIR = "devtools.commands.dir";
 
 /**
  * Load all the .mozcmd files in the directory pointed to by PREF_DIR
  * @return A promise of an array of items suitable for gcli.addItems or
  * using in gcli.addItemsByModule
  */
 function loadItemsFromMozDir() {
-  let dirName = prefBranch.getComplexValue(PREF_DIR,
-                                           Ci.nsISupportsString).data.trim();
+  let dirName = prefBranch.getStringPref(PREF_DIR).trim();
   if (dirName == "") {
     return Promise.resolve([]);
   }
 
   // replaces ~ with the home directory path in unix and windows
   if (dirName.indexOf("~") == 0) {
     let dirService = Cc["@mozilla.org/file/directory_service;1"]
                       .getService(Ci.nsIProperties);
@@ -138,18 +137,17 @@ exports.items = [
     name: "cmd refresh",
     description: l10n.lookup("cmdRefreshDesc"),
     get hidden() {
       return !prefBranch.prefHasUserValue(PREF_DIR);
     },
     exec: function (args, context) {
       gcli.load();
 
-      let dirName = prefBranch.getComplexValue(PREF_DIR,
-                                              Ci.nsISupportsString).data.trim();
+      let dirName = prefBranch.getStringPref(PREF_DIR).trim();
       return l10n.lookupFormat("cmdStatus3", [ dirName ]);
     }
   },
   {
     item: "command",
     runAt: "client",
     name: "cmd setdir",
     description: l10n.lookup("cmdSetdirDesc"),
--- a/devtools/shared/gcli/source/lib/gcli/settings.js
+++ b/devtools/shared/gcli/source/lib/gcli/settings.js
@@ -233,18 +233,17 @@ Object.defineProperty(Setting.prototype,
     switch (imports.prefBranch.getPrefType(this.name)) {
       case imports.prefBranch.PREF_BOOL:
         return imports.prefBranch.getBoolPref(this.name);
 
       case imports.prefBranch.PREF_INT:
         return imports.prefBranch.getIntPref(this.name);
 
       case imports.prefBranch.PREF_STRING:
-        var value = imports.prefBranch.getComplexValue(this.name,
-                Ci.nsISupportsString).data;
+        var value = imports.prefBranch.getStringPref(this.name);
         // In case of a localized string
         if (/^chrome:\/\/.+\/locale\/.+\.properties/.test(value)) {
           value = imports.prefBranch.getComplexValue(this.name,
                   Ci.nsIPrefLocalizedString).data;
         }
         return value;
 
       default:
--- a/extensions/pref/autoconfig/src/prefcalls.js
+++ b/extensions/pref/autoconfig/src/prefcalls.js
@@ -22,21 +22,17 @@ function getPrefBranch() {
 
 function pref(prefName, value) {
 
     try { 
         var prefBranch = getPrefBranch();
 
         if (typeof value == "string") {
             if (gIsUTF8) {
-                const nsISupportsString = Components.interfaces.nsISupportsString;
-                let string = Components.classes["@mozilla.org/supports-string;1"]
-                                       .createInstance(nsISupportsString);
-                string.data = value;
-                prefBranch.setComplexValue(prefName, nsISupportsString, string);
+                prefBranch.setStringPref(prefName, value);
                 return;
             }
             prefBranch.setCharPref(prefName, value);
         }
         else if (typeof value == "number") {
             prefBranch.setIntPref(prefName, value);
         }
         else if (typeof value == "boolean") {
@@ -51,21 +47,17 @@ function pref(prefName, value) {
 function defaultPref(prefName, value) {
     
     try {
         var prefService = Components.classes[PrefServiceContractID]
                                     .getService(nsIPrefService);        
         var prefBranch = prefService.getDefaultBranch(null);
         if (typeof value == "string") {
             if (gIsUTF8) {
-                const nsISupportsString = Components.interfaces.nsISupportsString;
-                let string = Components.classes["@mozilla.org/supports-string;1"]
-                                       .createInstance(nsISupportsString);
-                string.data = value;
-                prefBranch.setComplexValue(prefName, nsISupportsString, string);
+                prefBranch.setStringPref(prefName, value);
                 return;
             }
             prefBranch.setCharPref(prefName, value);
         }
         else if (typeof value == "number") {
             prefBranch.setIntPref(prefName, value);
         }
         else if (typeof value == "boolean") {
@@ -110,20 +102,17 @@ function getPref(prefName) {
     
     try {
         var prefBranch = getPrefBranch();
         
         switch (prefBranch.getPrefType(prefName)) {
             
         case prefBranch.PREF_STRING:
             if (gIsUTF8) {
-                const nsISupportsString = Components.interfaces.nsISupportsString;
-                let string = Components.classes["@mozilla.org/supports-string;1"]
-                                       .createInstance(nsISupportsString);
-                return prefBranch.getComplexValue(prefName, nsISupportsString).data;
+                return prefBranch.getStringPref(prefName);
             }
             return prefBranch.getCharPref(prefName);
             
         case prefBranch.PREF_INT:
             return prefBranch.getIntPref(prefName);
             
         case prefBranch.PREF_BOOL:
             return prefBranch.getBoolPref(prefName);
--- a/extensions/pref/autoconfig/test/unit/test_autoconfig_nonascii.js
+++ b/extensions/pref/autoconfig/test/unit/test_autoconfig_nonascii.js
@@ -53,17 +53,17 @@ function run_test() {
       let autoConfigCfg = testDir.clone();
       autoConfigCfg.append(test.filename);
       autoConfigCfg.copyTo(greD, "autoconfig.cfg");
   
       obsvc.notifyObservers(ps, "prefservice:before-read-userprefs", null);
   
       for (let prefName in test.prefs) {
         do_check_eq(test.prefs[prefName],
-                    prefs.getComplexValue(prefName, Ci.nsISupportsString).data);
+                    prefs.getStringPref(prefName));
       }
   
       ps.resetPrefs();
       // Make sure pref values are reset.
       for (let prefName in test.prefs) {
         do_check_eq(Ci.nsIPrefBranch.PREF_INVALID, prefs.getPrefType(prefName));
       }
     }
--- a/extensions/universalchardet/tests/CharsetDetectionTests.js
+++ b/extensions/universalchardet/tests/CharsetDetectionTests.js
@@ -59,21 +59,17 @@ function InitDetectorTests()
                 getChromeDir(getResolvedURI(window.location.href));
     gLocalDir = ioService.newFileURI(dir).spec;
 }
 
 function SetDetectorPref(aPrefValue)
 {
     var prefService = Cc["@mozilla.org/preferences-service;1"]
                       .getService(Ci.nsIPrefBranch);
-    var str = Cc["@mozilla.org/supports-string;1"]
-              .createInstance(Ci.nsISupportsString);
-    str.data = aPrefValue;
-    prefService.setComplexValue("intl.charset.detector",
-                                Ci.nsISupportsString, str);
+    prefService.setStringPref("intl.charset.detector", aPrefValue);
     gCurrentDetector = aPrefValue;
 }
 
 function DoDetectionTest() {
     var iframeDoc = $("testframe").contentDocument;
     var charset = iframeDoc.characterSet;
 
     is(charset, gExpectedCharset,
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -6793,19 +6793,18 @@ var Distribution = {
     }
 
     // Force the distribution preferences on the default branch
     let defaults = Services.prefs.getDefaultBranch(null);
     defaults.setCharPref("distribution.id", global["id"]);
     defaults.setCharPref("distribution.version", global["version"]);
 
     let locale = BrowserApp.getUALocalePref();
-    let aboutString = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
-    aboutString.data = global["about." + locale] || global["about"];
-    defaults.setComplexValue("distribution.about", Ci.nsISupportsString, aboutString);
+    defaults.setStringPref("distribution.about",
+                           global["about." + locale] || global["about"]);
 
     let prefs = aData["Preferences"];
     for (let key in prefs) {
       try {
         let value = prefs[key];
         switch (typeof value) {
           case "boolean":
             defaults.setBoolPref(key, value);
--- a/mobile/android/modules/FxAccountsWebChannel.jsm
+++ b/mobile/android/modules/FxAccountsWebChannel.jsm
@@ -43,32 +43,29 @@ this.FxAccountsWebChannelHelpers = funct
 };
 
 this.FxAccountsWebChannelHelpers.prototype = {
   /**
    * Get the hash of account name of the previously signed in account.
    */
   getPreviousAccountNameHashPref() {
     try {
-      return Services.prefs.getComplexValue(PREF_LAST_FXA_USER, Ci.nsISupportsString).data;
+      return Services.prefs.getStringPref(PREF_LAST_FXA_USER);
     } catch (_) {
       return "";
     }
   },
 
   /**
    * Given an account name, set the hash of the previously signed in account.
    *
    * @param acctName the account name of the user's account.
    */
   setPreviousAccountNameHashPref(acctName) {
-    let string = Cc["@mozilla.org/supports-string;1"]
-                 .createInstance(Ci.nsISupportsString);
-    string.data = this.sha256(acctName);
-    Services.prefs.setComplexValue(PREF_LAST_FXA_USER, Ci.nsISupportsString, string);
+    Services.prefs.setStringPref(PREF_LAST_FXA_USER, this.sha256(acctName));
   },
 
   /**
    * Given a string, returns the SHA265 hash in base64.
    */
   sha256(str) {
     let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
                       .createInstance(Ci.nsIScriptableUnicodeConverter);
--- a/services/common/tests/unit/test_hawkrequest.js
+++ b/services/common/tests/unit/test_hawkrequest.js
@@ -39,21 +39,17 @@ function run_test() {
 add_test(function test_intl_accept_language() {
   let testCount = 0;
   let languages = [
     "zu-NP;vo",     // Nepalese dialect of Zulu, defaulting to Volapük
     "fa-CG;ik",     // Congolese dialect of Farsei, defaulting to Inupiaq
   ];
 
   function setLanguagePref(lang) {
-    let acceptLanguage = Cc["@mozilla.org/supports-string;1"]
-                           .createInstance(Ci.nsISupportsString);
-    acceptLanguage.data = lang;
-    Services.prefs.setComplexValue(
-      "intl.accept_languages", Ci.nsISupportsString, acceptLanguage);
+    Services.prefs.setStringPref("intl.accept_languages", lang);
   }
 
   let hawk = new HAWKAuthenticatedRESTRequest("https://example.com");
 
   Services.prefs.addObserver("intl.accept_languages", checkLanguagePref, false);
   setLanguagePref(languages[testCount]);
 
   function checkLanguagePref() {
@@ -87,19 +83,18 @@ add_test(function test_hawk_authenticate
   // millisecond values.
   let then = 34329600000;
 
   let clockSkew = 120000;
   let timeOffset = -1 * clockSkew;
   let localTime = then + clockSkew;
 
   // Set the accept-languages pref to the Nepalese dialect of Zulu.
-  let acceptLanguage = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
-  acceptLanguage.data = "zu-NP"; // omit trailing ';', which our HTTP libs snip
-  Services.prefs.setComplexValue("intl.accept_languages", Ci.nsISupportsString, acceptLanguage);
+  let acceptLanguage = "zu-NP"; // omit trailing ';', which our HTTP libs snip
+  Services.prefs.setStringPref("intl.accept_languages", acceptLanguage);
 
   let credentials = {
     id: "eyJleHBpcmVzIjogMTM2NTAxMDg5OC4x",
     key: "qTZf4ZFpAMpMoeSsX3zVRjiqmNs=",
     algorithm: "sha256"
   };
 
   let server = httpd_setup({
@@ -134,17 +129,17 @@ add_test(function test_hawk_authenticate
   function onComplete(error) {
     do_check_eq(200, this.response.status);
     do_check_eq(this.response.body, "yay");
     do_check_true(onProgressCalled);
 
     Services.prefs.resetUserPrefs();
     let pref = Services.prefs.getComplexValue(
       "intl.accept_languages", Ci.nsIPrefLocalizedString);
-    do_check_neq(acceptLanguage.data, pref.data);
+    do_check_neq(acceptLanguage, pref.data);
 
     server.stop(run_next_test);
   }
 
   let url = server.baseURI + "/elysium";
   let extra = {
     now: localTime,
     localtimeOffsetMsec: timeOffset
@@ -166,19 +161,17 @@ add_test(function test_hawk_language_pre
 
   let credentials = {
     id: "eyJleHBpcmVzIjogMTM2NTAxMDg5OC4x",
     key: "qTZf4ZFpAMpMoeSsX3zVRjiqmNs=",
     algorithm: "sha256",
   };
 
   function setLanguage(lang) {
-    let acceptLanguage = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
-    acceptLanguage.data = lang;
-    Services.prefs.setComplexValue("intl.accept_languages", Ci.nsISupportsString, acceptLanguage);
+    Services.prefs.setStringPref("intl.accept_languages", lang);
   }
 
   let server = httpd_setup({
     "/foo": function(request, response) {
       do_check_eq(languages[1], request.getHeader("Accept-Language"));
 
       response.setStatusLine(request.httpVersion, 200, "OK");
     },
--- a/services/fxaccounts/FxAccountsWebChannel.jsm
+++ b/services/fxaccounts/FxAccountsWebChannel.jsm
@@ -328,32 +328,29 @@ this.FxAccountsWebChannelHelpers.prototy
       .then(() => this._fxAccounts.updateDeviceRegistration());
   },
 
   /**
    * Get the hash of account name of the previously signed in account
    */
   getPreviousAccountNameHashPref() {
     try {
-      return Services.prefs.getComplexValue(PREF_LAST_FXA_USER, Ci.nsISupportsString).data;
+      return Services.prefs.getStringPref(PREF_LAST_FXA_USER);
     } catch (_) {
       return "";
     }
   },
 
   /**
    * Given an account name, set the hash of the previously signed in account
    *
    * @param acctName the account name of the user's account.
    */
   setPreviousAccountNameHashPref(acctName) {
-    let string = Cc["@mozilla.org/supports-string;1"]
-                 .createInstance(Ci.nsISupportsString);
-    string.data = this.sha256(acctName);
-    Services.prefs.setComplexValue(PREF_LAST_FXA_USER, Ci.nsISupportsString, string);
+    Services.prefs.setStringPref(PREF_LAST_FXA_USER, this.sha256(acctName));
   },
 
   /**
    * Given a string, returns the SHA265 hash in base64
    */
   sha256(str) {
     let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
                       .createInstance(Ci.nsIScriptableUnicodeConverter);
--- a/toolkit/components/exthelper/extApplication.js
+++ b/toolkit/components/exthelper/extApplication.js
@@ -262,17 +262,17 @@ PreferenceBranch.prototype = {
     return this.has(aName) ? new Preference(aName, this) : null;
   },
 
   getValue: function prefs_gv(aName, aValue) {
     var type = this._prefs.getPrefType(aName);
 
     switch (type) {
       case Ci.nsIPrefBranch.PREF_STRING:
-        aValue = this._prefs.getComplexValue(aName, Ci.nsISupportsString).data;
+        aValue = this._prefs.getStringPref(aName);
         break;
       case Ci.nsIPrefBranch.PREF_BOOL:
         aValue = this._prefs.getBoolPref(aName);
         break;
       case Ci.nsIPrefBranch.PREF_INT:
         aValue = this._prefs.getIntPref(aName);
         break;
     }
--- a/toolkit/components/passwordmgr/LoginManagerParent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm
@@ -44,17 +44,17 @@ var LoginManagerParent = {
     mm.addMessageListener("RemoteLogins:onFormSubmit", this);
     mm.addMessageListener("RemoteLogins:autoCompleteLogins", this);
     mm.addMessageListener("RemoteLogins:removeLogin", this);
     mm.addMessageListener("RemoteLogins:insecureLoginFormPresent", this);
 
     XPCOMUtils.defineLazyGetter(this, "recipeParentPromise", () => {
       const { LoginRecipesParent } = Cu.import("resource://gre/modules/LoginRecipes.jsm", {});
       this._recipeManager = new LoginRecipesParent({
-        defaults: Services.prefs.getComplexValue("signon.recipes.path", Ci.nsISupportsString).data,
+        defaults: Services.prefs.getStringPref("signon.recipes.path"),
       });
       return this._recipeManager.initializationPromise;
     });
   },
 
   receiveMessage(msg) {
     let data = msg.data;
     switch (msg.name) {
--- a/toolkit/components/urlformatter/nsURLFormatter.js
+++ b/toolkit/components/urlformatter/nsURLFormatter.js
@@ -135,17 +135,17 @@ nsURLFormatterService.prototype = {
   },
 
   formatURLPref: function uf_formatURLPref(aPref) {
     var format = null;
     var PS = Cc['@mozilla.org/preferences-service;1'].
              getService(Ci.nsIPrefBranch);
 
     try {
-      format = PS.getComplexValue(aPref, Ci.nsISupportsString).data;
+      format = PS.getStringPref(aPref);
     } catch(ex) {
       Cu.reportError("formatURLPref: Couldn't get pref: " + aPref);
       return "about:blank";
     }
 
     if (!PS.prefHasUserValue(aPref) &&
         /^(data:text\/plain,.+=.+|chrome:\/\/.+\/locale\/.+\.properties)$/.test(format)) {
       // This looks as if it might be a localised preference
--- a/toolkit/components/urlformatter/tests/unit/test_urlformatter.js
+++ b/toolkit/components/urlformatter/tests/unit/test_urlformatter.js
@@ -41,20 +41,17 @@ function run_test() {
   var multiUrl = "http://%VENDOR%.%VENDOR%.%NAME%.%VENDOR%.%NAME%";
   var multiUrlRef = "http://Mozilla.Mozilla.Url Formatter Test.Mozilla.Url Formatter Test";
   var encodedUrl = "https://%LOCALE%.%VENDOR%.foo/?q=%E3%82%BF%E3%83%96&app=%NAME%&ver=%PLATFORMVERSION%";
   var encodedUrlRef = "https://" + locale + ".Mozilla.foo/?q=%E3%82%BF%E3%83%96&app=Url Formatter Test&ver=2.0";
   var advancedUrl = "http://test.mozilla.com/%NAME%/%VERSION%/%APPBUILDID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/";
   var advancedUrlRef = "http://test.mozilla.com/Url Formatter Test/1/" + gAppInfo.appBuildID + "/XPCShell_" + abi + "/" + locale + "/" + channel + "/" + OSVersion + "/bacon/1.0/";
 
   var pref = "xpcshell.urlformatter.test";
-  var str = Cc["@mozilla.org/supports-string;1"].
-            createInstance(Ci.nsISupportsString);
-  str.data = upperUrlRaw;
-  prefs.setComplexValue(pref, Ci.nsISupportsString, str);
+  prefs.setStringPref(pref, upperUrlRaw);
 
   do_check_eq(formatter.formatURL(upperUrlRaw), ulUrlRef);
   do_check_eq(formatter.formatURLPref(pref), ulUrlRef);
   // Keys must be uppercase
   do_check_neq(formatter.formatURL(lowerUrlRaw), ulUrlRef);
   do_check_eq(formatter.formatURL(multiUrl), multiUrlRef);
   // Encoded strings must be kept as is (Bug 427304)
   do_check_eq(formatter.formatURL(encodedUrl), encodedUrlRef);
--- a/toolkit/components/viewconfig/content/config.js
+++ b/toolkit/components/viewconfig/content/config.js
@@ -290,17 +290,17 @@ function fetchPref(prefName, prefIndex) 
         break;
       case gPrefBranch.PREF_INT:
         pref.typeCol = gPrefBranch.PREF_INT;
         // convert to a string
         pref.valueCol = gPrefBranch.getIntPref(prefName).toString();
         break;
       default:
       case gPrefBranch.PREF_STRING:
-        pref.valueCol = gPrefBranch.getComplexValue(prefName, nsISupportsString).data;
+        pref.valueCol = gPrefBranch.getStringPref(prefName);
         // Try in case it's a localized string (will throw an exception if not)
         if (pref.lockCol == PREF_IS_DEFAULT_VALUE &&
             /^chrome:\/\/.+\/locale\/.+\.properties/.test(pref.valueCol))
           pref.valueCol = gPrefBranch.getComplexValue(prefName, nsIPrefLocalizedString).data;
         break;
     }
   } catch (e) {
     // Also catch obscure cases in which you can't tell in advance
@@ -588,17 +588,15 @@ function ModifyPref(entry) {
       if (val != result.value - 0) {
         var err_title = gConfigBundle.getString("nan_title");
         var err_text = gConfigBundle.getString("nan_text");
         Services.prompt.alert(window, err_title, err_text);
         return false;
       }
       gPrefBranch.setIntPref(entry.prefCol, val);
     } else {
-      var supportsString = Components.classes[nsSupportsString_CONTRACTID].createInstance(nsISupportsString);
-      supportsString.data = result.value;
-      gPrefBranch.setComplexValue(entry.prefCol, nsISupportsString, supportsString);
+      gPrefBranch.setStringPref(entry.prefCol, result.value);
     }
   }
 
   Services.prefs.savePrefFile(null);
   return true;
 }
--- a/toolkit/content/widgets/preferences.xml
+++ b/toolkit/content/widgets/preferences.xml
@@ -332,23 +332,19 @@
               var val = this._branch.getBoolPref(this.name);
               return this.inverted ? !val : val;
             case "wstring":
               return this._branch
                          .getComplexValue(this.name, Components.interfaces.nsIPrefLocalizedString)
                          .data;
             case "string":
             case "unichar":
-              return this._branch
-                         .getComplexValue(this.name, Components.interfaces.nsISupportsString)
-                         .data;
+              return this._branch.getStringPref(this.name);
             case "fontname":
-              var family = this._branch
-                               .getComplexValue(this.name, Components.interfaces.nsISupportsString)
-                               .data;
+              var family = this._branch.getStringPref(this.name);
               var fontEnumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
                                              .createInstance(Components.interfaces.nsIFontEnumerator);
               return fontEnumerator.getStandardFamilyName(family);
             case "file":
               var f = this._branch
                           .getComplexValue(this.name, Components.interfaces.nsILocalFile);
               return f;
             default:
--- a/toolkit/modules/CharsetMenu.jsm
+++ b/toolkit/modules/CharsetMenu.jsm
@@ -98,19 +98,18 @@ function CharsetComparator(a, b) {
   let titleA = a.label.replace(/\(.*/, "") + b.value;
   let titleB = b.label.replace(/\(.*/, "") + a.value;
   // Secondarily reverse sort by encoding name to sort "windows" or
   // "shift_jis" first.
   return titleA.localeCompare(titleB) || b.value.localeCompare(a.value);
 }
 
 function SetDetector(event) {
-  let str = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
-  str.data = event.target.getAttribute("detector");
-  Services.prefs.setComplexValue("intl.charset.detector", Ci.nsISupportsString, str);
+  Services.prefs.setStringPref("intl.charset.detector",
+                               event.target.getAttribute("detector"));
 }
 
 function UpdateDetectorMenu(event) {
   event.stopPropagation();
   let detector = Services.prefs.getComplexValue("intl.charset.detector", Ci.nsIPrefLocalizedString);
   let menuitem = this.getElementsByAttribute("detector", detector).item(0);
   if (menuitem) {
     menuitem.setAttribute("checked", "true");
--- a/toolkit/modules/NewTabUtils.jsm
+++ b/toolkit/modules/NewTabUtils.jsm
@@ -139,35 +139,30 @@ LinksStorage.prototype = {
    * Gets the value for a given key from the storage.
    * @param aKey The storage key (a string).
    * @param aDefault A default value if the key doesn't exist.
    * @return The value for the given key.
    */
   get: function Storage_get(aKey, aDefault) {
     let value;
     try {
-      let prefValue = Services.prefs.getComplexValue(this._prefs[aKey],
-                                                     Ci.nsISupportsString).data;
+      let prefValue = Services.prefs.getStringPref(this._prefs[aKey]);
       value = JSON.parse(prefValue);
     } catch (e) {}
     return value || aDefault;
   },
 
   /**
    * Sets the storage value for a given key.
    * @param aKey The storage key (a string).
    * @param aValue The value to set.
    */
   set: function Storage_set(aKey, aValue) {
     // Page titles may contain unicode, thus use complex values.
-    let string = Cc["@mozilla.org/supports-string;1"]
-                   .createInstance(Ci.nsISupportsString);
-    string.data = JSON.stringify(aValue);
-    Services.prefs.setComplexValue(this._prefs[aKey], Ci.nsISupportsString,
-                                   string);
+    Services.prefs.setStringPref(this._prefs[aKey], JSON.stringify(aValue));
   },
 
   /**
    * Removes the storage value for a given key.
    * @param aKey The storage key (a string).
    */
   remove: function Storage_remove(aKey) {
     Services.prefs.clearUserPref(this._prefs[aKey]);
--- a/toolkit/modules/Preferences.jsm
+++ b/toolkit/modules/Preferences.jsm
@@ -111,20 +111,17 @@ Preferences.set = function(prefName, pre
 Preferences._set = function(prefName, prefValue) {
   let prefType;
   if (typeof prefValue != "undefined" && prefValue != null)
     prefType = prefValue.constructor.name;
 
   switch (prefType) {
     case "String":
       {
-        let str = Cc["@mozilla.org/supports-string;1"].
-                     createInstance(Ci.nsISupportsString);
-        str.data = prefValue;
-        this._prefBranch.setComplexValue(prefName, Ci.nsISupportsString, str);
+        this._prefBranch.setStringPref(prefName, prefValue);
       }
       break;
 
     case "Number":
       // We throw if the number is outside the range, since the result
       // will never be what the consumer wanted to store, but we only warn
       // if the number is non-integer, since the consumer might not mind
       // the loss of precision.
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -106,17 +106,17 @@ const PREFS_BLACKLIST = [
   /[.]print_to_filename$/,
   /^print[.]macosx[.]pagesetup/,
 ];
 
 // Table of getters for various preference types.
 // It's important to use getComplexValue for strings: it returns Unicode (wchars), getCharPref returns UTF-8 encoded chars.
 const PREFS_GETTERS = {};
 
-PREFS_GETTERS[Ci.nsIPrefBranch.PREF_STRING] = (prefs, name) => prefs.getComplexValue(name, Ci.nsISupportsString).data;
+PREFS_GETTERS[Ci.nsIPrefBranch.PREF_STRING] = (prefs, name) => prefs.getStringPref(name);
 PREFS_GETTERS[Ci.nsIPrefBranch.PREF_INT] = (prefs, name) => prefs.getIntPref(name);
 PREFS_GETTERS[Ci.nsIPrefBranch.PREF_BOOL] = (prefs, name) => prefs.getBoolPref(name);
 
 // Return the preferences filtered by PREFS_BLACKLIST and PREFS_WHITELIST lists
 // and also by the custom 'filter'-ing function.
 function getPrefList(filter) {
   filter = filter || (name => true);
   function getPref(name) {
--- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm
+++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm
@@ -79,18 +79,17 @@ var _fallbackThemeData = null;
 // to the new one (where a selectedThemeID determines which theme is selected).
 (function() {
   let wasThemeSelected = _prefs.getBoolPref("isThemeSelected", false);
 
   if (wasThemeSelected) {
     _prefs.clearUserPref("isThemeSelected");
     let themes = [];
     try {
-      themes = JSON.parse(_prefs.getComplexValue("usedThemes",
-                                                 Ci.nsISupportsString).data);
+      themes = JSON.parse(_prefs.getStringPref("usedThemes"));
     } catch (e) { }
 
     if (Array.isArray(themes) && themes[0]) {
       _prefs.setCharPref("selectedThemeID", themes[0].id);
     }
   }
 })();
 
@@ -114,18 +113,17 @@ this.LightweightThemeManager = {
 
   // Themes that can be added for an application.  They can't be removed, and
   // will always show up at the top of the list.
   _builtInThemes: new Map(),
 
   get usedThemes() {
     let themes = [];
     try {
-      themes = JSON.parse(_prefs.getComplexValue("usedThemes",
-                                                 Ci.nsISupportsString).data);
+      themes = JSON.parse(_prefs.getStringPref("usedThemes"));
     } catch (e) { }
 
     themes.push(...this._builtInThemes.values());
     return themes;
   },
 
   get currentTheme() {
     let selectedThemeID = _prefs.getCharPref("selectedThemeID", "");
@@ -779,20 +777,17 @@ function _updateUsedThemes(aList) {
   // Send uninstall events for all themes that need to be removed.
   while (aList.length > _maxUsedThemes) {
     let wrapper = new AddonWrapper(aList[aList.length - 1]);
     AddonManagerPrivate.callAddonListeners("onUninstalling", wrapper, false);
     aList.pop();
     AddonManagerPrivate.callAddonListeners("onUninstalled", wrapper);
   }
 
-  var str = Cc["@mozilla.org/supports-string;1"]
-              .createInstance(Ci.nsISupportsString);
-  str.data = JSON.stringify(aList);
-  _prefs.setComplexValue("usedThemes", Ci.nsISupportsString, str);
+  _prefs.setStringPref("usedThemes", JSON.stringify(aList));
 
   Services.obs.notifyObservers(null, "lightweight-theme-list-changed", null);
 }
 
 function _notifyWindows(aThemeData) {
   Services.obs.notifyObservers(null, "lightweight-theme-styling-update",
                                JSON.stringify(aThemeData));
 }