Bug 834732 - Move cx pushing into nsPluginProtoChainInstallRunner. r=mrbkap

This gets rid of the last use of REQUIRE_SCRIPT_CONTEXT. \o/
This commit is contained in:
Bobby Holley 2013-02-13 00:22:26 +01:00
parent f71f3899d1
commit 39acf0afd1
2 changed files with 7 additions and 16 deletions

View File

@ -2576,6 +2576,8 @@ nsObjectLoadingContent::NotifyContentObjectWrapper()
return;
JSContext *cx = scx->GetNativeContext();
nsCxPusher pusher;
pusher.Push(cx, nsCxPusher::ASSERT_SCRIPT_CONTEXT);
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
nsContentUtils::XPConnect()->

View File

@ -8510,17 +8510,10 @@ public:
NS_IMETHOD Run()
{
JSContext* cx = nullptr;
if (mContext) {
cx = mContext->GetNativeContext();
} else {
nsCOMPtr<nsIThreadJSContextStack> stack =
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
NS_ENSURE_TRUE(stack, NS_OK);
cx = stack->GetSafeJSContext();
NS_ENSURE_TRUE(cx, NS_OK);
}
nsCxPusher pusher;
JSContext* cx = mContext ? mContext->GetNativeContext()
: nsContentUtils::GetSafeJSContext();
pusher.Push(cx, nsCxPusher::ALWAYS_PUSH);
JSObject* obj = nullptr;
mWrapper->GetJSObject(&obj);
@ -8544,11 +8537,7 @@ nsHTMLPluginObjElementSH::SetupProtoChain(nsIXPConnectWrappedNative *wrapper,
{
NS_ASSERTION(nsContentUtils::IsSafeToRunScript(),
"Shouldn't have gotten in here");
nsCxPusher cxPusher;
if (!cxPusher.Push(cx, nsCxPusher::REQUIRE_SCRIPT_CONTEXT)) {
return NS_OK;
}
MOZ_ASSERT(cx == nsContentUtils::GetCurrentJSContext());
JSAutoRequest ar(cx);
JSAutoCompartment ac(cx, obj);