Bug 675794 - about:config must trim whitespace from the name for a new alphanumeric; r=gavin.sharp f=margaret
authorFelix Fung <ffung@mozilla.com>
Tue, 20 Sep 2011 17:20:51 +0100
changeset 77201 028baeb2ca2125590df8cae87beabf91b25e2117
parent 77200 812cea5c372e80d75f983d6cd0138ac1ccd6706e
child 77202 ebbc50bbebeb2b3142efd9fbde0d0be0666008f9
push id21187
push usermak77@bonardo.net
push dateWed, 21 Sep 2011 08:36:41 +0000
treeherdermozilla-central@3178f1c42505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin.sharp
bugs675794
milestone9.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 675794 - about:config must trim whitespace from the name for a new alphanumeric; r=gavin.sharp f=margaret
toolkit/components/viewconfig/content/config.js
--- a/toolkit/components/viewconfig/content/config.js
+++ b/toolkit/components/viewconfig/content/config.js
@@ -602,17 +602,22 @@ function NewPref(type)
 {
   var result = { value: "" };
   var dummy = { value: 0 };
   if (gPromptService.prompt(window,
                             gConfigBundle.getFormattedString("new_title", [gTypeStrs[type]]),
                             gConfigBundle.getString("new_prompt"),
                             result,
                             null,
-                            dummy) && result.value) {
+                            dummy)) {
+    result.value = result.value.trim();
+    if (!result.value) {
+      return;
+    }
+
     var pref;
     if (result.value in gPrefHash)
       pref = gPrefHash[result.value];
     else
       pref = { prefCol: result.value, lockCol: PREF_IS_DEFAULT_VALUE, typeCol: type, valueCol: "" };
     if (ModifyPref(pref))
       setTimeout(gotoPref, 0, result.value);
   }