Backed out 2 changesets (bug 1663747) for causing xpcshell failures in ThrottledEventQueue.

CLOSED TREE

Backed out changeset 643aa6baf458 (bug 1663747)
Backed out changeset 491472fe44f4 (bug 1663747)
This commit is contained in:
Mihai Alexandru Michis 2020-09-22 03:54:59 +03:00
Родитель fd928bd229
Коммит a9f468308c
6 изменённых файлов: 11 добавлений и 40 удалений

Просмотреть файл

@ -2565,14 +2565,6 @@ ContentParent::~ContentParent() {
}
bool ContentParent::InitInternal(ProcessPriority aInitialPriority) {
// We can't access the locale service after shutdown has started. Since we
// can't init the process without it, and since we're going to be canceling
// whatever load attempt that initiated this process creation anyway, just
// bail out now if shutdown has already started.
if (PastShutdownPhase(ShutdownPhase::Shutdown)) {
return false;
}
XPCOMInitData xpcomInit;
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,

Просмотреть файл

@ -237,10 +237,7 @@ void VRServiceHost::SendPuppetSubmitToVRProcess(
}
void VRServiceHost::PuppetReset() {
// If we're already into ShutdownFinal, the VRPuppetCommandBuffer instance
// will have been cleared, so don't try to access it after that point.
if (!mVRProcessEnabled &&
!(NS_IsMainThread() && PastShutdownPhase(ShutdownPhase::ShutdownFinal))) {
if (!mVRProcessEnabled) {
// Puppet is running in this process, tell it to reset directly.
VRPuppetCommandBuffer::Get().Reset();
}

Просмотреть файл

@ -26,7 +26,6 @@
#include "nsSimpleEnumerator.h"
#include "nsStringStream.h"
#include "mozilla/BinarySearch.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/URLPreloader.h"
#include "mozilla/ResultExtensions.h"
@ -484,19 +483,6 @@ nsresult SharedStringBundle::LoadProperties() {
return NS_OK;
}
MOZ_ASSERT(NS_IsMainThread(),
"String bundles must be initialized on the main thread "
"before they may be used off-main-thread");
// We can't access the locale service after shutdown has started, which
// means we can't attempt to load chrome: locale resources (which most of
// our string bundles come from). Since shared string bundles won't be
// useful after shutdown has started anyway (and we almost certainly got
// here from a pre-load attempt in an idle task), just bail out.
if (PastShutdownPhase(ShutdownPhase::Shutdown)) {
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}
// We should only populate shared memory string bundles in the parent
// process. Instances in the child process should always be instantiated
// with a shared memory file descriptor sent from the parent.

Просмотреть файл

@ -309,6 +309,9 @@ mozJSComponentLoader::~mozJSComponentLoader() {
StaticRefPtr<mozJSComponentLoader> mozJSComponentLoader::sSelf;
// True if ShutdownPhase::ShutdownFinal has been reached.
static bool sShutdownFinal = false;
// For terrible compatibility reasons, we need to consider both the global
// lexical environment and the global of modules when searching for exported
// symbols.
@ -504,6 +507,8 @@ void mozJSComponentLoader::FindTargetObject(JSContext* aCx,
void mozJSComponentLoader::InitStatics() {
MOZ_ASSERT(!sSelf);
sSelf = new mozJSComponentLoader();
RunOnShutdown([&] { sShutdownFinal = true; });
}
void mozJSComponentLoader::Unload() {
@ -1192,7 +1197,7 @@ nsresult mozJSComponentLoader::Import(JSContext* aCx,
!mInProgressImports.Get(info.Key(), &mod)) {
// We're trying to import a new JSM, but we're late in shutdown and this
// will likely not succeed and might even crash, so fail here.
if (PastShutdownPhase(ShutdownPhase::ShutdownFinal)) {
if (sShutdownFinal) {
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}

Просмотреть файл

@ -16,7 +16,8 @@ ShutdownPhase sCurrentShutdownPhase = ShutdownPhase::NotInShutdown;
void InsertIntoShutdownList(ShutdownObserver* aObserver, ShutdownPhase aPhase) {
// Adding a ClearOnShutdown for a "past" phase is an error.
if (PastShutdownPhase(aPhase)) {
if (!(static_cast<size_t>(sCurrentShutdownPhase) <
static_cast<size_t>(aPhase))) {
MOZ_ASSERT(false, "ClearOnShutdown for phase that already was cleared");
aObserver->Shutdown();
delete aObserver;
@ -38,11 +39,8 @@ void KillClearOnShutdown(ShutdownPhase aPhase) {
MOZ_ASSERT(NS_IsMainThread());
// Shutdown only goes one direction...
MOZ_ASSERT(!PastShutdownPhase(aPhase));
// Set the phase before notifying observers to make sure that they can't run
// any code which isn't allowed to run after the start of this phase.
sCurrentShutdownPhase = aPhase;
MOZ_ASSERT(static_cast<size_t>(sCurrentShutdownPhase) <
static_cast<size_t>(aPhase));
// It's impossible to add an entry for a "past" phase; this is blocked in
// ClearOnShutdown, but clear them out anyways in case there are phases

Просмотреть файл

@ -129,13 +129,6 @@ inline void RunOnShutdown(CallableT&& aCallable,
new FunctionInvoker(std::forward<CallableT>(aCallable)), aPhase);
}
inline bool PastShutdownPhase(ShutdownPhase aPhase) {
MOZ_ASSERT(NS_IsMainThread());
return size_t(ClearOnShutdown_Internal::sCurrentShutdownPhase) >=
size_t(aPhase);
}
// Called when XPCOM is shutting down, after all shutdown notifications have
// been sent and after all threads' event loops have been purged.
void KillClearOnShutdown(ShutdownPhase aPhase);