Bug 1371298 - stop ignoring prefs after #endif in webpack/addon devtools prefs loaders;r=tromey
MozReview-Commit-ID: CKlmL6S0dtX
--- 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);