Skip to content

Commit dcfe63b

Browse files
committed
Bug 1667276 - Pre: Disable extension manager in background tasks mode. r=mossop
Differential Revision: https://phabricator.services.mozilla.com/D97509
1 parent dedd68d commit dcfe63b

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

toolkit/xre/moz.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,6 @@ if CONFIG["MOZ_IPDL_TESTS"]:
285285

286286
if CONFIG["ENABLE_TESTS"]:
287287
DIRS += ["test/gtest"]
288+
289+
if CONFIG["MOZ_BACKGROUNDTASKS"]:
290+
DEFINES["MOZ_BACKGROUNDTASKS"] = True

toolkit/xre/nsXREDirProvider.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
#include "mozilla/dom/ScriptSettings.h"
4040

4141
#include "mozilla/AutoRestore.h"
42+
#ifdef MOZ_BACKGROUNDTASKS
43+
# include "mozilla/BackgroundTasks.h"
44+
#endif
4245
#include "mozilla/Components.h"
4346
#include "mozilla/Services.h"
4447
#include "mozilla/Omnijar.h"
@@ -966,13 +969,21 @@ nsXREDirProvider::DoStartup() {
966969
mozilla::SandboxBroker::GeckoDependentInitialize();
967970
#endif
968971

969-
// Init the Extension Manager
970-
nsCOMPtr<nsIObserver> em =
971-
do_GetService("@mozilla.org/addons/integration;1");
972-
if (em) {
973-
em->Observe(nullptr, "addons-startup", nullptr);
974-
} else {
975-
NS_WARNING("Failed to create Addons Manager.");
972+
bool initExtensionManager =
973+
#ifdef MOZ_BACKGROUNDTASKS
974+
!mozilla::BackgroundTasks::IsBackgroundTaskMode();
975+
#else
976+
true;
977+
#endif
978+
if (initExtensionManager) {
979+
// Init the Extension Manager
980+
nsCOMPtr<nsIObserver> em =
981+
do_GetService("@mozilla.org/addons/integration;1");
982+
if (em) {
983+
em->Observe(nullptr, "addons-startup", nullptr);
984+
} else {
985+
NS_WARNING("Failed to create Addons Manager.");
986+
}
976987
}
977988

978989
obsSvc->NotifyObservers(nullptr, "profile-after-change", kStartup);

0 commit comments

Comments
 (0)