diff --git a/toolkit/components/extensions/Extension.jsm b/toolkit/components/extensions/Extension.jsm index 84c870faaf8a..ddab409cce08 100644 --- a/toolkit/components/extensions/Extension.jsm +++ b/toolkit/components/extensions/Extension.jsm @@ -1164,7 +1164,13 @@ Extension.prototype = extend(Object.create(ExtensionData.prototype), { } this.whiteListedHosts = new MatchPattern(whitelist); - this.webAccessibleResources = new MatchGlobs(manifest.web_accessible_resources || []); + // Strip leading slashes from web_accessible_resources. + let strippedWebAccessibleResources = []; + if (manifest.web_accessible_resources) { + strippedWebAccessibleResources = manifest.web_accessible_resources.map(path => path.replace(/^\/+/, "")); + } + + this.webAccessibleResources = new MatchGlobs(strippedWebAccessibleResources); for (let directive in manifest) { if (manifest[directive] !== null) { diff --git a/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html b/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html index cf46886a3077..8d83dbd0ca08 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html @@ -96,7 +96,7 @@ add_task(function* test_web_accessible_resources() { ], "web_accessible_resources": [ - "accessible.html", + "/accessible.html", "wild*.html", ], },