Bug 1371298 - stop ignoring prefs after #endif in webpack/addon devtools prefs loaders;r=tromey draft
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 08 Jun 2017 17:05:52 +0200
changeset 591046 36635d9aa007031a3d23b30860836441f393656b
parent 590997 6491fb29e7fcc9e02cc179ae2856f426a3552385
child 591047 e919766ae5c88226734d6c2bfe41420815348df8
child 591079 a3e74ac27c9ce839f31288c048a8c2e6a4bb288c
push id62937
push userjdescottes@mozilla.com
push dateThu, 08 Jun 2017 15:14:48 +0000
reviewerstromey
bugs1371298
milestone55.0a1
Bug 1371298 - stop ignoring prefs after #endif in webpack/addon devtools prefs loaders;r=tromey MozReview-Commit-ID: CKlmL6S0dtX
devtools/bootstrap.js
devtools/client/inspector/webpack/prefs-loader.js
--- a/devtools/bootstrap.js
+++ b/devtools/bootstrap.js
@@ -68,16 +68,18 @@ function interpretPreprocessingInstructi
   for (let line of lines) {
     if (line.startsWith("#if")) {
       if (!(line in ifMap)) {
         throw new Error("missing line in ifMap: " + line);
       }
       ignoring = !ifMap[line];
     } else if (line.startsWith("#else")) {
       ignoring = !ignoring;
+    } else if (line.startsWith("#endif")) {
+      ignoring = false;
     }
 
     let isPrefLine = /^ *pref\("([^"]+)"/.test(line);
     if (continuation || (!ignoring && isPrefLine)) {
       newLines.push(line);
 
       // The call to pref(...); might span more than one line.
       continuation = !/\);/.test(line);
--- a/devtools/client/inspector/webpack/prefs-loader.js
+++ b/devtools/client/inspector/webpack/prefs-loader.js
@@ -52,16 +52,18 @@ module.exports = function (content) {
     if (isDevtools) {
       if (line.startsWith("#if")) {
         if (!(line in ifMap)) {
           throw new Error("missing line in ifMap: " + line);
         }
         ignoring = !ifMap[line];
       } else if (line.startsWith("#else")) {
         ignoring = !ignoring;
+      } else if (line.startsWith("#endif")) {
+        ignoring = false;
       }
     }
 
     if (continuation || (!ignoring && acceptLine(line))) {
       newLines.push(line);
 
       // The call to pref(...); might span more than one line.
       continuation = !/\);/.test(line);