Bug 1368152: Part 3 - Remove ExtensionManagement.getURLForExtension. r?aswan
MozReview-Commit-ID: 4KalPWYQeks
--- a/toolkit/components/extensions/ExtensionManagement.jsm
+++ b/toolkit/components/extensions/ExtensionManagement.jsm
@@ -30,18 +30,9 @@ Services.obs.addObserver(onCacheInvalida
var ExtensionManagement = {
get cacheInvalidated() {
return cacheInvalidated;
},
get isExtensionProcess() {
return WebExtensionPolicy.isExtensionProcess;
},
-
- getURLForExtension(id, path = "") {
- let policy = WebExtensionPolicy.getByID(id);
- if (!policy) {
- Cu.reportError(`Called getURLForExtension on unmapped extension ${id}`);
- return null;
- }
- return policy.getURL(path);
- },
};
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -6,16 +6,18 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
this.EXPORTED_SYMBOLS = ["XPIProvider"];
+/* globals WebExtensionPolicy */
+
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/Preferences.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository",
"resource://gre/modules/addons/AddonRepository.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonSettings",
@@ -23,18 +25,16 @@ XPCOMUtils.defineLazyModuleGetter(this,
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ChromeManifestParser",
"resource://gre/modules/ChromeManifestParser.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
"resource://gre/modules/LightweightThemeManager.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionData",
"resource://gre/modules/Extension.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "ExtensionManagement",
- "resource://gre/modules/ExtensionManagement.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Locale",
"resource://gre/modules/Locale.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
"resource://gre/modules/FileUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ZipUtils",
"resource://gre/modules/ZipUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
@@ -7808,20 +7808,21 @@ AddonWrapper.prototype = {
let addon = addonFor(this);
if (addon.optionsURL) {
if (this.isWebExtension || this.hasEmbeddedWebExtension) {
// 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);
- if (!base) {
+ let policy = WebExtensionPolicy.getByID(addon.id);
+ if (!policy) {
return null;
}
+ let base = policy.getURL();
return new URL(addon.optionsURL, base).href;
}
return addon.optionsURL;
}
if (this.hasResource("options.xul"))
return this.getResourceURI("options.xul").spec;