mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Bug 1030707 - Part 7: Replace AutoPushJSContext in WorkerPrivateParent<Derived>::DispatchMessageEventToMessagePort. r=bholley
This commit is contained in:
parent
d2ed64caf7
commit
04251dbdab
@ -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))) {
|
||||
|
Loading…
Reference in New Issue
Block a user