From b8145b3d592cf0290cc17a6223816b817e3e3b77 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 28 Apr 2018 12:46:29 +0200 Subject: Bug 1263935 - Expose native version of mapURIToAddonId via amIAddonPathService Issue #102 --- toolkit/mozapps/extensions/AddonPathService.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'toolkit/mozapps/extensions/AddonPathService.cpp') diff --git a/toolkit/mozapps/extensions/AddonPathService.cpp b/toolkit/mozapps/extensions/AddonPathService.cpp index 006149100..ddfdbe817 100644 --- a/toolkit/mozapps/extensions/AddonPathService.cpp +++ b/toolkit/mozapps/extensions/AddonPathService.cpp @@ -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) { -- cgit v1.2.3