summaryrefslogtreecommitdiffstats
path: root/browser/components/newtab/tools/resourceUriPlugin.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/newtab/tools/resourceUriPlugin.js')
-rw-r--r--browser/components/newtab/tools/resourceUriPlugin.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/browser/components/newtab/tools/resourceUriPlugin.js b/browser/components/newtab/tools/resourceUriPlugin.js
index 938822f410..a2244f27fa 100644
--- a/browser/components/newtab/tools/resourceUriPlugin.js
+++ b/browser/components/newtab/tools/resourceUriPlugin.js
@@ -6,6 +6,8 @@
// and translating the uri into a relative filesytem path where the file may be
// found when running within the Karma / Mocha test framework.
+const path = require("path");
+
module.exports = {
ResourceUriPlugin: class ResourceUriPlugin {
/**
@@ -48,7 +50,12 @@ module.exports = {
if (!url.href.match(regex)) {
continue;
}
- const pathname = url.href.replace(regex, replacement);
+ // path.join() is necessary to normalize the path on Windows.
+ // Without it, the path may contain backslashes, resulting in
+ // different build output on Windows than on Unix systems.
+ const pathname = path.join(
+ url.href.replace(regex, replacement)
+ );
resourceData.path = pathname;
resourceData.query = url.search;
resourceData.fragment = url.hash;