--- a/devtools/server/actors/addon.js
+++ b/devtools/server/actors/addon.js
@@ -10,17 +10,16 @@ var { ActorPool } = require("devtools/se
var { TabSources } = require("./utils/TabSources");
var makeDebugger = require("./utils/make-debugger");
var { ConsoleAPIListener } = require("devtools/server/actors/webconsole/listeners");
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
var { assert, update } = DevToolsUtils;
loader.lazyRequireGetter(this, "AddonThreadActor", "devtools/server/actors/thread", true);
loader.lazyRequireGetter(this, "unwrapDebuggerObjectGlobal", "devtools/server/actors/thread", true);
-loader.lazyRequireGetter(this, "mapURIToAddonID", "devtools/server/actors/utils/map-uri-to-addon-id");
loader.lazyRequireGetter(this, "WebConsoleActor", "devtools/server/actors/webconsole", true);
loader.lazyImporter(this, "AddonManager", "resource://gre/modules/AddonManager.jsm");
function BrowserAddonActor(connection, addon) {
this.conn = connection;
this._addon = addon;
this._contextPool = new ActorPool(this.conn);
@@ -213,37 +212,17 @@ BrowserAddonActor.prototype = {
if (metadata) {
return metadata.addonID === this.id;
}
} catch (e) {
// ignore
}
if (global instanceof Ci.nsIDOMWindow) {
- return mapURIToAddonID(global.document.documentURIObject) == this.id;
- }
-
- // Check the global for a __URI__ property and then try to map that to an
- // add-on
- let uridescriptor = givenGlobal.getOwnPropertyDescriptor("__URI__");
- if (uridescriptor && "value" in uridescriptor && uridescriptor.value) {
- let uri;
- try {
- uri = Services.io.newURI(uridescriptor.value);
- } catch (e) {
- DevToolsUtils.reportException(
- "BrowserAddonActor.prototype._shouldAddNewGlobalAsDebuggee",
- new Error("Invalid URI: " + uridescriptor.value)
- );
- return false;
- }
-
- if (mapURIToAddonID(uri) == this.id) {
- return true;
- }
+ return global.document.nodePrincipal.addonId;
}
return false;
},
/**
* Override the eligibility check for scripts and sources to make
* sure every script and source with a URL is stored when debugging
--- a/devtools/server/actors/utils/map-uri-to-addon-id.js
+++ b/devtools/server/actors/utils/map-uri-to-addon-id.js
@@ -1,43 +1,43 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
+const {Cu} = require("chrome");
+
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const Services = require("Services");
-
-loader.lazyServiceGetter(this, "AddonPathService",
- "@mozilla.org/addon-path-service;1",
- "amIAddonPathService");
+const {WebExtensionPolicy} = Cu.getGlobalForObject(Services);
const B2G_ID = "{3c2e2abc-06d4-11e1-ac3b-374f68613e61}";
const GRAPHENE_ID = "{d1bfe7d9-c01e-4237-998b-7b5f960a4314}";
/**
* This is a wrapper around amIAddonPathService.mapURIToAddonID which always returns
* false on B2G and graphene to avoid loading the add-on manager there and
* reports any exceptions rather than throwing so that the caller doesn't have
* to worry about them.
*/
if (!Services.appinfo
|| Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT
|| Services.appinfo.ID === undefined /* XPCShell */
|| Services.appinfo.ID == B2G_ID
|| Services.appinfo.ID == GRAPHENE_ID
- || !AddonPathService) {
+ || !WebExtensionPolicy) {
module.exports = function mapURIToAddonId(uri) {
return false;
};
} else {
module.exports = function mapURIToAddonId(uri) {
try {
- return AddonPathService.mapURIToAddonId(uri);
+ let policy = WebExtensionPolicy.getByURI(uri);
+ return policy && policy.id;
} catch (e) {
DevToolsUtils.reportException("mapURIToAddonId", e);
return false;
}
};
}
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -210,17 +210,16 @@
#include "mozilla/dom/VRDisplay.h"
#include "mozilla/dom/VRDisplayEvent.h"
#include "mozilla/dom/VRDisplayEventBinding.h"
#include "mozilla/dom/VREventObserver.h"
#include "nsRefreshDriver.h"
#include "Layers.h"
-#include "mozilla/AddonPathService.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/Services.h"
#include "mozilla/Telemetry.h"
#include "mozilla/dom/Location.h"
#include "nsHTMLDocument.h"
#include "nsWrapperCacheInlines.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "prrng.h"
@@ -1634,23 +1633,16 @@ CreateNativeGlobalForInner(JSContext* aC
// no one creates one accidentally.
nsCOMPtr<nsIExpandedPrincipal> nsEP = do_QueryInterface(aPrincipal);
MOZ_RELEASE_ASSERT(!nsEP, "DOMWindow with nsEP is not supported");
JS::CompartmentOptions options;
SelectZoneGroup(aNewInner, options.creationOptions());
- // Sometimes add-ons load their own XUL windows, either as separate top-level
- // windows or inside a browser element. In such cases we want to tag the
- // window's compartment with the add-on ID. See bug 1092156.
- if (nsContentUtils::IsSystemPrincipal(aPrincipal)) {
- options.creationOptions().setAddonId(MapURIToAddonID(aURI));
- }
-
options.creationOptions().setSecureContext(aIsSecureContext);
xpc::InitGlobalObjectOptions(options, aPrincipal);
// Determine if we need the Components object.
bool needComponents = nsContentUtils::IsSystemPrincipal(aPrincipal) ||
TreatAsRemoteXUL(aPrincipal);
uint32_t flags = needComponents ? 0 : xpc::OMIT_COMPONENTS_OBJECT;
--- a/dom/base/nsWindowMemoryReporter.cpp
+++ b/dom/base/nsWindowMemoryReporter.cpp
@@ -1,15 +1,14 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "amIAddonManager.h"
#include "nsWindowMemoryReporter.h"
#include "nsWindowSizes.h"
#include "nsGlobalWindow.h"
#include "nsIDocument.h"
#include "nsIDOMWindowCollection.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
@@ -238,17 +237,16 @@ ReportCount(const nsCString& aBasePath,
{
ReportAmount(aBasePath, aPathTail, aAmount, aDescription,
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
aHandleReport, aData);
}
static void
CollectWindowReports(nsGlobalWindowInner *aWindow,
- amIAddonManager *addonManager,
nsWindowSizes *aWindowTotalSizes,
nsTHashtable<nsUint64HashKey> *aGhostWindowIDs,
WindowPaths *aWindowPaths,
WindowPaths *aTopWindowPaths,
nsIHandleReportCallback *aHandleReport,
nsISupports *aData,
bool aAnonymize)
{
@@ -265,27 +263,16 @@ CollectWindowReports(nsGlobalWindowInner
if (top) {
location = GetWindowURI(top);
}
}
if (!location) {
location = GetWindowURI(aWindow);
}
- if (addonManager && location) {
- bool ok;
- nsAutoCString id;
- if (NS_SUCCEEDED(addonManager->MapURIToAddonID(location, id, &ok)) && ok) {
- // Add-on names are not privacy-sensitive, so we can use them with
- // impunity.
- windowPath += NS_LITERAL_CSTRING("add-ons/") + id +
- NS_LITERAL_CSTRING("/");
- }
- }
-
windowPath += NS_LITERAL_CSTRING("window-objects/");
if (top) {
windowPath += NS_LITERAL_CSTRING("top(");
AppendWindowURI(top->GetCurrentInnerWindowInternal(), windowPath, aAnonymize);
windowPath.AppendPrintf(", id=%" PRIu64 ")", top->WindowID());
aTopWindowPaths->Put(aWindow->WindowID(), windowPath);
@@ -615,23 +602,18 @@ nsWindowMemoryReporter::CollectReports(n
"leaks in the browser or add-ons.");
WindowPaths windowPaths;
WindowPaths topWindowPaths;
// Collect window memory usage.
SizeOfState fakeState(nullptr); // this won't be used
nsWindowSizes windowTotalSizes(fakeState);
- nsCOMPtr<amIAddonManager> addonManager;
- if (XRE_IsParentProcess()) {
- // Only try to access the service from the main process.
- addonManager = do_GetService("@mozilla.org/addons/integration;1");
- }
for (uint32_t i = 0; i < windows.Length(); i++) {
- CollectWindowReports(windows[i], addonManager,
+ CollectWindowReports(windows[i],
&windowTotalSizes, &ghostWindows,
&windowPaths, &topWindowPaths, aHandleReport,
aData, aAnonymize);
}
// Report JS memory usage. We do this from here because the JS memory
// reporter needs to be passed |windowPaths|.
xpc::JSReporter::CollectReports(&windowPaths, &topWindowPaths,
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -1,17 +1,16 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WorkerPrivate.h"
-#include "amIAddonManager.h"
#include "js/MemoryMetrics.h"
#include "MessageEventRunnable.h"
#include "mozilla/dom/ClientManager.h"
#include "mozilla/dom/ClientSource.h"
#include "mozilla/dom/ClientState.h"
#include "mozilla/dom/Console.h"
#include "mozilla/dom/DOMTypes.h"
#include "mozilla/dom/ErrorEvent.h"
@@ -1125,22 +1124,20 @@ public:
class WorkerPrivate::MemoryReporter final : public nsIMemoryReporter
{
NS_DECL_THREADSAFE_ISUPPORTS
friend class WorkerPrivate;
SharedMutex mMutex;
WorkerPrivate* mWorkerPrivate;
- bool mAlreadyMappedToAddon;
public:
explicit MemoryReporter(WorkerPrivate* aWorkerPrivate)
- : mMutex(aWorkerPrivate->mMutex), mWorkerPrivate(aWorkerPrivate),
- mAlreadyMappedToAddon(false)
+ : mMutex(aWorkerPrivate->mMutex), mWorkerPrivate(aWorkerPrivate)
{
aWorkerPrivate->AssertIsOnWorkerThread();
}
NS_IMETHOD
CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData, bool aAnonymize) override;
@@ -1228,20 +1225,16 @@ private:
Disable()
{
// Called from WorkerPrivate::DisableMemoryReporter.
mMutex.AssertCurrentThreadOwns();
NS_ASSERTION(mWorkerPrivate, "Disabled more than once!");
mWorkerPrivate = nullptr;
}
-
- // Only call this from the main thread and under mMutex lock.
- void
- TryToMapAddon(nsACString &path);
};
NS_IMPL_ISUPPORTS(WorkerPrivate::MemoryReporter, nsIMemoryReporter)
NS_IMETHODIMP
WorkerPrivate::MemoryReporter::CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData,
bool aAnonymize)
@@ -1277,69 +1270,27 @@ WorkerPrivate::MemoryReporter::CollectRe
path.Append(escapedDomain);
path.AppendLiteral(")/worker(");
NS_ConvertUTF16toUTF8 escapedURL(mWorkerPrivate->ScriptURL());
escapedURL.ReplaceChar('/', '\\');
path.Append(escapedURL);
}
path.AppendPrintf(", 0x%p)/", static_cast<void*>(mWorkerPrivate));
- TryToMapAddon(path);
-
runnable =
new CollectReportsRunnable(mWorkerPrivate, aHandleReport, aData, aAnonymize, path);
}
if (!runnable->Dispatch()) {
return NS_ERROR_UNEXPECTED;
}
return NS_OK;
}
-void
-WorkerPrivate::MemoryReporter::TryToMapAddon(nsACString &path)
-{
- AssertIsOnMainThread();
- mMutex.AssertCurrentThreadOwns();
-
- if (mAlreadyMappedToAddon || !mWorkerPrivate) {
- return;
- }
-
- nsCOMPtr<nsIURI> scriptURI;
- if (NS_FAILED(NS_NewURI(getter_AddRefs(scriptURI),
- mWorkerPrivate->ScriptURL()))) {
- return;
- }
-
- mAlreadyMappedToAddon = true;
-
- if (!XRE_IsParentProcess()) {
- // Only try to access the service from the main process.
- return;
- }
-
- nsAutoCString addonId;
- bool ok;
- nsCOMPtr<amIAddonManager> addonManager =
- do_GetService("@mozilla.org/addons/integration;1");
-
- if (!addonManager ||
- NS_FAILED(addonManager->MapURIToAddonID(scriptURI, addonId, &ok)) ||
- !ok) {
- return;
- }
-
- static const size_t explicitLength = strlen("explicit/");
- addonId.InsertLiteral("add-ons/", 0);
- addonId += "/";
- path.Insert(addonId, explicitLength);
-}
-
WorkerPrivate::MemoryReporter::CollectReportsRunnable::CollectReportsRunnable(
WorkerPrivate* aWorkerPrivate,
nsIHandleReportCallback* aHandleReport,
nsISupports* aHandlerData,
bool aAnonymize,
const nsACString& aPath)
: MainThreadWorkerControlRunnable(aWorkerPrivate),
mFinishCollectRunnable(
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -39,17 +39,16 @@
#include "nsReadableUtils.h"
#include "nsXULAppAPI.h"
#include "GeckoProfiler.h"
#include "WrapperFactory.h"
#include "AutoMemMap.h"
#include "ScriptPreloader-inl.h"
-#include "mozilla/AddonPathService.h"
#include "mozilla/scache/StartupCache.h"
#include "mozilla/scache/StartupCacheUtils.h"
#include "mozilla/MacroForEach.h"
#include "mozilla/Preferences.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/ScriptPreloader.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/ScriptSettings.h"
@@ -563,28 +562,26 @@ mozJSComponentLoader::SizeOfIncludingThi
n += mLocations.ShallowSizeOfExcludingThis(aMallocSizeOf);
n += SizeOfTableExcludingThis(mInProgressImports, aMallocSizeOf);
return n;
}
void
mozJSComponentLoader::CreateLoaderGlobal(JSContext* aCx,
const nsACString& aLocation,
- JSAddonId* aAddonID,
MutableHandleObject aGlobal)
{
RefPtr<BackstagePass> backstagePass;
nsresult rv = NS_NewBackstagePass(getter_AddRefs(backstagePass));
NS_ENSURE_SUCCESS_VOID(rv);
CompartmentOptions options;
options.creationOptions()
- .setSystemZone()
- .setAddonId(aAddonID);
+ .setSystemZone();
if (xpc::SharedMemoryEnabled())
options.creationOptions().setSharedMemoryAndAtomicsEnabled(true);
// Defer firing OnNewGlobalObject until after the __URI__ property has
// been defined so the JS debugger can tell what module the global is
// for
RootedObject global(aCx);
@@ -609,19 +606,19 @@ mozJSComponentLoader::CreateLoaderGlobal
// Set the location information for the new global, so that tools like
// about:memory may use that information
xpc::SetLocationForGlobal(global, aLocation);
aGlobal.set(global);
}
bool
-mozJSComponentLoader::ReuseGlobal(bool aIsAddon, nsIURI* aURI)
+mozJSComponentLoader::ReuseGlobal(nsIURI* aURI)
{
- if (aIsAddon || !mShareLoaderGlobal)
+ if (!mShareLoaderGlobal)
return false;
nsCString spec;
NS_ENSURE_SUCCESS(aURI->GetSpec(spec), false);
// The loader calls Object.freeze on global properties, which
// causes problems if the global is shared with other code.
if (spec.EqualsASCII("resource://gre/modules/commonjs/toolkit/loader.js")) {
@@ -646,17 +643,17 @@ mozJSComponentLoader::ReuseGlobal(bool a
}
JSObject*
mozJSComponentLoader::GetSharedGlobal(JSContext* aCx)
{
if (!mLoaderGlobal) {
JS::RootedObject globalObj(aCx);
CreateLoaderGlobal(aCx, NS_LITERAL_CSTRING("shared JSM global"),
- nullptr, &globalObj);
+ &globalObj);
// If we fail to create a module global this early, we're not going to
// get very far, so just bail out now.
MOZ_RELEASE_ASSERT(globalObj);
mLoaderGlobal = globalObj;
// AutoEntryScript required to invoke debugger hook, which is a
// Gecko-specific concept at present.
@@ -673,27 +670,26 @@ mozJSComponentLoader::PrepareObjectForLo
nsIFile* aComponentFile,
nsIURI* aURI,
bool* aReuseGlobal,
bool* aRealFile)
{
nsAutoCString nativePath;
NS_ENSURE_SUCCESS(aURI->GetSpec(nativePath), nullptr);
- JSAddonId* addonId = MapURIToAddonID(aURI);
- bool reuseGlobal = ReuseGlobal(!!addonId, aURI);
+ bool reuseGlobal = ReuseGlobal(aURI);
*aReuseGlobal = reuseGlobal;
bool createdNewGlobal = false;
RootedObject globalObj(aCx);
if (reuseGlobal) {
globalObj = GetSharedGlobal(aCx);
} else if (!globalObj) {
- CreateLoaderGlobal(aCx, nativePath, addonId, &globalObj);
+ CreateLoaderGlobal(aCx, nativePath, &globalObj);
createdNewGlobal = true;
}
// |thisObj| is the object we set properties on for a particular .jsm.
RootedObject thisObj(aCx, globalObj);
NS_ENSURE_TRUE(thisObj, nullptr);
JSAutoCompartment ac(aCx, thisObj);
--- a/js/xpconnect/loader/mozJSComponentLoader.h
+++ b/js/xpconnect/loader/mozJSComponentLoader.h
@@ -101,20 +101,19 @@ class mozJSComponentLoader final : publi
private:
static mozJSComponentLoader* sSelf;
nsresult ReallyInit();
void UnloadModules();
void CreateLoaderGlobal(JSContext* aCx,
const nsACString& aLocation,
- JSAddonId* aAddonID,
JS::MutableHandleObject aGlobal);
- bool ReuseGlobal(bool aIsAddon, nsIURI* aComponent);
+ bool ReuseGlobal(nsIURI* aComponent);
JSObject* GetSharedGlobal(JSContext* aCx);
JSObject* PrepareObjectForLocation(JSContext* aCx,
nsIFile* aComponentFile,
nsIURI* aComponent,
bool* aReuseGlobal,
bool* aRealFile);
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -999,32 +999,16 @@ xpc::CreateSandboxObject(JSContext* cx,
else if (options.freshZone)
creationOptions.setNewZoneInSystemZoneGroup();
else
creationOptions.setSystemZone();
creationOptions.setInvisibleToDebugger(options.invisibleToDebugger)
.setTrace(TraceXPCGlobal);
- // Try to figure out any addon this sandbox should be associated with.
- // The addon could have been passed in directly, as part of the metadata,
- // or by being constructed from an addon's code.
- JSAddonId* addonId = nullptr;
- if (options.addonId) {
- addonId = JS::NewAddonId(cx, options.addonId);
- NS_ENSURE_TRUE(addonId, NS_ERROR_FAILURE);
- } else if (principal == nsXPConnect::SystemPrincipal()) {
- if (JSObject* obj = JS::CurrentGlobalOrNull(cx)) {
- if (JSAddonId* id = JS::AddonIdOfObject(obj))
- addonId = id;
- }
- }
-
- creationOptions.setAddonId(addonId);
-
compartmentOptions.behaviors().setDiscardSource(options.discardSource);
const js::Class* clasp = &SandboxClass;
RootedObject sandbox(cx, xpc::CreateGlobalObject(cx, js::Jsvalify(clasp),
principal, compartmentOptions));
if (!sandbox)
return NS_ERROR_FAILURE;
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -20,17 +20,16 @@
#include "nsThreadUtils.h"
#include "nsIMemoryInfoDumper.h"
#include "nsIMemoryReporter.h"
#include "nsIObserverService.h"
#include "nsIDebug2.h"
#include "nsIDocShell.h"
#include "nsIRunnable.h"
-#include "amIAddonManager.h"
#include "nsPIDOMWindow.h"
#include "nsPrintfCString.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Services.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsContentUtils.h"
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -20,17 +20,16 @@
#include "nsExceptionHandler.h"
#include "nsIMemoryInfoDumper.h"
#include "nsIMemoryReporter.h"
#include "nsIObserverService.h"
#include "nsIDebug2.h"
#include "nsIDocShell.h"
#include "nsIRunnable.h"
-#include "amIAddonManager.h"
#include "nsPIDOMWindow.h"
#include "nsPrintfCString.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Services.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/dom/ScriptSettings.h"
@@ -1661,47 +1660,27 @@ ReportClassStats(const ClassInfo& classI
"optimization tricks, but not committed and thus never contributing"
" to RSS, only vsize.");
}
}
static void
ReportCompartmentStats(const JS::CompartmentStats& cStats,
const xpc::CompartmentStatsExtras& extras,
- amIAddonManager* addonManager,
nsIHandleReportCallback* handleReport,
nsISupports* data, size_t* gcTotalOut = nullptr)
{
static const nsDependentCString addonPrefix("explicit/add-ons/");
size_t gcTotal = 0, sundriesGCHeap = 0, sundriesMallocHeap = 0;
nsAutoCString cJSPathPrefix(extras.jsPathPrefix);
nsAutoCString cDOMPathPrefix(extras.domPathPrefix);
MOZ_ASSERT(!gcTotalOut == cStats.isTotals);
- // Only attempt to prefix if we got a location and the path wasn't already
- // prefixed.
- if (extras.location && addonManager &&
- cJSPathPrefix.Find(addonPrefix, false, 0, 0) != 0) {
- nsAutoCString addonId;
- bool ok;
- if (NS_SUCCEEDED(addonManager->MapURIToAddonID(extras.location,
- addonId, &ok))
- && ok) {
- // Insert the add-on id as "add-ons/@id@/" after "explicit/" to
- // aggregate add-on compartments.
- static const size_t explicitLength = strlen("explicit/");
- addonId.InsertLiteral("add-ons/", 0);
- addonId += "/";
- cJSPathPrefix.Insert(addonId, explicitLength);
- cDOMPathPrefix.Insert(addonId, explicitLength);
- }
- }
-
nsCString nonNotablePath = cJSPathPrefix;
nonNotablePath += cStats.isTotals
? NS_LITERAL_CSTRING("classes/")
: NS_LITERAL_CSTRING("classes/class(<non-notable classes>)/");
ReportClassStats(cStats.classInfo, nonNotablePath, handleReport, data,
gcTotal);
@@ -1833,20 +1812,19 @@ ReportScriptSourceStats(const ScriptSour
{
if (scriptSourceInfo.misc > 0) {
RREPORT_BYTES(path + NS_LITERAL_CSTRING("misc"),
KIND_HEAP, scriptSourceInfo.misc,
"Miscellaneous data relating to JavaScript source code.");
}
}
-static void
+void
ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats& rtStats,
const nsACString& rtPath,
- amIAddonManager* addonManager,
nsIHandleReportCallback* handleReport,
nsISupports* data,
bool anonymize,
size_t* rtTotalOut)
{
size_t gcTotal = 0;
for (size_t i = 0; i < rtStats.zoneStatsVector.length(); i++) {
@@ -1857,17 +1835,17 @@ ReportJSRuntimeExplicitTreeStats(const J
&gcTotal);
}
for (size_t i = 0; i < rtStats.compartmentStatsVector.length(); i++) {
const JS::CompartmentStats& cStats = rtStats.compartmentStatsVector[i];
const xpc::CompartmentStatsExtras* extras =
static_cast<const xpc::CompartmentStatsExtras*>(cStats.extra);
- ReportCompartmentStats(cStats, *extras, addonManager, handleReport,
+ ReportCompartmentStats(cStats, *extras, handleReport,
data, &gcTotal);
}
// Report the rtStats.runtime numbers under "runtime/", and compute their
// total for later.
size_t rtTotal = 0;
@@ -2030,33 +2008,16 @@ ReportJSRuntimeExplicitTreeStats(const J
rtStats.gcHeapChunkAdmin,
"Bookkeeping information within GC chunks.");
// gcTotal is the sum of everything we've reported for the GC heap. It
// should equal rtStats.gcHeapChunkTotal.
MOZ_ASSERT(gcTotal == rtStats.gcHeapChunkTotal);
}
-void
-ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats& rtStats,
- const nsACString& rtPath,
- nsIHandleReportCallback* handleReport,
- nsISupports* data,
- bool anonymize,
- size_t* rtTotalOut)
-{
- nsCOMPtr<amIAddonManager> am;
- if (XRE_IsParentProcess()) {
- // Only try to access the service from the main process.
- am = do_GetService("@mozilla.org/addons/integration;1");
- }
- ReportJSRuntimeExplicitTreeStats(rtStats, rtPath, am.get(), handleReport,
- data, anonymize, rtTotalOut);
-}
-
} // namespace xpc
class JSMainRuntimeCompartmentsReporter final : public nsIMemoryReporter
{
~JSMainRuntimeCompartmentsReporter() {}
@@ -2163,26 +2124,24 @@ StartsWithExplicit(nsACString& s)
return StringBeginsWith(s, NS_LITERAL_CSTRING("explicit/"));
}
#endif
class XPCJSRuntimeStats : public JS::RuntimeStats
{
WindowPaths* mWindowPaths;
WindowPaths* mTopWindowPaths;
- bool mGetLocations;
int mAnonymizeID;
public:
XPCJSRuntimeStats(WindowPaths* windowPaths, WindowPaths* topWindowPaths,
- bool getLocations, bool anonymize)
+ bool anonymize)
: JS::RuntimeStats(JSMallocSizeOf),
mWindowPaths(windowPaths),
mTopWindowPaths(topWindowPaths),
- mGetLocations(getLocations),
mAnonymizeID(anonymize ? 1 : 0)
{}
~XPCJSRuntimeStats() {
for (size_t i = 0; i != compartmentStatsVector.length(); ++i)
delete static_cast<xpc::CompartmentStatsExtras*>(compartmentStatsVector[i].extra);
for (size_t i = 0; i != zoneStatsVector.length(); ++i)
@@ -2216,26 +2175,16 @@ class XPCJSRuntimeStats : public JS::Run
}
virtual void initExtraCompartmentStats(JSCompartment* c,
JS::CompartmentStats* cstats) override
{
xpc::CompartmentStatsExtras* extras = new xpc::CompartmentStatsExtras;
nsCString cName;
GetCompartmentName(c, cName, &mAnonymizeID, /* replaceSlashes = */ true);
- CompartmentPrivate* cp = CompartmentPrivate::Get(c);
- if (cp) {
- if (mGetLocations) {
- cp->GetLocationURI(CompartmentPrivate::LocationHintAddon,
- getter_AddRefs(extras->location));
- }
- // Note: cannot use amIAddonManager implementation at this point,
- // as it is a JS service and the JS heap is currently not idle.
- // Otherwise, we could have computed the add-on id at this point.
- }
// Get the compartment's global.
AutoSafeJSContext cx;
bool needZone = true;
Rooted<Realm*> realm(cx, JS::GetRealmForCompartment(c));
RootedObject global(cx, JS::GetRealmGlobalOrNull(realm));
if (global) {
RefPtr<nsGlobalWindowInner> window;
@@ -2295,24 +2244,17 @@ JSReporter::CollectReports(WindowPaths*
XPCJSRuntime* xpcrt = nsXPConnect::GetRuntimeInstance();
// In the first step we get all the stats and stash them in a local
// data structure. In the second step we pass all the stashed stats to
// the callback. Separating these steps is important because the
// callback may be a JS function, and executing JS while getting these
// stats seems like a bad idea.
- nsCOMPtr<amIAddonManager> addonManager;
- if (XRE_IsParentProcess()) {
- // Only try to access the service from the main process.
- addonManager = do_GetService("@mozilla.org/addons/integration;1");
- }
- bool getLocations = !!addonManager;
- XPCJSRuntimeStats rtStats(windowPaths, topWindowPaths, getLocations,
- anonymize);
+ XPCJSRuntimeStats rtStats(windowPaths, topWindowPaths, anonymize);
OrphanReporter orphanReporter(XPCConvert::GetISupportsFromJSObject);
JSContext* cx = XPCJSContext::Get()->Context();
if (!JS::CollectRuntimeStats(cx, &rtStats, &orphanReporter,
anonymize))
{
return;
}
@@ -2329,24 +2271,24 @@ JSReporter::CollectReports(WindowPaths*
size_t jsComponentLoaderSize = loader ? loader->SizeOfIncludingThis(JSMallocSizeOf) : 0;
// This is the second step (see above). First we report stuff in the
// "explicit" tree, then we report other stuff.
size_t rtTotal = 0;
xpc::ReportJSRuntimeExplicitTreeStats(rtStats,
NS_LITERAL_CSTRING("explicit/js-non-window/"),
- addonManager, handleReport, data,
+ handleReport, data,
anonymize, &rtTotal);
// Report the sums of the compartment numbers.
xpc::CompartmentStatsExtras cExtrasTotal;
cExtrasTotal.jsPathPrefix.AssignLiteral("js-main-runtime/compartments/");
cExtrasTotal.domPathPrefix.AssignLiteral("window-objects/dom/");
- ReportCompartmentStats(rtStats.cTotals, cExtrasTotal, addonManager,
+ ReportCompartmentStats(rtStats.cTotals, cExtrasTotal,
handleReport, data);
xpc::ZoneStatsExtras zExtrasTotal;
zExtrasTotal.pathPrefix.AssignLiteral("js-main-runtime/zones/");
ReportZoneStats(rtStats.zTotals, zExtrasTotal, handleReport, data,
anonymize);
// Report the sum of the runtime/ numbers.
--- a/toolkit/components/build/nsToolkitCompsModule.cpp
+++ b/toolkit/components/build/nsToolkitCompsModule.cpp
@@ -31,17 +31,16 @@
#include "nsUrlClassifierUtils.h"
#include "nsUrlClassifierPrefixSet.h"
#include "nsBrowserStatusFilter.h"
#include "mozilla/FinalizationWitnessService.h"
#include "mozilla/NativeOSFileInternals.h"
#include "mozilla/AddonContentPolicy.h"
#include "mozilla/AddonManagerStartup.h"
-#include "mozilla/AddonPathService.h"
#include "mozilla/ExtensionPolicyService.h"
#if defined(XP_WIN)
#include "NativeFileWatcherWin.h"
#else
#include "NativeFileWatcherNotSupported.h"
#endif // (XP_WIN)
@@ -118,17 +117,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowser
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUpdateProcessor)
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(FinalizationWitnessService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(NativeOSFileInternalsService)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NativeFileWatcherService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(AddonContentPolicy)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(AddonPathService, AddonPathService::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(AddonManagerStartup, AddonManagerStartup::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ExtensionPolicyService, ExtensionPolicyService::GetInstance)
NS_DEFINE_NAMED_CID(NS_TOOLKIT_APPSTARTUP_CID);
#if defined(MOZ_HAS_PERFSTATS)
NS_DEFINE_NAMED_CID(NS_TOOLKIT_PERFORMANCESTATSSERVICE_CID);
#endif // defined (MOZ_HAS_PERFSTATS)
@@ -187,17 +185,16 @@ static const Module::CIDEntry kToolkitCI
{ &kNS_URLCLASSIFIERUTILS_CID, false, nullptr, nsUrlClassifierUtilsConstructor },
{ &kNS_BROWSERSTATUSFILTER_CID, false, nullptr, nsBrowserStatusFilterConstructor },
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
{ &kNS_UPDATEPROCESSOR_CID, false, nullptr, nsUpdateProcessorConstructor },
#endif
{ &kFINALIZATIONWITNESSSERVICE_CID, false, nullptr, FinalizationWitnessServiceConstructor },
{ &kNATIVE_OSFILE_INTERNALS_SERVICE_CID, false, nullptr, NativeOSFileInternalsServiceConstructor },
{ &kNS_ADDONCONTENTPOLICY_CID, false, nullptr, AddonContentPolicyConstructor },
- { &kNS_ADDON_PATH_SERVICE_CID, false, nullptr, AddonPathServiceConstructor },
{ &kNS_ADDON_MANAGER_STARTUP_CID, false, nullptr, AddonManagerStartupConstructor },
{ &kNS_ADDON_POLICY_SERVICE_CID, false, nullptr, ExtensionPolicyServiceConstructor },
{ &kNATIVE_FILEWATCHER_SERVICE_CID, false, nullptr, NativeFileWatcherServiceConstructor },
{ nullptr }
};
static const Module::ContractIDEntry kToolkitContracts[] = {
{ NS_APPSTARTUP_CONTRACTID, &kNS_TOOLKIT_APPSTARTUP_CID },
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -1791,46 +1791,16 @@ var AddonManagerInternal = {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
return this.getInstallsByTypes(null);
},
/**
- * Synchronously map a URI to the corresponding Addon ID.
- *
- * Mappable URIs are limited to in-application resources belonging to the
- * add-on, such as Javascript compartments, XUL windows, XBL bindings, etc.
- * but do not include URIs from meta data, such as the add-on homepage.
- *
- * @param aURI
- * nsIURI to map to an addon id
- * @return string containing the Addon ID or null
- * @see amIAddonManager.mapURIToAddonID
- */
- mapURIToAddonID(aURI) {
- if (!(aURI instanceof Ci.nsIURI)) {
- throw Components.Exception("aURI is not a nsIURI",
- Cr.NS_ERROR_INVALID_ARG);
- }
-
- // Try all providers
- let providers = [...this.providers];
- for (let provider of providers) {
- var id = callProvider(provider, "mapURIToAddonID", null, aURI);
- if (id !== null) {
- return id;
- }
- }
-
- return null;
- },
-
- /**
* Checks whether installation is enabled for a particular mimetype.
*
* @param aMimetype
* The mimetype to check
* @return true if installation is enabled for the mimetype
*/
isInstallEnabled(aMimetype) {
if (!gStarted)
@@ -3516,20 +3486,16 @@ var AddonManager = {
},
getAllInstalls(aCallback) {
return promiseOrCallback(
AddonManagerInternal.getAllInstalls(),
aCallback);
},
- mapURIToAddonID(aURI) {
- return AddonManagerInternal.mapURIToAddonID(aURI);
- },
-
isInstallEnabled(aType) {
return AddonManagerInternal.isInstallEnabled(aType);
},
isInstallAllowed(aType, aInstallingPrincipal) {
return AddonManagerInternal.isInstallAllowed(aType, aInstallingPrincipal);
},
deleted file mode 100644
--- a/toolkit/mozapps/extensions/AddonPathService.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "AddonPathService.h"
-
-#include "amIAddonManager.h"
-#include "nsIURI.h"
-#include "nsXULAppAPI.h"
-#include "jsapi.h"
-#include "nsServiceManagerUtils.h"
-#include "nsLiteralString.h"
-#include "nsThreadUtils.h"
-#include "nsIIOService.h"
-#include "nsNetUtil.h"
-#include "nsIAddonPolicyService.h"
-#include "nsIFileURL.h"
-#include "nsIResProtocolHandler.h"
-#include "nsIChromeRegistry.h"
-#include "nsIJARURI.h"
-#include "nsJSUtils.h"
-#include "mozilla/dom/ScriptSettings.h"
-#include "mozilla/dom/ToJSValue.h"
-#include "mozilla/AddonPathService.h"
-#include "mozilla/Omnijar.h"
-
-#include <algorithm>
-
-namespace mozilla {
-
-struct PathEntryComparator
-{
- typedef AddonPathService::PathEntry PathEntry;
-
- bool Equals(const PathEntry& entry1, const PathEntry& entry2) const
- {
- return entry1.mPath == entry2.mPath;
- }
-
- bool LessThan(const PathEntry& entry1, const PathEntry& entry2) const
- {
- return entry1.mPath < entry2.mPath;
- }
-};
-
-AddonPathService::AddonPathService()
-{
-}
-
-AddonPathService::~AddonPathService()
-{
- MOZ_ASSERT(sInstance == this);
- sInstance = nullptr;
-}
-
-NS_IMPL_ISUPPORTS(AddonPathService, amIAddonPathService)
-
-AddonPathService *AddonPathService::sInstance;
-
-/* static */ already_AddRefed<AddonPathService>
-AddonPathService::GetInstance()
-{
- if (!sInstance) {
- sInstance = new AddonPathService();
- }
- return do_AddRef(sInstance);
-}
-
-static JSAddonId*
-ConvertAddonId(const nsAString& addonIdString)
-{
- AutoSafeJSContext cx;
- JS::RootedValue strv(cx);
- if (!mozilla::dom::ToJSValue(cx, addonIdString, &strv)) {
- return nullptr;
- }
- JS::RootedString str(cx, strv.toString());
- return JS::NewAddonId(cx, str);
-}
-
-JSAddonId*
-AddonPathService::Find(const nsAString& path)
-{
- // Use binary search to find the nearest entry that is <= |path|.
- PathEntryComparator comparator;
- unsigned index = mPaths.IndexOfFirstElementGt(PathEntry(path, nullptr), comparator);
- if (index == 0) {
- return nullptr;
- }
- const PathEntry& entry = mPaths[index - 1];
-
- // Return the entry's addon if its path is a prefix of |path|.
- if (StringBeginsWith(path, entry.mPath)) {
- return entry.mAddonId;
- }
- return nullptr;
-}
-
-NS_IMETHODIMP
-AddonPathService::FindAddonId(const nsAString& path, nsAString& addonIdString)
-{
- if (JSAddonId* id = Find(path)) {
- JSFlatString* flat = JS_ASSERT_STRING_IS_FLAT(JS::StringOfAddonId(id));
- AssignJSFlatString(addonIdString, flat);
- }
- return NS_OK;
-}
-
-/* static */ JSAddonId*
-AddonPathService::FindAddonId(const nsAString& path)
-{
- // If no service has been created, then we're not going to find anything.
- if (!sInstance) {
- return nullptr;
- }
-
- return sInstance->Find(path);
-}
-
-NS_IMETHODIMP
-AddonPathService::InsertPath(const nsAString& path, const nsAString& addonIdString)
-{
- JSAddonId* addonId = ConvertAddonId(addonIdString);
-
- // Add the new path in sorted order.
- PathEntryComparator comparator;
- mPaths.InsertElementSorted(PathEntry(path, addonId), comparator);
- 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)
-{
- bool equals;
- nsresult rv;
- nsCOMPtr<nsIURI> uri;
- nsAutoCString spec;
-
- // Resolve resource:// URIs. At the end of this if/else block, we
- // have both spec and uri variables identifying the same URI.
- if (NS_SUCCEEDED(aURI->SchemeIs("resource", &equals)) && equals) {
- nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
- if (NS_WARN_IF(NS_FAILED(rv)))
- return rv;
-
- nsCOMPtr<nsIProtocolHandler> ph;
- rv = ioService->GetProtocolHandler("resource", getter_AddRefs(ph));
- if (NS_WARN_IF(NS_FAILED(rv)))
- return rv;
-
- nsCOMPtr<nsIResProtocolHandler> irph(do_QueryInterface(ph, &rv));
- if (NS_WARN_IF(NS_FAILED(rv)))
- return rv;
-
- rv = irph->ResolveURI(aURI, spec);
- if (NS_WARN_IF(NS_FAILED(rv)))
- return rv;
-
- rv = ioService->NewURI(spec, nullptr, nullptr, getter_AddRefs(uri));
- if (NS_WARN_IF(NS_FAILED(rv)))
- return rv;
- } else if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &equals)) && equals) {
- // Going through the Chrome Registry may be prohibitively slow for many of
- // the well-known chrome:// URI packages, so check for a few of them here
- // first in order to fail early if we don't have a chrome:// URI which
- // could have been provided by an add-on.
- nsAutoCString package;
- rv = aURI->GetHostPort(package);
- if (NS_WARN_IF(NS_FAILED(rv)) ||
- package.EqualsLiteral("branding") ||
- package.EqualsLiteral("browser") ||
- package.EqualsLiteral("branding") ||
- package.EqualsLiteral("global") ||
- package.EqualsLiteral("global-platform") ||
- package.EqualsLiteral("mozapps") ||
- package.EqualsLiteral("necko") ||
- package.EqualsLiteral("passwordmgr") ||
- package.EqualsLiteral("pippki") ||
- package.EqualsLiteral("pipnss")) {
- // Returning a failure code means the URI isn't associated with an add-on
- // ID.
- return NS_ERROR_FAILURE;
- }
-
- nsCOMPtr<nsIChromeRegistry> chromeReg =
- mozilla::services::GetChromeRegistryService();
- if (NS_WARN_IF(!chromeReg))
- return NS_ERROR_UNEXPECTED;
-
- rv = chromeReg->ConvertChromeURL(aURI, getter_AddRefs(uri));
- if (NS_WARN_IF(NS_FAILED(rv)))
- return rv;
- } else {
- uri = aURI;
- }
-
- if (NS_SUCCEEDED(uri->SchemeIs("jar", &equals)) && equals) {
- nsCOMPtr<nsIJARURI> jarURI = do_QueryInterface(uri, &rv);
- if (NS_WARN_IF(NS_FAILED(rv)))
- return rv;
-
- nsCOMPtr<nsIURI> jarFileURI;
- rv = jarURI->GetJARFile(getter_AddRefs(jarFileURI));
- if (NS_WARN_IF(NS_FAILED(rv)))
- return rv;
-
- return ResolveURI(jarFileURI, out);
- }
-
- if (NS_SUCCEEDED(uri->SchemeIs("file", &equals)) && equals) {
- nsCOMPtr<nsIFileURL> baseFileURL = do_QueryInterface(uri, &rv);
- if (NS_WARN_IF(NS_FAILED(rv)))
- return rv;
-
- nsCOMPtr<nsIFile> file;
- rv = baseFileURL->GetFile(getter_AddRefs(file));
- if (NS_WARN_IF(NS_FAILED(rv)))
- return rv;
-
- return file->GetPath(out);
- }
- return NS_ERROR_FAILURE;
-}
-
-JSAddonId*
-MapURIToAddonID(nsIURI* aURI)
-{
- if (!NS_IsMainThread() || !XRE_IsParentProcess()) {
- return nullptr;
- }
-
- bool equals;
- nsresult rv;
- if (NS_SUCCEEDED(aURI->SchemeIs("moz-extension", &equals)) && equals) {
- nsCOMPtr<nsIAddonPolicyService> service = do_GetService("@mozilla.org/addons/policy-service;1");
- if (service) {
- nsString addonId;
- rv = service->ExtensionURIToAddonId(aURI, addonId);
- if (NS_FAILED(rv))
- return nullptr;
-
- return ConvertAddonId(addonId);
- }
- }
-
- nsAutoString filePath;
- rv = ResolveURI(aURI, filePath);
- if (NS_FAILED(rv))
- return nullptr;
-
- nsCOMPtr<nsIFile> greJar = Omnijar::GetPath(Omnijar::GRE);
- nsCOMPtr<nsIFile> appJar = Omnijar::GetPath(Omnijar::APP);
- if (greJar && appJar) {
- nsAutoString greJarString, appJarString;
- if (NS_FAILED(greJar->GetPath(greJarString)) || NS_FAILED(appJar->GetPath(appJarString)))
- return nullptr;
-
- // If |aURI| is part of either Omnijar, then it can't be part of an
- // add-on. This catches pretty much all URLs for Firefox content.
- if (filePath.Equals(greJarString) || filePath.Equals(appJarString))
- return nullptr;
- }
-
- // If it's not part of Firefox, we resort to binary searching through the
- // add-on paths.
- return AddonPathService::FindAddonId(filePath);
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/toolkit/mozapps/extensions/AddonPathService.h
+++ /dev/null
@@ -1,55 +0,0 @@
-//* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-/
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef AddonPathService_h
-#define AddonPathService_h
-
-#include "amIAddonPathService.h"
-#include "nsString.h"
-#include "nsTArray.h"
-
-class nsIURI;
-class JSAddonId;
-
-namespace mozilla {
-
-JSAddonId*
-MapURIToAddonID(nsIURI* aURI);
-
-class AddonPathService final : public amIAddonPathService
-{
-public:
- AddonPathService();
-
- static already_AddRefed<AddonPathService> GetInstance();
-
- JSAddonId* Find(const nsAString& path);
- static JSAddonId* FindAddonId(const nsAString& path);
-
- NS_DECL_ISUPPORTS
- NS_DECL_AMIADDONPATHSERVICE
-
- struct PathEntry
- {
- nsString mPath;
- JSAddonId* mAddonId;
-
- PathEntry(const nsAString& aPath, JSAddonId* aAddonId)
- : mPath(aPath), mAddonId(aAddonId)
- {}
- };
-
-private:
- virtual ~AddonPathService();
-
- // Paths are stored sorted in order of their mPath.
- nsTArray<PathEntry> mPaths;
-
- static AddonPathService* sInstance;
-};
-
-} // namespace mozilla
-
-#endif
--- a/toolkit/mozapps/extensions/addonManager.js
+++ b/toolkit/mozapps/extensions/addonManager.js
@@ -65,24 +65,16 @@ amManager.prototype = {
case "message-manager-close":
case "message-manager-disconnect":
this.childClosed(aSubject);
break;
}
},
- /**
- * @see amIAddonManager.idl
- */
- mapURIToAddonID(uri, id) {
- id.value = AddonManager.mapURIToAddonID(uri);
- return !!id.value;
- },
-
installAddonFromWebpage(aMimetype, aBrowser, aInstallingPrincipal,
aUri, aHash, aName, aIcon, aCallback) {
let retval = true;
if (!AddonManager.isInstallAllowed(aMimetype, aInstallingPrincipal)) {
aCallback = null;
retval = false;
}
deleted file mode 100644
--- a/toolkit/mozapps/extensions/amIAddonManager.idl
+++ /dev/null
@@ -1,29 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-interface nsIURI;
-
-/**
- * A service to make some AddonManager functionality available to C++ callers.
- * Javascript callers should still use AddonManager.jsm directly.
- */
-[scriptable, function, uuid(7b45d82d-7ad5-48d7-9b05-f32eb9818cd4)]
-interface amIAddonManager : nsISupports
-{
- /**
- * Synchronously map a URI to the corresponding Addon ID.
- *
- * Mappable URIs are limited to in-application resources belonging to the
- * add-on, such as Javascript compartments, XUL windows, XBL bindings, etc.
- * but do not include URIs from meta data, such as the add-on homepage.
- *
- * @param aURI
- * The nsIURI to map
- * @return
- * true if the URI has been mapped successfully to an Addon ID
- */
- boolean mapURIToAddonID(in nsIURI aURI, out AUTF8String aID);
-};
deleted file mode 100644
--- a/toolkit/mozapps/extensions/amIAddonPathService.idl
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#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
- * looked up by anyone.
- */
-[scriptable, uuid(fcd9e270-dfb1-11e3-8b68-0800200c9a66)]
-interface amIAddonPathService : nsISupports
-{
- /**
- * Given a path 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. Note that if an
- * add-on is located at /a/b/c, then looking up the path /a/b/c/d will return
- * that add-on.
- */
- AString findAddonId(in AString path);
-
- /**
- * Call this function to inform the service that the given file system path is
- * 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);
-};
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -43,17 +43,16 @@ XPCOMUtils.defineLazyModuleGetters(this,
const {nsIBlocklistService} = Ci;
XPCOMUtils.defineLazyServiceGetters(this, {
Blocklist: ["@mozilla.org/extensions/blocklist;1", "nsIBlocklistService"],
ChromeRegistry: ["@mozilla.org/chrome/chrome-registry;1", "nsIChromeRegistry"],
ResProtocolHandler: ["@mozilla.org/network/protocol;1?name=resource", "nsIResProtocolHandler"],
AddonPolicyService: ["@mozilla.org/addons/policy-service;1", "nsIAddonPolicyService"],
- AddonPathService: ["@mozilla.org/addon-path-service;1", "amIAddonPathService"],
aomStartup: ["@mozilla.org/addons/addon-manager-startup;1", "amIAddonManagerStartup"],
});
XPCOMUtils.defineLazyGetter(this, "gTextDecoder", () => {
return new TextDecoder();
});
Cu.importGlobalProperties(["URL"]);
@@ -1143,20 +1142,16 @@ class XPIState {
this[prop] = saved[prop];
}
}
if (saved.currentModifiedTime && saved.currentModifiedTime != this.lastModifiedTime) {
this.lastModifiedTime = saved.currentModifiedTime;
this.changed = true;
}
-
- if (this.enabled) {
- XPIProvider._addURIMapping(id, this.file);
- }
}
/**
* Migrates an add-on's data from xpiState and bootstrappedAddons
* preferences, and returns an XPIState object for it.
*
* @param {XPIStateLocation} location
* The location of the add-on.
@@ -1801,18 +1796,16 @@ var XPIProvider = {
// application install location
allAppGlobal: true,
// New distribution addons awaiting permissions approval
newDistroAddons: null,
// Keep track of startup phases for telemetry
runPhase: XPI_STARTING,
// Per-addon telemetry information
_telemetryDetails: {},
- // A Map from an add-on install to its ID
- _addonFileMap: new Map(),
// Have we started shutting down bootstrap add-ons?
_closing: false,
// Check if the XPIDatabase has been loaded (without actually
// triggering unwanted imports or I/O)
get isDBLoaded() {
return gLazyObjectsLoaded && XPIDatabase.initialized;
},
@@ -1911,30 +1904,16 @@ var XPIProvider = {
c.cancel();
} catch (e) {
logger.warn("Cancel failed", e);
}
}
},
/**
- * Adds or updates a URI mapping for an Addon.id.
- *
- * Mappings should not be removed at any point. This is so that the mappings
- * will be still valid after an add-on gets disabled or uninstalled, as
- * consumers may still have URIs of (leaked) resources they want to map.
- */
- _addURIMapping(aID, aFile) {
- logger.info("Mapping " + aID + " to " + aFile.path);
- this._addonFileMap.set(aID, aFile.path);
-
- AddonPathService.insertPath(aFile.path, aID);
- },
-
- /**
* Resolve a URI back to physical file.
*
* Of course, this works only for URIs pointing to local resources.
*
* @param aURI
* URI to resolve
* @return
* resolved nsIFileURL
@@ -2363,17 +2342,16 @@ var XPIProvider = {
}
this.installs = null;
this.installLocations = null;
this.installLocationsByName = null;
// This is needed to allow xpcshell tests to simulate a restart
this.extensionsActive = false;
- this._addonFileMap.clear();
await XPIDatabase.shutdown();
},
cleanupTemporaryAddons() {
let tempLocation = XPIStates.getLocation(TemporaryInstallLocation.name);
if (tempLocation) {
for (let [id, addon] of tempLocation.entries()) {
@@ -3608,17 +3586,16 @@ var XPIProvider = {
flushChromeCaches();
}
} else {
addon.installDate = Date.now();
}
let file = addon._sourceBundle;
- XPIProvider._addURIMapping(addon.id, file);
let method = callUpdate ? "update" : "install";
XPIProvider.callBootstrapMethod(addon, file, method, installReason, extraParams);
addon.state = AddonManager.STATE_INSTALLED;
logger.debug("Install of temporary addon in " + aFile.path + " completed.");
addon.visible = true;
addon.enabled = true;
addon.active = true;
// WebExtension themes are installed as disabled, fix that here.
@@ -3819,34 +3796,16 @@ var XPIProvider = {
return aTypes.includes(getExternalType(install.type));
});
}
aCallback(results.map(install => install.wrapper));
},
/**
- * Synchronously map a URI to the corresponding Addon ID.
- *
- * Mappable URIs are limited to in-application resources belonging to the
- * add-on, such as Javascript compartments, XUL windows, XBL bindings, etc.
- * but do not include URIs from meta data, such as the add-on homepage.
- *
- * @param aURI
- * nsIURI to map or null
- * @return string containing the Addon ID
- * @see AddonManager.mapURIToAddonID
- * @see amIAddonManager.mapURIToAddonID
- */
- mapURIToAddonID(aURI) {
- // Returns `null` instead of empty string if the URI can't be mapped.
- return AddonPathService.mapURIToAddonId(aURI) || null;
- },
-
- /**
* Called when a new add-on has been enabled when only one add-on of that type
* can be enabled.
*
* @param aId
* The ID of the newly enabled add-on
* @param aType
* The type of the newly enabled add-on
* @param aPendingRestart
@@ -5996,17 +5955,16 @@ class DirectoryInstallLocation {
continue;
}
entry = newEntry;
this._linkedAddons.push(id);
}
this._IDToFileMap[id] = entry;
- XPIProvider._addURIMapping(id, entry);
}
}
/**
* Gets the name of this install location.
*/
get name() {
return this._name;
@@ -6278,17 +6236,16 @@ class MutableDirectoryInstallLocation ex
}
try {
newFile.lastModifiedTime = Date.now();
} catch (e) {
logger.warn("failed to set lastModifiedTime on " + newFile.path, e);
}
this._IDToFileMap[id] = newFile;
- XPIProvider._addURIMapping(id, newFile);
if (existingAddonID && existingAddonID != id &&
existingAddonID in this._IDToFileMap) {
delete this._IDToFileMap[existingAddonID];
}
return newFile;
}
@@ -6380,17 +6337,16 @@ class BuiltInInstallLocation extends Dir
// Only attempt to load unpacked directory if unofficial build.
if (!AppConstants.MOZILLA_OFFICIAL && !file.exists()) {
file = new FileUtils.File(this._directory.path);
file.append(`${id}`);
}
this._IDToFileMap[id] = file;
- XPIProvider._addURIMapping(id, file);
}
}
}
/**
* An object which identifies a directory install location for system add-ons
* updates.
*/
@@ -6827,17 +6783,16 @@ class SystemAddonInstallLocation extends
let newFile = getFile(source.leafName, this._directory);
try {
newFile.lastModifiedTime = Date.now();
} catch (e) {
logger.warn("failed to set lastModifiedTime on " + newFile.path, e);
}
this._IDToFileMap[id] = newFile;
- XPIProvider._addURIMapping(id, newFile);
return newFile;
}
// old system add-on upgrade dirs get automatically removed
uninstallAddon(aAddon) {}
}
@@ -6928,17 +6883,16 @@ class WinRegInstallLocation extends Dire
let file = new nsIFile(aKey.readStringValue(id));
if (!file.exists()) {
logger.warn("Ignoring missing add-on in " + file.path);
continue;
}
this._IDToFileMap[id] = file;
- XPIProvider._addURIMapping(id, file);
}
}
/**
* Gets the name of this install location.
*/
get name() {
return this._name;
--- a/toolkit/mozapps/extensions/moz.build
+++ b/toolkit/mozapps/extensions/moz.build
@@ -11,19 +11,17 @@ with Files('docs/**'):
if CONFIG['MOZ_BUILD_APP'] == 'mobile/android':
DEFINES['MOZ_FENNEC'] = True
DIRS += ['internal']
TEST_DIRS += ['test']
XPIDL_SOURCES += [
- 'amIAddonManager.idl',
'amIAddonManagerStartup.idl',
- 'amIAddonPathService.idl',
'amIWebInstallPrompt.idl',
]
XPIDL_MODULE = 'extensions'
EXTRA_COMPONENTS += [
'addonManager.js',
'amContentHandler.js',
@@ -44,24 +42,22 @@ EXTRA_JS_MODULES += [
]
JAR_MANIFESTS += ['jar.mn']
EXPORTS.mozilla += [
'AddonContentPolicy.h',
'AddonManagerStartup.h',
'AddonManagerWebAPI.h',
- 'AddonPathService.h',
]
UNIFIED_SOURCES += [
'AddonContentPolicy.cpp',
'AddonManagerStartup.cpp',
'AddonManagerWebAPI.cpp',
- 'AddonPathService.cpp',
]
LOCAL_INCLUDES += [
'/chrome',
'/dom/base',
]
FINAL_LIBRARY = 'xul'
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_addon_path_service.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-var service = Cc["@mozilla.org/addon-path-service;1"].getService(Ci.amIAddonPathService);
-
-function insert(path, value) {
- service.insertPath("/test/" + path, value);
-}
-
-function find(path) {
- return service.findAddonId("/test/" + path);
-}
-
-function run_test() {
- insert("abc", "10");
- insert("def", "11");
- insert("axy", "12");
- insert("defghij", "13");
- insert("defghi", "14");
-
- Assert.equal(find("abc"), "10");
- Assert.equal(find("abc123"), "10");
- Assert.equal(find("def"), "11");
- Assert.equal(find("axy"), "12");
- Assert.equal(find("axy1"), "12");
- Assert.equal(find("defghij"), "13");
- Assert.equal(find("abd"), "");
- Assert.equal(find("x"), "");
-
- insert("file:///home/billm/mozilla/in4/objdir-ff-dbg/dist/bin/browser/extensions/%7B972ce4c6-7e08-4474-a285-3208198ce6fd%7D/", "{972ce4c6-7e08-4474-a285-3208198ce6fd}");
- insert("file:///home/billm/mozilla/addons/dl-helper-workspace/addon/", "{b9db16a4-6edc-47ec-a1f4-b86292ed211d}");
-
- Assert.equal(find("file:///home/billm/mozilla/addons/dl-helper-workspace/addon/local/modules/medialist-manager.jsm"), "{b9db16a4-6edc-47ec-a1f4-b86292ed211d}");
-}
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js
+++ /dev/null
@@ -1,342 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// This verifies that add-ons URIs can be mapped to add-on IDs
-//
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-
-// Enable loading extensions from the user scopes
-Services.prefs.setIntPref("extensions.enabledScopes",
- AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_USER);
-
-createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
-
-const profileDir = gProfD.clone();
-profileDir.append("extensions");
-const userExtDir = gProfD.clone();
-userExtDir.append("extensions2");
-userExtDir.append(gAppInfo.ID);
-registerDirectory("XREUSysExt", userExtDir.parent);
-
-BootstrapMonitor.init();
-
-function TestProvider(result) {
- this.result = result;
-}
-TestProvider.prototype = {
- uri: Services.io.newURI("hellow://world"),
- id: "valid@id",
- startup() {},
- shutdown() {},
- mapURIToAddonID(aURI) {
- if (aURI.spec === this.uri.spec) {
- return this.id;
- }
- throw Components.Exception("Not mapped", this.result);
- }
-};
-
-function TestProviderNoMap() {}
-TestProviderNoMap.prototype = {
- startup() {},
- shutdown() {}
-};
-
-function check_mapping(uri, id) {
- Assert.equal(AddonManager.mapURIToAddonID(uri), id);
- let svc = Cc["@mozilla.org/addons/integration;1"].
- getService(Ci.amIAddonManager);
- let val = {};
- Assert.ok(svc.mapURIToAddonID(uri, val));
- Assert.equal(val.value, id);
-}
-
-function run_test() {
- do_test_pending();
-
- run_test_early();
-}
-
-function run_test_early() {
- startupManager();
-
- installAllFiles([do_get_addon("test_chromemanifest_1")], function() {
- restartManager();
- AddonManager.getAddonByID("addon1@tests.mozilla.org", function(addon) {
- let uri = addon.getResourceURI(".");
- let id = addon.id;
- check_mapping(uri, id);
-
- shutdownManager();
-
- // Force an early call, to check that mappings will get correctly
- // initialized when the manager actually starts up.
- // See bug 957089
-
- // First force-initialize the XPIProvider.
- let s = ChromeUtils.import(
- "resource://gre/modules/addons/XPIProvider.jsm", {});
-
- // Make the early API call.
- // AddonManager still misses its provider and so doesn't work yet.
- Assert.equal(null, AddonManager.mapURIToAddonID(uri));
- // But calling XPIProvider directly works immediately
- Assert.equal(s.XPIProvider.mapURIToAddonID(uri), id);
-
- // Actually start up the manager.
- startupManager(false);
-
- // Check that the mapping is there now.
- check_mapping(uri, id);
- Assert.equal(s.XPIProvider.mapURIToAddonID(uri), id);
-
- run_test_nomapping();
- });
- });
-}
-
-function run_test_nomapping() {
- Assert.equal(AddonManager.mapURIToAddonID(TestProvider.prototype.uri), null);
- try {
- let svc = Cc["@mozilla.org/addons/integration;1"].
- getService(Ci.amIAddonManager);
- let val = {};
- Assert.ok(!svc.mapURIToAddonID(TestProvider.prototype.uri, val));
- } catch (ex) {
- do_throw(ex);
- }
-
- run_test_1();
-}
-
-
-// Tests that add-on URIs are mappable after an install
-function run_test_1() {
- prepare_test({ }, [
- "onNewInstall"
- ]);
-
- AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_1"), function(install) {
- ensure_test_completed();
-
- let addon = install.addon;
- prepare_test({
- "bootstrap1@tests.mozilla.org": [
- ["onInstalling", false],
- "onInstalled"
- ]
- }, [
- "onInstallStarted",
- "onInstallEnded",
- ], function() {
- let uri = addon.getResourceURI(".");
- check_mapping(uri, addon.id);
-
- BootstrapMonitor.promiseAddonStartup("bootstrap1@tests.mozilla.org").then(function() {
- run_test_2(uri);
- });
- });
- install.install();
- });
-}
-
-// Tests that add-on URIs are still mappable, even after the add-on gets
-// disabled in-session.
-function run_test_2(uri) {
- AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) {
- prepare_test({
- "bootstrap1@tests.mozilla.org": [
- ["onDisabling", false],
- "onDisabled"
- ]
- });
-
- b1.userDisabled = true;
- ensure_test_completed();
-
- AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(newb1) {
- Assert.ok(newb1.userDisabled);
- check_mapping(uri, newb1.id);
-
- executeSoon(() => run_test_3(uri));
- });
- });
-}
-
-// Tests that add-on URIs are mappable if the add-on was never started in a
-// session
-function run_test_3(uri) {
- restartManager();
-
- check_mapping(uri, "bootstrap1@tests.mozilla.org");
-
- run_test_4();
-}
-
-// Tests that add-on URIs are mappable after a restart + reenable
-function run_test_4() {
- restartManager();
-
- AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) {
- prepare_test({
- "bootstrap1@tests.mozilla.org": [
- ["onEnabling", false],
- "onEnabled"
- ]
- });
-
- b1.userDisabled = false;
- ensure_test_completed();
-
- AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(newb1) {
- let uri = newb1.getResourceURI(".");
- check_mapping(uri, newb1.id);
-
- executeSoon(run_test_5);
- });
- });
-}
-
-// Tests that add-on URIs are mappable after a restart
-function run_test_5() {
- restartManager();
-
- AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) {
- let uri = b1.getResourceURI(".");
- check_mapping(uri, b1.id);
-
- executeSoon(run_test_6);
- });
-}
-
-// Tests that add-on URIs are mappable after being uninstalled
-function run_test_6() {
- AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) {
- prepare_test({
- "bootstrap1@tests.mozilla.org": [
- ["onUninstalling", false],
- "onUninstalled"
- ]
- });
-
- let uri = b1.getResourceURI(".");
- b1.uninstall();
- ensure_test_completed();
-
- check_mapping(uri, b1.id);
-
- restartManager();
- executeSoon(run_test_7);
- });
-}
-
-// Tests that add-on URIs are mappable for add-ons detected at startup
-function run_test_7() {
- shutdownManager();
-
- manuallyInstall(do_get_addon("test_bootstrap1_1"), profileDir, "bootstrap1@tests.mozilla.org");
-
- startupManager();
-
- AddonManager.getAddonByID("bootstrap1@tests.mozilla.org", function(b1) {
- let uri = b1.getResourceURI(".");
- check_mapping(uri, b1.id);
-
- executeSoon(run_test_8);
- });
-}
-
-// Tests that temporary addon-on URIs are mappable after install and uninstall
-function run_test_8() {
- prepare_test({
- "bootstrap2@tests.mozilla.org": [
- ["onInstalling", false],
- "onInstalled"
- ]
- }, [
- "onExternalInstall",
- ], function(b2) {
- let uri = b2.getResourceURI(".");
- check_mapping(uri, b2.id);
-
- prepare_test({
- "bootstrap2@tests.mozilla.org": [
- ["onUninstalling", false],
- "onUninstalled"
- ]
- });
-
- b2.uninstall();
- ensure_test_completed();
-
- check_mapping(uri, b2.id);
-
- executeSoon(run_test_invalidarg);
- });
- AddonManager.installTemporaryAddon(do_get_addon("test_bootstrap2_1"));
-}
-
-// Tests that the AddonManager will bail when mapURIToAddonID is called with an
-// invalid argument
-function run_test_invalidarg() {
- restartManager();
-
- let tests = [undefined,
- null,
- 1,
- "string",
- "chrome://global/content/",
- function() {}
- ];
- for (var test of tests) {
- try {
- AddonManager.mapURIToAddonID(test);
- throw new Error("Shouldn't be able to map the URI in question");
- } catch (ex) {
- if (ex.result) {
- Assert.equal(ex.result, Cr.NS_ERROR_INVALID_ARG);
- } else {
- do_throw(ex);
- }
- }
- }
-
- run_test_provider();
-}
-
-// Tests that custom providers are correctly handled
-function run_test_provider() {
- restartManager();
-
- const provider = new TestProvider(Cr.NS_ERROR_NOT_AVAILABLE);
- AddonManagerPrivate.registerProvider(provider);
-
- check_mapping(provider.uri, provider.id);
-
- let u2 = provider.uri.mutate()
- .setPathQueryRef("notmapped")
- .finalize();
- Assert.equal(AddonManager.mapURIToAddonID(u2), null);
-
- AddonManagerPrivate.unregisterProvider(provider);
-
- run_test_provider_nomap();
-}
-
-// Tests that custom providers are correctly handled, even not implementing
-// mapURIToAddonID
-function run_test_provider_nomap() {
- restartManager();
-
- const provider = new TestProviderNoMap();
- AddonManagerPrivate.registerProvider(provider);
-
- Assert.equal(AddonManager.mapURIToAddonID(TestProvider.prototype.uri), null);
-
- AddonManagerPrivate.unregisterProvider(provider);
-
- do_test_finished();
-}
-
-
--- a/toolkit/mozapps/extensions/test/xpcshell/test_shutdown.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_shutdown.js
@@ -5,17 +5,17 @@
// Verify that API functions fail if the Add-ons Manager isn't initialised.
const IGNORE = ["getPreferredIconURL", "escapeAddonURI",
"shouldAutoUpdate", "getStartupChanges",
"addTypeListener", "removeTypeListener",
"addAddonListener", "removeAddonListener",
"addInstallListener", "removeInstallListener",
"addManagerListener", "removeManagerListener",
- "mapURIToAddonID", "shutdown", "init",
+ "shutdown", "init",
"stateToString", "errorToString", "getUpgradeListener",
"addUpgradeListener", "removeUpgradeListener"];
const IGNORE_PRIVATE = ["AddonAuthor", "AddonCompatibilityOverride",
"AddonScreenshot", "AddonType", "startup", "shutdown",
"addonIsActive", "registerProvider", "unregisterProvider",
"addStartupChange", "removeStartupChange",
"getNewSideloads", "getNewDistroAddons",
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
@@ -2,17 +2,16 @@
skip-if = toolkit == 'android'
tags = addons
head = head_addons.js
firefox-appdir = browser
dupe-manifest =
support-files =
data/**
-[test_addon_path_service.js]
[test_addonStartup.js]
[test_asyncBlocklistLoad.js]
tags = blocklist
[test_blocklist_gfx.js]
tags = blocklist
[test_cache_certdb.js]
run-if = addon_signing
[test_cacheflush.js]
@@ -282,19 +281,16 @@ run-sequentially = Uses hardcoded ports
[test_isDebuggable.js]
[test_legacy.js]
skip-if = !allow_legacy_extensions || appname == "thunderbird"
[test_locale.js]
[test_locked.js]
[test_locked2.js]
[test_locked_strictcompat.js]
[test_manifest.js]
-[test_mapURIToAddonID.js]
-# Same as test_bootstrap.js
-skip-if = os == "android"
[test_no_addons.js]
[test_onPropertyChanged_appDisabled.js]
[test_permissions.js]
[test_permissions_prefs.js]
[test_plugins.js]
[test_pluginchange.js]
# PluginProvider.jsm is not shipped on Android
skip-if = os == "android"