mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1263935 - Expose native version of mapURIToAddonId via amIAddonPathService. r=mossop
This commit is contained in:
parent
be6d109116
commit
30d3ba40c6
@ -129,6 +129,16 @@ AddonPathService::InsertPath(const nsAString& path, const nsAString& addonIdStri
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
AddonPathService::MapURIToAddonId(nsIURI* aURI, nsAString& addonIdString)
|
||||
{
|
||||
if (JSAddonId* id = MapURIToAddonID(aURI)) {
|
||||
JSFlatString* flat = JS_ASSERT_STRING_IS_FLAT(JS::StringOfAddonId(id));
|
||||
AssignJSFlatString(addonIdString, flat);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
ResolveURI(nsIURI* aURI, nsAString& out)
|
||||
{
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIURI;
|
||||
|
||||
/**
|
||||
* This service maps file system paths where add-ons reside to the ID
|
||||
* of the add-on. Paths are added by the add-on manager. They can
|
||||
@ -26,4 +28,10 @@ interface amIAddonPathService : nsISupports
|
||||
* associated with the given add-on ID.
|
||||
*/
|
||||
void insertPath(in AString path, in AString addonId);
|
||||
|
||||
/**
|
||||
* Given a URI to a file, return the ID of the add-on that the file belongs
|
||||
* to. Returns an empty string if there is no add-on there.
|
||||
*/
|
||||
AString mapURIToAddonId(in nsIURI aURI);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user