Bug 1030707 - Part 7: Replace AutoPushJSContext in WorkerPrivateParent<Derived>::DispatchMessageEventToMessagePort. r=bholley

This commit is contained in:
Bob Owen 2014-06-30 20:39:15 +01:00
parent d2ed64caf7
commit 04251dbdab

View File

@ -2821,16 +2821,11 @@ WorkerPrivateParent<Derived>::DispatchMessageEventToMessagePort(
return true;
}
nsCOMPtr<nsIScriptGlobalObject> sgo;
port->GetParentObject(getter_AddRefs(sgo));
MOZ_ASSERT(sgo, "Should never happen if IsClosed() returned false!");
MOZ_ASSERT(sgo->GetGlobalJSObject());
nsCOMPtr<nsIScriptContext> scx = sgo->GetContext();
MOZ_ASSERT_IF(scx, scx->GetNativeContext());
AutoPushJSContext cx(scx ? scx->GetNativeContext() : aCx);
JSAutoCompartment(cx, sgo->GetGlobalJSObject());
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(port->GetParentObject()))) {
return false;
}
JSContext* cx = jsapi.cx();
JS::Rooted<JS::Value> data(cx);
if (!buffer.read(cx, &data, WorkerStructuredCloneCallbacks(true))) {