mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 834732 - Make nsDocShell::AddState push the JSContext if it grabs one, and remove push in nsStructuredCloneContainer. r=mrbkap
This gets rid of one of the last consumers of REQUIRE_SCRIPT_CONTEXT.
This commit is contained in:
parent
90a1dbb7be
commit
cfbc405fc8
@ -10199,8 +10199,10 @@ nsDocShell::AddState(nsIVariant *aData, const nsAString& aTitle,
|
||||
|
||||
scContainer = new nsStructuredCloneContainer();
|
||||
JSContext *cx = aCx;
|
||||
nsCxPusher pusher;
|
||||
if (!cx) {
|
||||
cx = nsContentUtils::GetContextFromDocument(document);
|
||||
pusher.Push(cx, nsCxPusher::ASSERT_SCRIPT_CONTEXT);
|
||||
}
|
||||
rv = scContainer->InitFromVariant(aData, cx);
|
||||
|
||||
|
@ -50,13 +50,11 @@ nsStructuredCloneContainer::InitFromVariant(nsIVariant *aData, JSContext *aCx)
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
|
||||
|
||||
// Make sure that we serialize in the right context.
|
||||
MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
|
||||
JSAutoRequest ar(aCx);
|
||||
JSAutoCompartment ac(aCx, JS_GetGlobalObject(aCx));
|
||||
JS_WrapValue(aCx, &jsData);
|
||||
|
||||
nsCxPusher cxPusher;
|
||||
cxPusher.Push(aCx, nsCxPusher::REQUIRE_SCRIPT_CONTEXT);
|
||||
|
||||
uint64_t* jsBytes = nullptr;
|
||||
bool success = JS_WriteStructuredClone(aCx, jsData, &jsBytes, &mSize,
|
||||
nullptr, nullptr, JSVAL_VOID);
|
||||
|
Loading…
Reference in New Issue
Block a user