mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +09:00
Bug 1263935 - Expose native version of mapURIToAddonId via amIAddonPathService
Issue #102
This commit is contained in:
parent
9feb54bfda
commit
a055ca91ec
2 changed files with 18 additions and 0 deletions
|
|
@ -128,6 +128,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…
Add table
Add a link
Reference in a new issue