Bug 1264623 - Allow for a leading slash in the path to web_accessible_resources, r=kmag

MozReview-Commit-ID: IWbzhs9dpX2

--HG--
extra : transplant_source : j%F5%0E%AAW%F87ijJ%14%26%08%F9%03%96%5Dw%EC%23
This commit is contained in:
Bob Silverberg 2016-04-14 09:12:21 -04:00
Родитель 633e8d6be7
Коммит 171756faf0
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -96,7 +96,7 @@ add_task(function* test_web_accessible_resources() {
],
"web_accessible_resources": [
"accessible.html",
"/accessible.html",
"wild*.html",
],
},