Bug 914939 - Don't assert against OOM in XPCWrappedJS QI hooks. r=gabor, a=lsblakk
authorBobby Holley <bobbyholley@gmail.com>
Wed, 18 Sep 2013 08:34:12 -0700
changeset 160354 f9163b5efff8426f22572a4935b388c5917cb40f
parent 160353 c64b37f395e2f67588db757368146dcf0cf12ca7
child 160355 fc8be763d914070abc21d0be4f606ba1da0b2534
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor, lsblakk
bugs914939
milestone26.0a2
Bug 914939 - Don't assert against OOM in XPCWrappedJS QI hooks. r=gabor, a=lsblakk
js/xpconnect/src/XPCWrappedJSClass.cpp
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp
+++ b/js/xpconnect/src/XPCWrappedJSClass.cpp
@@ -247,20 +247,17 @@ nsXPCWrappedJSClass::CallQueryInterfaceO
         uint32_t oldOpts =
           JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_DONT_REPORT_UNCAUGHT);
 
         jsval args[1] = {OBJECT_TO_JSVAL(id)};
         success = JS_CallFunctionValue(cx, jsobj, fun, 1, args, retval.address());
 
         JS_SetOptions(cx, oldOpts);
 
-        if (!success) {
-            MOZ_ASSERT(JS_IsExceptionPending(cx),
-                       "JS failed without setting an exception!");
-
+        if (!success && JS_IsExceptionPending(cx)) {
             RootedValue jsexception(cx, NullValue());
 
             if (JS_GetPendingException(cx, jsexception.address())) {
                 nsresult rv;
                 if (jsexception.isObject()) {
                     // XPConnect may have constructed an object to represent a
                     // C++ QI failure. See if that is the case.
                     using namespace mozilla::dom;
@@ -285,16 +282,18 @@ nsXPCWrappedJSClass::CallQueryInterfaceO
                     if (rv == NS_NOINTERFACE)
                         JS_ClearPendingException(cx);
                 }
             }
 
             // Don't report if reporting was disabled by someone else.
             if (!(oldOpts & JSOPTION_DONT_REPORT_UNCAUGHT))
                 JS_ReportPendingException(cx);
+        } else if (!success) {
+            NS_WARNING("QI hook ran OOMed - this is probably a bug!");
         }
     }
 
     if (success)
         success = JS_ValueToObject(cx, retval, retObj.address());
 
     return success ? retObj.get() : nullptr;
 }