mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Backed out 2 changesets (bug 1250963) for build bustage CLOSED TREE
Backed out changeset 257324c2ae17 (bug 1250963) Backed out changeset 0e868ee89abc (bug 1250963) --HG-- extra : commitid : HglxXI0Tb1b
This commit is contained in:
parent
d66f0ad3fc
commit
56ccaea947
@ -2146,13 +2146,19 @@ RuntimeService::CancelWorkersForWindow(nsPIDOMWindowInner* aWindow)
|
||||
GetWorkersForWindow(aWindow, workers);
|
||||
|
||||
if (!workers.IsEmpty()) {
|
||||
AutoJSAPI jsapi;
|
||||
if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(aWindow))) {
|
||||
return;
|
||||
}
|
||||
JSContext* cx = jsapi.cx();
|
||||
|
||||
for (uint32_t index = 0; index < workers.Length(); index++) {
|
||||
WorkerPrivate*& worker = workers[index];
|
||||
|
||||
if (worker->IsSharedWorker()) {
|
||||
worker->CloseSharedWorkersForWindow(aWindow);
|
||||
} else {
|
||||
worker->Cancel();
|
||||
} else if (!worker->Cancel(cx)) {
|
||||
JS_ReportPendingException(cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ private:
|
||||
virtual bool
|
||||
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
|
||||
{
|
||||
return aWorkerPrivate->ModifyBusyCount(mIncrease);
|
||||
return aWorkerPrivate->ModifyBusyCount(aCx, mIncrease);
|
||||
}
|
||||
|
||||
virtual void
|
||||
@ -847,33 +847,23 @@ public:
|
||||
aStatus == Canceling || aStatus == Killing);
|
||||
}
|
||||
|
||||
// We can be dispatched without a JSContext, because all we do with the
|
||||
// JSContext passed to Dispatch() normally for worker runnables is call
|
||||
// ModifyBusyCount... but that doesn't actually use its JSContext argument.
|
||||
bool Dispatch()
|
||||
{
|
||||
return WorkerControlRunnable::Dispatch(nullptr);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual bool
|
||||
PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
|
||||
{
|
||||
aWorkerPrivate->AssertIsOnParentThread();
|
||||
// Modify here, but not in PostRun! This busy count addition will be matched
|
||||
// by the CloseEventRunnable.
|
||||
return aWorkerPrivate->ModifyBusyCount(true);
|
||||
return aWorkerPrivate->ModifyBusyCount(aCx, true);
|
||||
}
|
||||
|
||||
virtual void
|
||||
PostDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
|
||||
bool aDispatchResult) override
|
||||
{
|
||||
aWorkerPrivate->AssertIsOnParentThread();
|
||||
if (!aDispatchResult) {
|
||||
// We couldn't dispatch to the worker, which means it's already dead.
|
||||
// Undo the busy count modification.
|
||||
aWorkerPrivate->ModifyBusyCount(false);
|
||||
aWorkerPrivate->ModifyBusyCount(aCx, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -896,7 +886,7 @@ private:
|
||||
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
|
||||
{
|
||||
// This busy count will be matched by the CloseEventRunnable.
|
||||
return aWorkerPrivate->ModifyBusyCount(true) &&
|
||||
return aWorkerPrivate->ModifyBusyCount(aCx, true) &&
|
||||
aWorkerPrivate->Close();
|
||||
}
|
||||
};
|
||||
@ -2529,7 +2519,7 @@ WorkerPrivateParent<Derived>::Start()
|
||||
// aCx is null when called from the finalizer
|
||||
template <class Derived>
|
||||
bool
|
||||
WorkerPrivateParent<Derived>::NotifyPrivate(Status aStatus)
|
||||
WorkerPrivateParent<Derived>::NotifyPrivate(JSContext* aCx, Status aStatus)
|
||||
{
|
||||
AssertIsOnParentThread();
|
||||
|
||||
@ -2581,7 +2571,7 @@ WorkerPrivateParent<Derived>::NotifyPrivate(Status aStatus)
|
||||
|
||||
RefPtr<NotifyRunnable> runnable =
|
||||
new NotifyRunnable(ParentAsWorkerPrivate(), aStatus);
|
||||
return runnable->Dispatch();
|
||||
return runnable->Dispatch(aCx);
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
@ -2788,7 +2778,7 @@ WorkerPrivateParent<Derived>::Close()
|
||||
|
||||
template <class Derived>
|
||||
bool
|
||||
WorkerPrivateParent<Derived>::ModifyBusyCount(bool aIncrease)
|
||||
WorkerPrivateParent<Derived>::ModifyBusyCount(JSContext* aCx, bool aIncrease)
|
||||
{
|
||||
AssertIsOnParentThread();
|
||||
|
||||
@ -2807,7 +2797,7 @@ WorkerPrivateParent<Derived>::ModifyBusyCount(bool aIncrease)
|
||||
shouldCancel = mParentStatus == Terminating;
|
||||
}
|
||||
|
||||
if (shouldCancel && !Cancel()) {
|
||||
if (shouldCancel && !Cancel(aCx)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -3342,8 +3332,8 @@ WorkerPrivateParent<Derived>::CloseSharedWorkersForWindow(
|
||||
if (!Freeze(cx, nullptr)) {
|
||||
JS_ReportPendingException(cx);
|
||||
}
|
||||
} else {
|
||||
Cancel();
|
||||
} else if (!Cancel(cx)) {
|
||||
JS_ReportPendingException(cx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3360,7 +3350,10 @@ WorkerPrivateParent<Derived>::CloseAllSharedWorkers()
|
||||
|
||||
mSharedWorkers.Clear();
|
||||
|
||||
Cancel();
|
||||
AutoSafeJSContext cx;
|
||||
if (!Cancel(cx)) {
|
||||
JS_ReportPendingException(cx);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
@ -5192,7 +5185,7 @@ WorkerPrivate::NotifyFeatures(JSContext* aCx, Status aStatus)
|
||||
children.AppendElements(mChildWorkers);
|
||||
|
||||
for (uint32_t index = 0; index < children.Length(); index++) {
|
||||
if (!children[index]->Notify(aStatus)) {
|
||||
if (!children[index]->Notify(aCx, aStatus)) {
|
||||
NS_WARNING("Failed to notify child worker!");
|
||||
}
|
||||
}
|
||||
|
@ -218,13 +218,13 @@ private:
|
||||
|
||||
// aCx is null when called from the finalizer
|
||||
bool
|
||||
NotifyPrivate(Status aStatus);
|
||||
NotifyPrivate(JSContext* aCx, Status aStatus);
|
||||
|
||||
// aCx is null when called from the finalizer
|
||||
bool
|
||||
TerminatePrivate(JSContext* aCx)
|
||||
{
|
||||
return NotifyPrivate(Terminating);
|
||||
return NotifyPrivate(aCx, Terminating);
|
||||
}
|
||||
|
||||
void
|
||||
@ -282,21 +282,21 @@ public:
|
||||
|
||||
// Called on the parent thread.
|
||||
bool
|
||||
Notify(Status aStatus)
|
||||
Notify(JSContext* aCx, Status aStatus)
|
||||
{
|
||||
return NotifyPrivate(aStatus);
|
||||
return NotifyPrivate(aCx, aStatus);
|
||||
}
|
||||
|
||||
bool
|
||||
Cancel()
|
||||
Cancel(JSContext* aCx)
|
||||
{
|
||||
return Notify(Canceling);
|
||||
return Notify(aCx, Canceling);
|
||||
}
|
||||
|
||||
bool
|
||||
Kill(JSContext* aCx)
|
||||
{
|
||||
return Notify(Killing);
|
||||
return Notify(aCx, Killing);
|
||||
}
|
||||
|
||||
// We can assume that an nsPIDOMWindow will be available for Freeze, Thaw
|
||||
@ -324,7 +324,7 @@ public:
|
||||
Close();
|
||||
|
||||
bool
|
||||
ModifyBusyCount(bool aIncrease);
|
||||
ModifyBusyCount(JSContext* aCx, bool aIncrease);
|
||||
|
||||
void
|
||||
ForgetOverridenLoadGroup(nsCOMPtr<nsILoadGroup>& aLoadGroupOut);
|
||||
|
@ -84,7 +84,7 @@ WorkerRunnable::PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
||||
#endif
|
||||
|
||||
if (mBehavior == WorkerThreadModifyBusyCount) {
|
||||
return aWorkerPrivate->ModifyBusyCount(true);
|
||||
return aWorkerPrivate->ModifyBusyCount(aCx, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -178,7 +178,7 @@ WorkerRunnable::PostDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
|
||||
|
||||
if (!aDispatchResult) {
|
||||
if (mBehavior == WorkerThreadModifyBusyCount) {
|
||||
aWorkerPrivate->ModifyBusyCount(false);
|
||||
aWorkerPrivate->ModifyBusyCount(aCx, false);
|
||||
}
|
||||
if (aCx) {
|
||||
JS_ReportPendingException(aCx);
|
||||
|
Loading…
Reference in New Issue
Block a user