зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1117977, make script load handling during shutdown safer, r=mccr8
--HG-- extra : rebase_source : fba82b840d622eed610c90ed9a56a5f0c7d1156f
This commit is contained in:
Родитель
c0d53e2918
Коммит
28ffbe8fb9
|
@ -44,6 +44,7 @@
|
|||
#include "nsCRT.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsCORSListenerProxy.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "nsContentTypeParser.h"
|
||||
#include "nsINetworkPredictor.h"
|
||||
|
@ -796,6 +797,8 @@ public:
|
|||
: mRequest(aRequest), mLoader(aLoader), mToken(nullptr)
|
||||
{}
|
||||
|
||||
virtual ~NotifyOffThreadScriptLoadCompletedRunnable();
|
||||
|
||||
void SetToken(void* aToken) {
|
||||
MOZ_ASSERT(aToken && !mToken);
|
||||
mToken = aToken;
|
||||
|
@ -814,6 +817,23 @@ nsScriptLoader::ProcessOffThreadRequest(nsScriptLoadRequest* aRequest, void **aO
|
|||
return rv;
|
||||
}
|
||||
|
||||
NotifyOffThreadScriptLoadCompletedRunnable::~NotifyOffThreadScriptLoadCompletedRunnable()
|
||||
{
|
||||
if (MOZ_UNLIKELY(mRequest || mLoader) && !NS_IsMainThread()) {
|
||||
nsCOMPtr<nsIThread> mainThread;
|
||||
NS_GetMainThread(getter_AddRefs(mainThread));
|
||||
if (mainThread) {
|
||||
NS_ProxyRelease(mainThread, mRequest);
|
||||
NS_ProxyRelease(mainThread, mLoader);
|
||||
} else {
|
||||
MOZ_ASSERT(false, "We really shouldn't leak!");
|
||||
// Better to leak than crash.
|
||||
unused << mRequest.forget();
|
||||
unused << mLoader.forget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NotifyOffThreadScriptLoadCompletedRunnable::Run()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче