Bug 1030707 - Part 2: Replace AutoPushJSContext in DataStoreAddRunnable::MainThreadRun. r=bholley

This commit is contained in:
Bob Owen 2014-06-30 16:05:22 +01:00
parent b7eb3076e8
commit 459ceab3bb

View File

@ -285,16 +285,13 @@ protected:
{
AssertIsOnMainThread();
// Get the JSContext for the target window
nsCOMPtr<nsIScriptGlobalObject> sgo =
do_QueryInterface(static_cast<DOMEventTargetHelper*>
(mBackingStore.get())->GetOwner());
MOZ_ASSERT(sgo);
nsCOMPtr<nsIScriptContext> scriptContext = sgo->GetContext();
AutoPushJSContext cx(scriptContext ? scriptContext->GetNativeContext()
: nsContentUtils::GetSafeJSContext());
MOZ_ASSERT(cx);
// Initialise an AutoJSAPI with the target window.
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(mBackingStore->GetParentObject()))) {
mRv.Throw(NS_ERROR_UNEXPECTED);
return true;
}
JSContext* cx = jsapi.cx();
JS::Rooted<JS::Value> value(cx);
if (!mObjBuffer.read(cx, &value)) {