mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 1321509 - allow non devtools prefs to be loaded in webpack prefs loader;r=tromey
MozReview-Commit-ID: IVWK16kvWzw --HG-- extra : rebase_source : ef864848933984cac0677f0b7a3f9a10c3a875be
This commit is contained in:
parent
3f0ff25997
commit
54c3ef166c
@ -6,7 +6,20 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const PREF_RX = new RegExp("^ *pref\\(\"devtools");
|
||||
const PREF_WHITELIST = [
|
||||
"devtools",
|
||||
"layout.css.grid.enabled"
|
||||
];
|
||||
|
||||
const acceptLine = function (line) {
|
||||
let matches = line.match(/^ *pref\("([^"]+)"/);
|
||||
if (!matches || !matches[1]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let [, prefName] = matches;
|
||||
return PREF_WHITELIST.some(filter => prefName.startsWith(filter));
|
||||
};
|
||||
|
||||
module.exports = function (content) {
|
||||
this.cacheable && this.cacheable();
|
||||
@ -47,7 +60,7 @@ module.exports = function (content) {
|
||||
}
|
||||
}
|
||||
|
||||
if (continuation || (!ignoring && PREF_RX.test(line))) {
|
||||
if (continuation || (!ignoring && acceptLine(line))) {
|
||||
newLines.push(line);
|
||||
|
||||
// The call to pref(...); might span more than one line.
|
||||
|
Loading…
Reference in New Issue
Block a user