Bug 960246 - Handle failures when running message manager message handlers (r=smaug)
authorBill McCloskey <wmccloskey@mozilla.com>
Thu, 16 Jan 2014 11:43:34 -0800
changeset 163904 2e1513b84c6c1e3a36f7b5ed91304a8f0aeb8825
parent 163903 3dcedecd2bbf2559e823de41b96cbaecc7417811
child 163905 22d173f734962cf1cd81706374591b60629b2a32
push id38584
push usercbook@mozilla.com
push dateFri, 17 Jan 2014 10:04:30 +0000
treeherdermozilla-inbound@28a9d7e2416f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs960246
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 960246 - Handle failures when running message manager message handlers (r=smaug)
content/base/src/nsFrameMessageManager.cpp
--- a/content/base/src/nsFrameMessageManager.cpp
+++ b/content/base/src/nsFrameMessageManager.cpp
@@ -1039,24 +1039,29 @@ nsFrameMessageManager::ReceiveMessage(ns
       {
         JS::Rooted<JSObject*> thisObject(cx, thisValue.toObjectOrNull());
 
         JSAutoCompartment tac(cx, thisObject);
         if (!JS_WrapValue(cx, &argv)) {
           return NS_ERROR_UNEXPECTED;
         }
 
-        JS_CallFunctionValue(cx, thisObject,
-                             funval, 1, argv.address(), rval.address());
+        if (!JS_CallFunctionValue(cx, thisObject,
+                                  funval, 1, argv.address(), rval.address())) {
+          nsJSUtils::ReportPendingException(cx);
+          continue;
+        }
         if (aJSONRetVal) {
           nsString json;
-          if (JS_Stringify(cx, &rval, JS::NullPtr(), JS::NullHandleValue,
+          if (!JS_Stringify(cx, &rval, JS::NullPtr(), JS::NullHandleValue,
                            JSONCreator, &json)) {
-            aJSONRetVal->AppendElement(json);
+            nsJSUtils::ReportPendingException(cx);
+            continue;
           }
+          aJSONRetVal->AppendElement(json);
         }
       }
     }
   }
   nsRefPtr<nsFrameMessageManager> kungfuDeathGrip = mParentManager;
   return mParentManager ? mParentManager->ReceiveMessage(aTarget, aMessage,
                                                          aIsSync, aCloneData,
                                                          aCpows, aPrincipal,