Bug 1098074 - Part 1: Use AutoJSAPI to report JS errors in nsFrameMessageManager; r=bholley

--HG--
extra : rebase_source : c61375bb851385e6e859b85ee97293ebf12e77ce
This commit is contained in:
Terrence Cole 2014-11-12 16:48:51 -08:00
Родитель ae5c2d16a1
Коммит e211ebf6cc
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -976,6 +976,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
nsIGlobalObject* nativeGlobal =
xpc::NativeGlobal(js::GetGlobalForObjectCrossCompartment(wrappedJS->GetJSObject()));
AutoEntryScript aes(nativeGlobal);
aes.TakeOwnershipOfErrorReporting();
JSContext* cx = aes.cx();
JS::Rooted<JSObject*> object(cx, wrappedJS->GetJSObject());
@ -1076,15 +1077,14 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
return NS_ERROR_UNEXPECTED;
}
if (!JS_CallFunctionValue(cx, thisObject, funval, JS::HandleValueArray(argv), &rval)) {
nsJSUtils::ReportPendingException(cx);
if (!JS_CallFunctionValue(cx, thisObject, funval,
JS::HandleValueArray(argv), &rval)) {
continue;
}
if (aJSONRetVal) {
nsString json;
if (!JS_Stringify(cx, &rval, JS::NullPtr(), JS::NullHandleValue,
JSONCreator, &json)) {
nsJSUtils::ReportPendingException(cx);
continue;
}
aJSONRetVal->AppendElement(json);