зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1265035 - Make ~WorkerJSRuntime() handle Initialize() failure better. r=khuey.
--HG-- extra : rebase_source : 4b2cb2ef8192f314a28556826044f010a52b90b4
This commit is contained in:
Родитель
a03b12c9e4
Коммит
d84e6264da
|
@ -880,8 +880,10 @@ public:
|
|||
|
||||
~WorkerJSRuntime()
|
||||
{
|
||||
JSRuntime* rt = Runtime();
|
||||
MOZ_ASSERT(rt);
|
||||
JSRuntime* rt = MaybeRuntime();
|
||||
if (!rt) {
|
||||
return; // Initialize() must have failed
|
||||
}
|
||||
|
||||
delete static_cast<WorkerThreadRuntimePrivate*>(JS_GetRuntimePrivate(rt));
|
||||
JS_SetRuntimePrivate(rt, nullptr);
|
||||
|
|
|
@ -1591,6 +1591,10 @@ ReloadPrefsCallback(const char* pref, void* data)
|
|||
|
||||
XPCJSRuntime::~XPCJSRuntime()
|
||||
{
|
||||
// Elsewhere we abort immediately if XPCJSRuntime initialization fails.
|
||||
// Therefore the runtime must be non-null.
|
||||
MOZ_ASSERT(MaybeRuntime());
|
||||
|
||||
// This destructor runs before ~CycleCollectedJSRuntime, which does the
|
||||
// actual JS_DestroyRuntime() call. But destroying the runtime triggers
|
||||
// one final GC, which can call back into the runtime with various
|
||||
|
|
|
@ -321,6 +321,10 @@ public:
|
|||
return mJSRuntime;
|
||||
}
|
||||
|
||||
protected:
|
||||
JSRuntime* MaybeRuntime() const { return mJSRuntime; }
|
||||
|
||||
public:
|
||||
// nsThread entrypoints
|
||||
virtual void BeforeProcessTask(bool aMightBlock) { };
|
||||
virtual void AfterProcessTask(uint32_t aRecursionDepth);
|
||||
|
|
Загрузка…
Ссылка в новой задаче