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 67eada4944
commit f6d6db4d7e

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)) {