Bug 1415567 - Port bug 1414096 to TB: Remove {get,set}ComplexValue use of nsISupportsString (script-generated patch). r=jorgk
☠☠ backed out by 497ee9e16aff ☠ ☠
authorFlorian Queze <florian@queze.net>
Wed, 08 Nov 2017 16:11:03 +0100
changeset 29337 2bfef5c6f2a706f63de9cf896ac2d8527a475a53
parent 29336 5dc16fe2582172193e66089144fe4a7a4b16491e
child 29338 48e041d4c81b126540eb255ad6b4a5ccce86feb1
push id2068
push userclokep@gmail.com
push dateMon, 13 Nov 2017 19:02:14 +0000
treeherdercomm-beta@9c7e7ce8672b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs1415567, 1414096
Bug 1415567 - Port bug 1414096 to TB: Remove {get,set}ComplexValue use of nsISupportsString (script-generated patch). r=jorgk
chat/components/src/imAccounts.js
chat/components/src/imCore.js
chat/modules/jsProtoHelper.jsm
chat/protocols/xmpp/xmpp.jsm
editor/ui/composer/content/editor.js
editor/ui/composer/content/editorUtilities.js
editor/ui/composer/content/publishprefs.js
im/content/account.js
im/content/joinchat.js
mail/components/compose/content/MsgComposeCommands.js
mail/components/im/content/joinchat.js
mail/components/im/imIncomingServer.js
mail/components/preferences/attachmentReminder.js
mailnews/extensions/smime/content/certFetchingStatus.js
suite/browser/nsBrowserContentHandler.js
suite/common/utilityOverlay.js
suite/feeds/src/FeedWriter.js
suite/feeds/src/WebContentConverter.js
suite/modules/test/unit/test_browser_sanitizer.js
--- a/chat/components/src/imAccounts.js
+++ b/chat/components/src/imAccounts.js
@@ -124,27 +124,22 @@ function imAccount(aKey, aName, aPrplId)
 
   this.id = aKey;
   this.numericId = parseInt(aKey.substr(kAccountKeyPrefix.length));
   gAccountsService._keepAccount(this);
   this.prefBranch = Services.prefs.getBranch(kPrefAccountPrefix + aKey + ".");
 
   if (aName) {
     this.name = aName;
-    let str = Cc["@mozilla.org/supports-string;1"]
-              .createInstance(Ci.nsISupportsString);
-    str.data = aName;
-    this.prefBranch.setComplexValue(kPrefAccountName, Ci.nsISupportsString,
-                                    str);
+    this.prefBranch.setStringPref(kPrefAccountName, aName);
 
     this.firstConnectionState = Ci.imIAccount.FIRST_CONNECTION_UNKNOWN;
   }
   else {
-    this.name = this.prefBranch.getComplexValue(kPrefAccountName,
-                                                Ci.nsISupportsString).data;
+    this.name = this.prefBranch.getStringPref(kPrefAccountName);
   }
 
   let prplId = aPrplId;
   if (prplId)
     this.prefBranch.setCharPref(kPrefAccountPrpl, prplId);
   else
     prplId = this.prefBranch.getCharPref(kPrefAccountPrpl);
 
@@ -171,18 +166,17 @@ function imAccount(aKey, aName, aPrplId)
     this.firstConnectionState = Ci.imIAccount.FIRST_CONNECTION_CRASHED;
 
   Services.logins.initializationPromise.then(() => {
     // Try to convert old passwords stored in the preferences.
     // Don't try too hard if the user has canceled a master password prompt:
     // we don't want to display several of theses prompts at startup.
     if (gConvertingOldPasswords && !this.protocol.noPassword) {
       try {
-        let password = this.prefBranch.getComplexValue(kPrefAccountPassword,
-                                                       Ci.nsISupportsString).data;
+        let password = this.prefBranch.getStringPref(kPrefAccountPassword);
         if (password && !this.password)
           this.password = password;
       } catch (e) { /* No password saved in the prefs for this account. */ }
     }
 
     // Check for errors that should prevent connection attempts.
     if (this._passwordRequired && !this.password)
       this._connectionErrorReason = Ci.imIAccount.ERROR_MISSING_PASSWORD;
@@ -233,18 +227,17 @@ imAccount.prototype = {
       this._finishedAutoLogin();
       this.timeOfLastConnect = Date.now();
       if (this.firstConnectionState != Ci.imIAccount.FIRST_CONNECTION_OK)
         this.firstConnectionState = Ci.imIAccount.FIRST_CONNECTION_OK;
       delete this.connectionStateMsg;
 
       if (this.canJoinChat &&
           this.prefBranch.prefHasUserValue(kPrefAccountAutoJoin)) {
-        let autojoin = this.prefBranch.getComplexValue(
-          kPrefAccountAutoJoin, Ci.nsISupportsString).data;
+        let autojoin = this.prefBranch.getStringPref(kPrefAccountAutoJoin);
         if (autojoin) {
           for (let room of autojoin.trim().split(/,\s*/)) {
             if (room)
               this.joinChat(this.getChatRoomDefaultFieldValues(room));
           }
         }
       }
     }
@@ -475,30 +468,25 @@ imAccount.prototype = {
   },
 
   _sendUpdateNotification: function() {
     this._sendNotification("account-updated");
   },
 
   set alias(val) {
     if (val) {
-      let str = Cc["@mozilla.org/supports-string;1"]
-                .createInstance(Ci.nsISupportsString);
-      str.data = val;
-      this.prefBranch.setComplexValue(kPrefAccountAlias, Ci.nsISupportsString,
-                                      str);
+      this.prefBranch.setStringPref(kPrefAccountAlias, val);
     }
     else
       this.prefBranch.deleteBranch(kPrefAccountAlias);
     this._sendUpdateNotification();
   },
   get alias() {
     try {
-      return this.prefBranch.getComplexValue(kPrefAccountAlias,
-                                             Ci.nsISupportsString).data;
+      return this.prefBranch.getStringPref(kPrefAccountAlias);
     } catch (e) {
       return "";
     }
   },
 
   _password: "",
   get password() {
     if (this._password)
@@ -798,21 +786,17 @@ imAccount.prototype = {
   setInt: function(aName, aVal) {
     this.prefBranch.setIntPref(kAccountOptionPrefPrefix + aName, aVal);
     this._connectionInfoChanged();
     if (this.prplAccount)
       this.prplAccount.setInt(aName, aVal);
     SavePrefTimer.initTimer();
   },
   setString: function(aName, aVal) {
-    let str = Cc["@mozilla.org/supports-string;1"]
-              .createInstance(Ci.nsISupportsString);
-    str.data = aVal;
-    this.prefBranch.setComplexValue(kAccountOptionPrefPrefix + aName,
-                                    Ci.nsISupportsString, str);
+    this.prefBranch.setStringPref(kAccountOptionPrefPrefix + aName, aVal);
     this._connectionInfoChanged();
     if (this.prplAccount)
       this.prplAccount.setString(aName, aVal);
     SavePrefTimer.initTimer();
   },
   save: function() { SavePrefTimer.saveNow(); },
 
   get HTMLEnabled() { return this._ensurePrplAccount.HTMLEnabled; },
--- a/chat/components/src/imCore.js
+++ b/chat/components/src/imCore.js
@@ -209,25 +209,20 @@ UserStatus.prototype = {
       Services.console.logStringMessage("Invalid userIconFileName preference");
       return null;
     }
 
     return Services.io.newFileURI(file);
   },
 
   get displayName() {
-    return Services.prefs.getComplexValue(kPrefUserDisplayname,
-                                          Ci.nsISupportsString).data;
+    return Services.prefs.getStringPref(kPrefUserDisplayname);
   },
   set displayName(aDisplayName) {
-    let str = Cc["@mozilla.org/supports-string;1"]
-              .createInstance(Ci.nsISupportsString);
-    str.data = aDisplayName;
-    Services.prefs.setComplexValue(kPrefUserDisplayname, Ci.nsISupportsString,
-                                   str);
+    Services.prefs.setStringPref(kPrefUserDisplayname, aDisplayName);
     this._notifyObservers("user-display-name-changed", aDisplayName);
   },
 
   addObserver: function(aObserver) {
     if (!this._observers.includes(aObserver))
       this._observers.push(aObserver);
   },
   removeObserver: function(aObserver) {
--- a/chat/modules/jsProtoHelper.jsm
+++ b/chat/modules/jsProtoHelper.jsm
@@ -214,17 +214,17 @@ var GenericAccountPrototype = {
     return this.prefs.prefHasUserValue(aName) ?
            this.prefs["get" + aType + "Pref"](aName) :
            this.protocol._getOptionDefault(aName);
   },
   getInt: function(aName) { return this.getPref(aName, "Int"); },
   getBool: function(aName) { return this.getPref(aName, "Bool"); },
   getString: function(aName) {
     return this.prefs.prefHasUserValue(aName) ?
-             this.prefs.getComplexValue(aName, Ci.nsISupportsString).data :
+             this.prefs.getStringPref(aName) :
              this.protocol._getOptionDefault(aName);
   },
 
   get prefs() {
     return this._prefs ||
            (this._prefs = Services.prefs.getBranch("messenger.account." +
                                                    this.imAccount.id + ".options."));
   },
--- a/chat/protocols/xmpp/xmpp.jsm
+++ b/chat/protocols/xmpp/xmpp.jsm
@@ -1317,20 +1317,17 @@ var XMPPAccountPrototype = {
       // because while connected it's the jid of the session that's
       // interesting.
       this._jid = this._setJID(this._jid.domain, this._jid.node, resource);
     }
     else if (this._jid.resource) {
       // If there is a resource in the account name (inherited from libpurple),
       // migrate it to the pref so it appears correctly in the advanced account
       // options next time.
-      let str = Cc["@mozilla.org/supports-string;1"]
-                  .createInstance(Ci.nsISupportsString);
-      str.data = this._jid.resource;
-      this.prefs.setComplexValue("resource", Ci.nsISupportsString, str);
+      this.prefs.setStringPref("resource", this._jid.resource);
     }
 
     this._connection =
       new XMPPSession(this.getString("server") || this._jid.domain,
                       this.getInt("port") || 5222,
                       this.getString("connection_security"), this._jid,
                       this.imAccount.password, this);
   },
--- a/editor/ui/composer/content/editor.js
+++ b/editor/ui/composer/content/editor.js
@@ -2320,18 +2320,17 @@ function EditorSetDefaultPrefsAndDoctype
       editor.documentCharacterSet = prefCharsetString;
 
     // let's start by assuming we have an author in case we don't have the pref
 
     var prefAuthorString = null;
     let authorFound = domdoc.querySelector('meta[name="author"]');
     try
     {
-      prefAuthorString = Services.prefs.getComplexValue("editor.author",
-                                                        Components.interfaces.nsISupportsString).data;
+      prefAuthorString = Services.prefs.getStringPref("editor.author");
     }
     catch (ex) {}
     if (prefAuthorString && prefAuthorString != 0 && !authorFound && headelement)
     {
       // create meta tag with 2 attributes
       element = domdoc.createElement("meta");
       if (element)
       {
--- a/editor/ui/composer/content/editorUtilities.js
+++ b/editor/ui/composer/content/editorUtilities.js
@@ -390,28 +390,25 @@ function GetFileProtocolHandler()
 {
   let handler = Services.io.getProtocolHandler("file");
   return handler.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
 }
 
 function GetStringPref(name)
 {
   try {
-    return Services.prefs.getComplexValue(name, Components.interfaces.nsISupportsString).data;
+    return Services.prefs.getStringPref(name);
   } catch (e) {}
   return "";
 }
 
 function SetStringPref(aPrefName, aPrefValue)
 {
   try {
-    let str = Components.classes["@mozilla.org/supports-string;1"]
-                        .createInstance(Components.interfaces.nsISupportsString);
-    str.data = aPrefValue;
-    Services.prefs.setComplexValue(aPrefName, Components.interfaces.nsISupportsString, str);
+    Services.prefs.setStringPref(aPrefName, aPrefValue);
   }
   catch(e) {}
 }
 
 // Set initial directory for a filepicker from URLs saved in prefs
 function SetFilePickerDirectory(filePicker, fileType)
 {
   if (filePicker)
--- a/editor/ui/composer/content/publishprefs.js
+++ b/editor/ui/composer/content/publishprefs.js
@@ -718,31 +718,28 @@ function FillInMatchingPublishData(publi
 
 // Prefs that don't exist will through an exception,
 //  so just return an empty string
 function GetPublishStringPref(prefBranch, name)
 {
   if (prefBranch && name)
   {
     try {
-      return prefBranch.getComplexValue(name, Components.interfaces.nsISupportsString).data;
+      return prefBranch.getStringPref(name);
     } catch (e) {}
   }
   return "";
 }
 
 function SetPublishStringPref(prefBranch, name, value)
 {
   if (prefBranch && name)
   {
     try {
-        var str = Components.classes["@mozilla.org/supports-string;1"]
-                            .createInstance(Components.interfaces.nsISupportsString);
-        str.data = value;
-        prefBranch.setComplexValue(name, Components.interfaces.nsISupportsString, str);
+        prefBranch.setStringPref(name, value);
     } catch (e) {}
   }
 }
 
 // Assure that a publishing URL ends in "/", "=", "&" or "?"
 // Username and password should always be extracted as separate fields
 //  and are not allowed to remain embedded in publishing URL
 function FormatUrlForPublishing(url)
--- a/im/content/account.js
+++ b/im/content/account.js
@@ -34,17 +34,17 @@ var account = {
     if (protoId == "prpl-irc" || protoId == "prpl-jabber" ||
         protoId == "prpl-gtalk") {
       document.getElementById("optionalSeparator").hidden = false;
       document.getElementById("autojoinBox").hidden = false;
       var branch = Services.prefs.getBranch("messenger.account." +
                                             this.account.id + ".");
       if (branch.prefHasUserValue(autoJoinPref)) {
         document.getElementById("autojoin").value =
-          branch.getComplexValue(autoJoinPref, Ci.nsISupportsString).data;
+          branch.getStringPref(autoJoinPref);
       }
     }
 
 /* FIXME
     document.getElementById("newMailNotification").hidden =
       !this.proto.newMailNotification;
 */
 
@@ -126,17 +126,17 @@ var account = {
     if (this.prefs.prefHasUserValue(aOpt.name))
       return this.prefs.getIntPref(aOpt.name);
 
     return aOpt.getInt();
   },
 
   getString: function account_getString(aOpt) {
     if (this.prefs.prefHasUserValue(aOpt.name))
-      return this.prefs.getComplexValue(aOpt.name, Ci.nsISupportsString).data;
+      return this.prefs.getStringPref(aOpt.name);
 
     return aOpt.getString();
   },
 
   getListValue: function account_getListValue(aOpt) {
     if (this.prefs.prefHasUserValue(aOpt.name))
       return this.prefs.getCharPref(aOpt.name);
 
@@ -171,20 +171,17 @@ var account = {
 
     let protoId = this.proto.id;
     if (protoId == "prpl-irc" || protoId == "prpl-jabber" ||
         protoId == "prpl-gtalk") {
       var branch = Services.prefs.getBranch("messenger.account." +
                                             this.account.id + ".");
       var autojoin = this.getValue("autojoin");
       if (autojoin || branch.prefHasUserValue(autoJoinPref)) {
-        let str = Cc["@mozilla.org/supports-string;1"]
-                    .createInstance(Ci.nsISupportsString);
-        str.data = autojoin;
-        branch.setComplexValue(autoJoinPref, Ci.nsISupportsString, str);
+        branch.setStringPref(autoJoinPref, autojoin);
       }
     }
 
     if (this.proto.usePurpleProxy &&
         this.account.proxyInfo.key != this.proxy.key)
       this.account.proxyInfo = this.proxy;
 
     for (let opt of this.getProtoOptions()) {
--- a/im/content/joinchat.js
+++ b/im/content/joinchat.js
@@ -125,25 +125,22 @@ var joinChat = {
       if (nick)
         name += "/" + nick;
 
       let prefBranch =
         Services.prefs.getBranch("messenger.account." + account.id + ".");
       let autojoin = [];
       if (prefBranch.prefHasUserValue(autoJoinPref)) {
         let prefValue =
-          prefBranch.getComplexValue(autoJoinPref, Ci.nsISupportsString).data;
+          prefBranch.getStringPref(autoJoinPref);
         if (prefValue)
           autojoin = prefValue.split(",");
       }
 
       if (!autojoin.includes(name)) {
         autojoin.push(name);
-        let str = Cc["@mozilla.org/supports-string;1"]
-                    .createInstance(Ci.nsISupportsString);
-        str.data = autojoin.join(",");
-        prefBranch.setComplexValue(autoJoinPref, Ci.nsISupportsString, str);
+        prefBranch.setStringPref(autoJoinPref, autojoin.join(","));
       }
     }
 
     return true;
   }
 };
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -5655,18 +5655,17 @@ function enableInlineSpellCheck(aEnableI
 function getMailToolbox()
 {
   return document.getElementById("compose-toolbox");
 }
 
 function getPref(aPrefName, aIsComplex) {
   const Ci = Components.interfaces;
   if (aIsComplex) {
-    return Services.prefs
-                   .getComplexValue(aPrefName, Ci.nsISupportsString).data;
+    return Services.prefs.getStringPref(aPrefName);
   }
   switch (Services.prefs.getPrefType(aPrefName)) {
     case Ci.nsIPrefBranch.PREF_BOOL:
       return Services.prefs.getBoolPref(aPrefName);
     case Ci.nsIPrefBranch.PREF_INT:
       return Services.prefs.getIntPref(aPrefName);
     case Ci.nsIPrefBranch.PREF_STRING:
       return Services.prefs.getCharPref(aPrefName);
--- a/mail/components/im/content/joinchat.js
+++ b/mail/components/im/content/joinchat.js
@@ -134,25 +134,22 @@ var joinChat = {
       if (nick)
         name += "/" + nick;
 
       let prefBranch =
         Services.prefs.getBranch("messenger.account." + account.id + ".");
       let autojoin = [];
       if (prefBranch.prefHasUserValue(autoJoinPref)) {
         let prefValue =
-          prefBranch.getComplexValue(autoJoinPref, Ci.nsISupportsString).data;
+          prefBranch.getStringPref(autoJoinPref);
         if (prefValue)
           autojoin = prefValue.split(",");
       }
 
       if (!autojoin.includes(name)) {
         autojoin.push(name);
-        let str = Cc["@mozilla.org/supports-string;1"]
-                    .createInstance(Ci.nsISupportsString);
-        str.data = autojoin.join(",");
-        prefBranch.setComplexValue(autoJoinPref, Ci.nsISupportsString, str);
+        prefBranch.setStringPref(autoJoinPref, autojoin.join(","));
       }
     }
 
     return true;
   }
 };
--- a/mail/components/im/imIncomingServer.js
+++ b/mail/components/im/imIncomingServer.js
@@ -95,27 +95,24 @@ imIncomingServer.prototype = {
   },
   get alias() { return this.imAccount.alias; },
   set alias(aAlias) {
     this.imAccount.alias = aAlias;
   },
   get autojoin() {
     try {
       let prefName = "messenger.account." + this.imAccount.id + ".autoJoin";
-      return Services.prefs.getComplexValue(prefName, Ci.nsISupportsString).data;
+      return Services.prefs.getStringPref(prefName);
     } catch (e) {
       return "";
     }
   },
   set autojoin(aAutoJoin) {
     let prefName = "messenger.account." + this.imAccount.id + ".autoJoin";
-    let str = Cc["@mozilla.org/supports-string;1"]
-                .createInstance(Ci.nsISupportsString);
-    str.data = aAutoJoin;
-    Services.prefs.setComplexValue(prefName, Ci.nsISupportsString, str);
+    Services.prefs.setStringPref(prefName, aAutoJoin);
   },
 
   // This is used for user-visible advanced preferences.
   setUnicharValue: function(aPrefName, aValue) {
     if (aPrefName == "autojoin")
       this.autojoin = aValue;
     else if (aPrefName == "alias")
       this.alias = aValue;
@@ -130,18 +127,17 @@ imIncomingServer.prototype = {
     if (aPrefName == "alias")
       return this.alias;
     if (aPrefName == "password")
       return this.password;
 
     try {
       let prefName =
         "messenger.account." + this.imAccount.id + ".options." + aPrefName;
-      return Services.prefs.getComplexValue(prefName,
-                                            Ci.nsISupportsString).data;
+      return Services.prefs.getStringPref(prefName);
     } catch (x) {
       return this._getDefault(aPrefName);
     }
   },
   setBoolValue: function(aPrefName, aValue) {
     this.imAccount.setBool(aPrefName, aValue);
   },
   getBoolValue: function(aPrefName) {
--- a/mail/components/preferences/attachmentReminder.js
+++ b/mail/components/preferences/attachmentReminder.js
@@ -72,15 +72,12 @@ var gAttachmentReminderOptionsDialog = {
   {
     var keywordList = "";
     for (var i = 0; i < this.keywordListBox.getRowCount(); i++) {
       keywordList += this.keywordListBox.getItemAtIndex(i).getAttribute("value");
       if (i != this.keywordListBox.getRowCount() - 1)
         keywordList += ",";
     }
 
-    var str = Components.classes["@mozilla.org/supports-string;1"]
-                        .createInstance(Components.interfaces.nsISupportsString);
-    str.data = keywordList;
-    Services.prefs.setComplexValue("mail.compose.attachment_reminder_keywords",
-                                   Components.interfaces.nsISupportsString, str);
+    Services.prefs.setStringPref("mail.compose.attachment_reminder_keywords",
+                                 keywordList);
   }
 };
--- a/mailnews/extensions/smime/content/certFetchingStatus.js
+++ b/mailnews/extensions/smime/content/certFetchingStatus.js
@@ -40,17 +40,17 @@ function onLoad()
 
   setTimeout(search, 1);
 }
 
 function search()
 {
   // get the login to authenticate as, if there is one
   try {
-    gLogin = Services.prefs.getComplexValue(gDirectoryPref + ".auth.dn", Components.interfaces.nsISupportsString).data;
+    gLogin = Services.prefs.getStringPref(gDirectoryPref + ".auth.dn");
   } catch (ex) {
     // if we don't have this pref, no big deal
   }
 
   try {
     let url = Services.prefs.getCharPref(gDirectoryPref + ".uri");
 
     gLdapServerURL = Services.io
--- a/suite/browser/nsBrowserContentHandler.js
+++ b/suite/browser/nsBrowserContentHandler.js
@@ -81,18 +81,17 @@ function getHomePageGroup()
   var count = 0;
   try {
     count = Services.prefs.getIntPref("browser.startup.homepage.count");
   } catch (e) {
   }
 
   for (var i = 1; i < count; ++i) {
     try {
-      homePage += '\n' + Services.prefs.getComplexValue("browser.startup.homepage." + i,
-                                                        nsISupportsString).data;
+      homePage += '\n' + Services.prefs.getStringPref("browser.startup.homepage." + i);
     } catch (e) {
     }
   }
   return homePage;
 }
 
 function needHomePageOverride()
 {
@@ -146,18 +145,17 @@ function getURLToLoad()
   }
 
   try {
     switch (Services.prefs.getIntPref("browser.startup.page")) {
     case 1:
       return getHomePageGroup();
 
     case 2:
-      return Services.prefs.getComplexValue("browser.history.last_page_visited",
-                                            nsISupportsString).data;
+      return Services.prefs.getStringPref("browser.history.last_page_visited");
     }
   } catch (e) {
   }
 
   return "about:blank";
 }
 
 function openWindow(parent, url, features, arg)
--- a/suite/common/utilityOverlay.js
+++ b/suite/common/utilityOverlay.js
@@ -137,28 +137,24 @@ function setProxyTypeUI()
   var onlineTooltip = "onlineTooltip" + GetIntPref("network.proxy.type", 0);
   panel.setAttribute("tooltiptext", gUtilityBundle.getString(onlineTooltip));
 }
 
 function SetStringPref(aPref, aValue)
 {
   const nsISupportsString = Components.interfaces.nsISupportsString;
   try {
-    var str = Components.classes["@mozilla.org/supports-string;1"]
-                        .createInstance(nsISupportsString);
-    str.data = aValue;
-    Services.prefs.setComplexValue(aPref, nsISupportsString, str);
+    Services.prefs.setStringPref(aPref, aValue);
   } catch (e) {}
 }
 
 function GetStringPref(name)
 {
   try {
-    return Services.prefs.getComplexValue(name,
-               Components.interfaces.nsISupportsString).data;
+    return Services.prefs.getStringPref(name);
   } catch (e) {}
   return "";
 }
 
 function GetLocalizedStringPref(aPrefName, aDefaultValue)
 {
   try {
     return Services.prefs.getComplexValue(aPrefName,
--- a/suite/feeds/src/FeedWriter.js
+++ b/suite/feeds/src/FeedWriter.js
@@ -760,18 +760,17 @@ FeedWriter.prototype = {
   },
 
   _setSelectedHandler: function setSelectedHandler(feedType) {
     var handler = safeGetCharPref(getPrefReaderForType(feedType), "messenger");
 
     switch (handler) {
       case "web":
         if (this._handlersMenuList) {
-          var url = Services.prefs.getComplexValue(getPrefWebForType(feedType),
-                                                   Components.interfaces.nsISupportsString).data;
+          var url = Services.prefs.getStringPref(getPrefWebForType(feedType));
           var handlers = this._handlersMenuList.getElementsByAttribute("webhandlerurl", url);
           if (handlers.length == 0) {
             LOG("FeedWriter._setSelectedHandler: selected web handler isn't in the menulist");
             return;
           }
 
           handlers[0].doCommand();
         }
@@ -1114,21 +1113,17 @@ FeedWriter.prototype = {
 
       selectedItem = this._getSelectedItemFromMenulist(this._handlersMenuList);
     }
 
     if (selectedItem.hasAttribute("webhandlerurl")) {
       var webURI = selectedItem.getAttribute("webhandlerurl");
       Services.prefs.setCharPref(getPrefReaderForType(feedType), "web");
 
-      var supportsString = Components.classes["@mozilla.org/supports-string;1"]
-                                     .createInstance(Components.interfaces.nsISupportsString);
-      supportsString.data = webURI;
-      Services.prefs.setComplexValue(getPrefWebForType(feedType), Components.interfaces.nsISupportsString,
-                                     supportsString);
+      Services.prefs.setStringPref(getPrefWebForType(feedType), webURI);
 
       var wccr = Components.classes["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"]
                            .getService(Components.interfaces.nsIWebContentConverterService);
       var handler = wccr.getWebContentHandlerByURI(this._getMimeTypeForFeedType(feedType), webURI);
       if (handler) {
         if (useAsDefault)
           wccr.setAutoHandler(this._getMimeTypeForFeedType(feedType), handler);
 
--- a/suite/feeds/src/WebContentConverter.js
+++ b/suite/feeds/src/WebContentConverter.js
@@ -636,21 +636,17 @@ WebContentConverterRegistrar.prototype =
     this._updateContentTypeHandlerMap(contentType, uri, title);
     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
       Services.prefs.setCharPref(PREF_SELECTED_READER, "web");
 
-      var supportsString = Components.classes["@mozilla.org/supports-string;1"]
-                                     .createInstance(Components.interfaces.nsISupportsString);
-      supportsString.data = uri;
-      Services.prefs.setComplexValue(PREF_SELECTED_WEB, Components.interfaces.nsISupportsString,
-                                     supportsString);
+      Services.prefs.setStringPref(PREF_SELECTED_WEB, uri);
       Services.prefs.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/suite/modules/test/unit/test_browser_sanitizer.js
+++ b/suite/modules/test/unit/test_browser_sanitizer.js
@@ -119,27 +119,23 @@ var sanTests = {
                                    .openDatabase(file);
         connection.createTable("urlbarhistory", "url TEXT");
         connection.executeSimpleSQL(
           "INSERT INTO urlbarhistory (url) VALUES ('Sanitizer')");
         connection.close();
       }
 
       // Open location dialog.
-      var supStr = Components.classes["@mozilla.org/supports-string;1"]
-                             .createInstance(Components.interfaces.nsISupportsString);
-      supStr.data = "Sanitizer!";
-      Services.prefs.setComplexValue("general.open_location.last_url",
-                                      Components.interfaces.nsISupportsString, supStr);
+      Services.prefs.setStringPref("general.open_location.last_url", "Sanitizer!");
     },
 
     check: function(aShouldBeCleared) {
       let locData;
       try {
-        locData = Services.prefs.getComplexValue("general.open_location.last_url", Components.interfaces.nsISupportsString).data;
+        locData = Services.prefs.getStringPref("general.open_location.last_url");
       } catch(ex) {}
 
       do_check_eq(locData == "Sanitizer!", !aShouldBeCleared);
 
       var file = Components.classes["@mozilla.org/file/directory_service;1"]
                            .getService(Components.interfaces.nsIProperties)
                            .get("ProfD", Components.interfaces.nsIFile);
       file.append("urlbarhistory.sqlite");