Bug 1359739 - Fix eslint-plugin-mozilla's globals import function to correctly handle 'importScripts(url)' cases. r?jaws
MozReview-Commit-ID: 30Ki21DYvzm
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
@@ -198,17 +198,17 @@ module.exports = {
let results = [];
let expr = node.expression;
if (node.expression.type === "CallExpression" &&
expr.callee &&
expr.callee.type === "Identifier" &&
expr.callee.name === "importScripts") {
for (var arg of expr.arguments) {
- var match = arg.value.match(workerImportFilenameMatch);
+ var match = arg.value && arg.value.match(workerImportFilenameMatch);
if (match) {
if (!match[1]) {
let filePath = path.resolve(dirname, match[2]);
if (fs.existsSync(filePath)) {
let additionalGlobals = getGlobalsForFile(filePath);
results = results.concat(additionalGlobals);
}
} else if (match[2] in globalModules) {