Bug 476967 - Report strict warnings again. r+sr=jst
authorBlake Kaplan <mrbkap@gmail.com>
Wed, 25 Feb 2009 17:32:48 -0800
changeset 25523 66c6469a7c92a909aa63c0e8e1a7bb3c9c4a0cb8
parent 25522 95747b72826b16d8009ad3cbd8b73cd153270c01
child 25524 48f66b2b3c61e0a3c279bdcba68d25c370d538b1
push id5589
push usermrbkap@mozilla.com
push dateThu, 26 Feb 2009 01:34:20 +0000
treeherdermozilla-central@6b6128b32170 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs476967
milestone1.9.2a1pre
Bug 476967 - Report strict warnings again. r+sr=jst
dom/src/base/nsJSEnvironment.cpp
--- a/dom/src/base/nsJSEnvironment.cpp
+++ b/dom/src/base/nsJSEnvironment.cpp
@@ -420,36 +420,38 @@ NS_HandleScriptError(nsIScriptGlobalObje
 // it has not been done is that the code below only fills the error event
 // after it has a good nsPresContext - whereas using the above function
 // would involve always filling it.  Is that a concern?
 void
 NS_ScriptErrorReporter(JSContext *cx,
                        const char *message,
                        JSErrorReport *report)
 {
-  { // Scope for |fp|
+  // We don't want to report exceptions too eagerly, but warnings in the
+  // absence of werror are swallowed whole, so report those now.
+  if (!JSREPORT_IS_WARNING(report->flags)) {
     JSStackFrame * fp = nsnull;
     while ((fp = JS_FrameIterator(cx, &fp))) {
       if (!JS_IsNativeFrame(cx, fp)) {
         return;
       }
     }
-  }
-
-  nsIXPConnect* xpc = nsContentUtils::XPConnect();
-  if (xpc) {
-    nsAXPCNativeCallContext *cc = nsnull;
-    xpc->GetCurrentNativeCallContext(&cc);
-    if (cc) {
-      nsAXPCNativeCallContext *prev = cc;
-      while (NS_SUCCEEDED(prev->GetPreviousCallContext(&prev)) && prev) {
-        PRUint16 lang;
-        if (NS_SUCCEEDED(prev->GetLanguage(&lang)) &&
-          lang == nsAXPCNativeCallContext::LANG_JS) {
-          return;
+
+    nsIXPConnect* xpc = nsContentUtils::XPConnect();
+    if (xpc) {
+      nsAXPCNativeCallContext *cc = nsnull;
+      xpc->GetCurrentNativeCallContext(&cc);
+      if (cc) {
+        nsAXPCNativeCallContext *prev = cc;
+        while (NS_SUCCEEDED(prev->GetPreviousCallContext(&prev)) && prev) {
+          PRUint16 lang;
+          if (NS_SUCCEEDED(prev->GetLanguage(&lang)) &&
+            lang == nsAXPCNativeCallContext::LANG_JS) {
+            return;
+          }
         }
       }
     }
   }
 
   // XXX this means we are not going to get error reports on non DOM contexts
   nsIScriptContext *context = nsJSUtils::GetDynamicScriptContext(cx);