Bug 1359739 - Fix eslint-plugin-mozilla's globals import function to correctly handle 'importScripts(url)' cases. r?jaws draft
authorMark Banner <standard8@mozilla.com>
Wed, 26 Apr 2017 10:20:57 +0100
changeset 568550 380cb907d7d7f4e0337e40bcae1a79ae273eef34
parent 568252 3f0c8da53c5cb015933b10b52ded3f30432b378a
child 625950 44ce9b2ba967ef9d3d29f310e98bb4f88ded3526
push id55898
push userbmo:standard8@mozilla.com
push dateWed, 26 Apr 2017 09:21:09 +0000
reviewersjaws
bugs1359739
milestone55.0a1
Bug 1359739 - Fix eslint-plugin-mozilla's globals import function to correctly handle 'importScripts(url)' cases. r?jaws MozReview-Commit-ID: 30Ki21DYvzm
tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
--- 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) {