From 0e03ff41f56f3c3a07d10ee33293f4631fec2fba Mon Sep 17 00:00:00 2001 From: Bob Owen Date: Mon, 30 Jun 2014 20:17:09 +0100 Subject: [PATCH] Bug 1030707 - Part 4: Replace AutoPushJSContext in RuntimeService::SuspendWorkersForWindow. r=bholley --- dom/workers/RuntimeService.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index 4981a4200ec..c3c9eaf2906 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -2099,14 +2099,11 @@ RuntimeService::SuspendWorkersForWindow(nsPIDOMWindow* aWindow) GetWorkersForWindow(aWindow, workers); if (!workers.IsEmpty()) { - nsCOMPtr sgo = do_QueryInterface(aWindow); - MOZ_ASSERT(sgo); - - nsIScriptContext* scx = sgo->GetContext(); - - AutoPushJSContext cx(scx ? - scx->GetNativeContext() : - nsContentUtils::GetSafeJSContext()); + AutoJSAPI jsapi; + if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(aWindow))) { + return; + } + JSContext* cx = jsapi.cx(); for (uint32_t index = 0; index < workers.Length(); index++) { if (!workers[index]->Suspend(cx, aWindow)) {