From e82e58aff92c05f072f7fba87be63648195a6388 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Tue, 6 Jun 2017 12:45:29 +0100 Subject: [PATCH] Bug 1370507 - browser_all_files_referenced.js should be able to handle template strings. r=florian MozReview-Commit-ID: FQZjG1i0ddk --- .../test/static/browser_all_files_referenced.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js index 4c7dc665060e..cbd55cddcb0d 100644 --- a/browser/base/content/test/static/browser_all_files_referenced.js +++ b/browser/base/content/test/static/browser_all_files_referenced.js @@ -1,6 +1,10 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ +// Note to run this test similar to try server, you need to run: +// ./mach package +// ./mach mochitest --appname dist + // Slow on asan builds. requestLongerTimeout(5); @@ -324,7 +328,7 @@ function parseCodeFile(fileUri) { let baseUri; for (let line of data.split("\n")) { let urls = - line.match(/["']chrome:\/\/[a-zA-Z0-9 -]+\/(content|skin|locale)\/[^"' ]*["']/g); + line.match(/["'`]chrome:\/\/[a-zA-Z0-9 -]+\/(content|skin|locale)\/[^"'` ]*["'`]/g); if (!urls) { urls = line.match(/["']resource:\/\/[^"']+["']/g); if (urls && isDevtools && @@ -388,8 +392,14 @@ function parseCodeFile(fileUri) { // Remove quotes. url = url.slice(1, -1); // Remove ? or \ trailing characters. - if (url.endsWith("?") || url.endsWith("\\")) + if (url.endsWith("\\")) { url = url.slice(0, -1); + } + + let pos = url.indexOf("?"); + if (pos != -1) { + url = url.slice(0, pos); + } // Make urls like chrome://browser/skin/ point to an actual file, // and remove the ref if any.