summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/internal/XPIProvider.jsm
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-04-29 13:07:33 +0200
committerGitHub <noreply@github.com>2018-04-29 13:07:33 +0200
commit58a55be1f11fa798b6cc2a4d19eda9deabd1574f (patch)
tree28f2f4d0b5bd3bcbfdf29f76c8467022076a8ecf /toolkit/mozapps/extensions/internal/XPIProvider.jsm
parent11caf6ecb3cb8c84d2355a6c6e9580a290147e92 (diff)
parent77e7fcac500629602059ad573c4ff6a9ff4d93b7 (diff)
downloadUXP-58a55be1f11fa798b6cc2a4d19eda9deabd1574f.tar
UXP-58a55be1f11fa798b6cc2a4d19eda9deabd1574f.tar.gz
UXP-58a55be1f11fa798b6cc2a4d19eda9deabd1574f.tar.lz
UXP-58a55be1f11fa798b6cc2a4d19eda9deabd1574f.tar.xz
UXP-58a55be1f11fa798b6cc2a4d19eda9deabd1574f.zip
Merge pull request #281 from janekptacijarabaci/pm_devtools_storage_mapURIToAddonId_1
[PALEMOON] [DevTools] Storage inspector throws "AddonPathService.mapURIToAddonId is not a function" when url changes
Diffstat (limited to 'toolkit/mozapps/extensions/internal/XPIProvider.jsm')
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProvider.jsm19
1 files changed, 7 insertions, 12 deletions
diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
index c43811ba8..8b49c6600 100644
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -52,6 +52,10 @@ XPCOMUtils.defineLazyServiceGetter(this,
"ResProtocolHandler",
"@mozilla.org/network/protocol;1?name=resource",
"nsIResProtocolHandler");
+XPCOMUtils.defineLazyServiceGetter(this,
+ "AddonPathService",
+ "@mozilla.org/addon-path-service;1",
+ "amIAddonPathService");
const nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile",
"initWithPath");
@@ -1887,8 +1891,7 @@ this.XPIProvider = {
logger.info("Mapping " + aID + " to " + aFile.path);
this._addonFileMap.set(aID, aFile.path);
- let service = Cc["@mozilla.org/addon-path-service;1"].getService(Ci.amIAddonPathService);
- service.insertPath(aFile.path, aID);
+ AddonPathService.insertPath(aFile.path, aID);
},
/**
@@ -3916,16 +3919,8 @@ this.XPIProvider = {
* @see amIAddonManager.mapURIToAddonID
*/
mapURIToAddonID: function XPI_mapURIToAddonID(aURI) {
- let resolved = this._resolveURIToFile(aURI);
- if (!resolved || !(resolved instanceof Ci.nsIFileURL))
- return null;
-
- for (let [id, path] of this._addonFileMap) {
- if (resolved.file.path.startsWith(path))
- return id;
- }
-
- return null;
+ // Returns `null` instead of empty string if the URI can't be mapped.
+ return AddonPathService.mapURIToAddonId(aURI) || null;
},
/**