Bug 1293721 follow up: handle pre-existing absolute optionsURL r=kmag

MozReview-Commit-ID: GafnS4ckUiY

--HG--
extra : rebase_source : 52a5af4154830bb5d0ff4a49090a9659aac054be
This commit is contained in:
Andrew Swan 2016-08-11 09:59:03 -07:00
Родитель cab627f244
Коммит 7ab541e10d
1 изменённых файлов: 8 добавлений и 1 удалений

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

@ -86,6 +86,8 @@ XPCOMUtils.defineLazyGetter(this, "CertUtils", function() {
return certUtils;
});
Cu.importGlobalProperties(["URL"]);
const nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile",
"initWithPath");
@ -7247,7 +7249,12 @@ AddonWrapper.prototype = {
let addon = addonFor(this);
if (addon.optionsURL) {
if (this.isWebExtension) {
return ExtensionManagement.getURLForExtension(addon.id, addon.optionsURL);
// The internal object's optionsURL property comes from the addons
// DB and should be a relative URL. However, extensions with
// options pages installed before bug 1293721 was fixed got absolute
// URLs in the addons db. This code handles both cases.
let base = ExtensionManagement.getURLForExtension(addon.id);
return new URL(addon.optionsURL, base).href;
}
return addon.optionsURL;
}