mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1250291 part 2. Stop pretending to report exceptions in MainThreadWorkerSyncRunnable::PostDispatch. r=khuey
This commit is contained in:
parent
aeed64f72a
commit
307a76a0c0
@ -469,7 +469,18 @@ MainThreadWorkerSyncRunnable::PostDispatch(JSContext* aCx,
|
||||
WorkerPrivate* aWorkerPrivate,
|
||||
bool aDispatchResult)
|
||||
{
|
||||
MaybeReportMainThreadException(aCx, aDispatchResult);
|
||||
// The only way aDispatchResult can be false here is if either PreDispatch or
|
||||
// DispatchInternal returned false.
|
||||
//
|
||||
// Our PreDispatch always returns true and is final. We inherit
|
||||
// DispatchInternal from WorkerSyncRunnable and don't allow overriding it in
|
||||
// our subclasses. WorkerSyncRunnable::DispatchInternal only returns false if
|
||||
// if dispatch to the syncloop target fails or if calling up to
|
||||
// WorkerRunnable::DispatchInternal fails. WorkerRunnable::DispatchInternal
|
||||
// only fails if one of its runnable dispatching functions fails, and none of
|
||||
// those cases can throw a JS exception. So we can never have a JS exception
|
||||
// here.
|
||||
MOZ_ASSERT_IF(aCx, !JS_IsExceptionPending(aCx));
|
||||
}
|
||||
|
||||
StopSyncLoopRunnable::StopSyncLoopRunnable(
|
||||
|
@ -213,7 +213,6 @@ protected:
|
||||
|
||||
virtual ~WorkerSyncRunnable();
|
||||
|
||||
private:
|
||||
virtual bool
|
||||
DispatchInternal() override;
|
||||
};
|
||||
@ -242,14 +241,34 @@ protected:
|
||||
virtual ~MainThreadWorkerSyncRunnable()
|
||||
{ }
|
||||
|
||||
// Hook for subclasses that want to override our PreDispatch. This override
|
||||
// must be infallible and must not leave an exception hanging out on the
|
||||
// JSContext. We pass the JSContext through so callees that expect to be able
|
||||
// to do something with script have a way to do it. We'd pass an AutoJSAPI,
|
||||
// but some of our subclasses are dispatched with a null JSContext*, so we
|
||||
// can't do that sort of thing ourselves.
|
||||
virtual void InfalliblePreDispatch(JSContext* aCx)
|
||||
{}
|
||||
|
||||
private:
|
||||
virtual bool
|
||||
PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
|
||||
PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override final
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
InfalliblePreDispatch(aCx);
|
||||
MOZ_ASSERT_IF(aCx, !JS_IsExceptionPending(aCx));
|
||||
return true;
|
||||
}
|
||||
|
||||
// We want to be able to assert in PostDispatch that no exceptions were thrown
|
||||
// on aCx. We can do that if we know no one is subclassing our
|
||||
// DispatchInternal to do weird things.
|
||||
virtual bool
|
||||
DispatchInternal() override final
|
||||
{
|
||||
return WorkerSyncRunnable::DispatchInternal();
|
||||
}
|
||||
|
||||
virtual void
|
||||
PostDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
|
||||
bool aDispatchResult) override;
|
||||
|
@ -591,8 +591,8 @@ private:
|
||||
~EventRunnable()
|
||||
{ }
|
||||
|
||||
virtual bool
|
||||
PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override;
|
||||
virtual void
|
||||
InfalliblePreDispatch(JSContext* aCx) override final;
|
||||
|
||||
virtual bool
|
||||
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override;
|
||||
@ -1170,10 +1170,19 @@ LoadStartDetectionRunnable::HandleEvent(nsIDOMEvent* aEvent)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
EventRunnable::PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
||||
void
|
||||
EventRunnable::InfalliblePreDispatch(JSContext* aCx)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aCx);
|
||||
MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx));
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
DebugOnly<bool> ok =
|
||||
jsapi.Init(xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx)), aCx);
|
||||
MOZ_ASSERT(ok);
|
||||
MOZ_ASSERT(jsapi.cx() == aCx);
|
||||
jsapi.TakeOwnershipOfErrorReporting();
|
||||
|
||||
RefPtr<nsXMLHttpRequest>& xhr = mProxy->mXHR;
|
||||
MOZ_ASSERT(xhr);
|
||||
@ -1244,8 +1253,6 @@ EventRunnable::PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
||||
mReadyState = xhr->ReadyState();
|
||||
|
||||
xhr->GetResponseURL(mResponseURL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user