mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 1453986 - Remove possiblity of recursive GetService call when tracing r=smaug
--HG-- extra : rebase_source : 8319cf6afdde021eed71c25a8c6a1c21b7f65e18
This commit is contained in:
parent
9184648e44
commit
6b7ad264ec
@ -13,6 +13,8 @@
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
bool ProcessGlobal::sWasCreated = false;
|
||||
|
||||
ProcessGlobal::ProcessGlobal(nsFrameMessageManager* aMessageManager)
|
||||
: MessageManagerGlobal(aMessageManager),
|
||||
mInitialized(false)
|
||||
@ -63,7 +65,17 @@ ProcessGlobal::Get()
|
||||
if (!service) {
|
||||
return nullptr;
|
||||
}
|
||||
return static_cast<ProcessGlobal*>(service.get());
|
||||
ProcessGlobal* global = static_cast<ProcessGlobal*>(service.get());
|
||||
if (global) {
|
||||
sWasCreated = true;
|
||||
}
|
||||
return global;
|
||||
}
|
||||
|
||||
bool
|
||||
ProcessGlobal::WasCreated()
|
||||
{
|
||||
return sWasCreated;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
bool Init();
|
||||
|
||||
static ProcessGlobal* Get();
|
||||
static bool WasCreated();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(ProcessGlobal, nsIMessageSender)
|
||||
@ -100,6 +101,8 @@ protected:
|
||||
|
||||
private:
|
||||
bool mInitialized;
|
||||
|
||||
static bool sWasCreated;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -469,7 +469,7 @@ mozilla::dom::TraceBlackJS(JSTracer* aTrc, bool aIsShutdownGC)
|
||||
return;
|
||||
}
|
||||
|
||||
if (nsFrameMessageManager::GetChildProcessManager()) {
|
||||
if (ProcessGlobal::WasCreated() && nsFrameMessageManager::GetChildProcessManager()) {
|
||||
ProcessGlobal* pg = ProcessGlobal::Get();
|
||||
if (pg) {
|
||||
mozilla::TraceScriptHolder(ToSupports(pg), aTrc);
|
||||
|
Loading…
Reference in New Issue
Block a user