Bug 1364877 - Fix support of string preferences with quotes in DevTools add-on. r=jdescottes draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 15 May 2017 14:57:31 +0200
changeset 577816 756f4ff1dd07e899f22a926a5b26b43675a7c67f
parent 577554 e66dedabe582ba7b394aee4f89ed70fe389b3c46
child 628598 1aaf274a79f979ac6b8c92dfc594c37543cedae7
push id58797
push userbmo:poirot.alex@gmail.com
push dateMon, 15 May 2017 13:01:13 +0000
reviewersjdescottes
bugs1364877
milestone55.0a1
Bug 1364877 - Fix support of string preferences with quotes in DevTools add-on. r=jdescottes MozReview-Commit-ID: IO9aJwijMk0
devtools/bootstrap.js
--- a/devtools/bootstrap.js
+++ b/devtools/bootstrap.js
@@ -51,17 +51,19 @@ function processPrefFile(url) {
 
     // Prevent overriding prefs that have been changed by the user
     if (Services.prefs.prefHasUserValue(name)) {
       return;
     }
     let defaultBranch = Services.prefs.getDefaultBranch("");
     if ((val.startsWith("\"") && val.endsWith("\"")) ||
         (val.startsWith("'") && val.endsWith("'"))) {
-      defaultBranch.setCharPref(name, val.substr(1, val.length - 2));
+      val = val.substr(1, val.length - 2);
+      val = val.replace(/\\"/g, '"');
+      defaultBranch.setCharPref(name, val);
     } else if (val.match(/[0-9]+/)) {
       defaultBranch.setIntPref(name, parseInt(val, 10));
     } else if (val == "true" || val == "false") {
       defaultBranch.setBoolPref(name, val == "true");
     } else {
       console.log("Unable to match preference type for value:", val);
     }
   });