Bug 1107684 - ScriptSettings.cpp xpc::ErrorReport::Init() callers should not pass string where boolean is expected. r=bholley, a=sledru
authorNikhil Marathe <nsm.nikhil@gmail.com>
Thu, 04 Dec 2014 09:47:48 -0800
changeset 234170 ed58170e917830148ed4c52dbbb0e2b5ad84c1d5
parent 234169 8023d94b63bdbc1d6d0842559f4390ce2e0025da
child 234172 d424db9bb5a0a8cd401d70b35874ed5252848b95
push id4215
push userryanvm@gmail.com
push dateThu, 11 Dec 2014 15:29:12 +0000
treeherdermozilla-beta@ed58170e9178 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley, sledru
bugs1107684
milestone35.0
Bug 1107684 - ScriptSettings.cpp xpc::ErrorReport::Init() callers should not pass string where boolean is expected. r=bholley, a=sledru
dom/base/ScriptSettings.cpp
--- a/dom/base/ScriptSettings.cpp
+++ b/dom/base/ScriptSettings.cpp
@@ -286,23 +286,22 @@ AutoJSAPI::~AutoJSAPI()
       // requires us to be in a compartment when we fetch the pending exception.
       // In this case, we enter the privileged junk scope and don't dispatch any
       // error events.
       JS::Rooted<JSObject*> errorGlobal(cx(), JS::CurrentGlobalOrNull(cx()));
       if (!errorGlobal)
         errorGlobal = xpc::PrivilegedJunkScope();
       JSAutoCompartment ac(cx(), errorGlobal);
       nsCOMPtr<nsPIDOMWindow> win = xpc::WindowGlobalOrNull(errorGlobal);
-      const char *category = nsContentUtils::IsCallerChrome() ? "chrome javascript"
-                                                              : "content javascript";
       JS::Rooted<JS::Value> exn(cx());
       js::ErrorReport jsReport(cx());
       if (StealException(&exn) && jsReport.init(cx(), exn)) {
         nsRefPtr<xpc::ErrorReport> xpcReport = new xpc::ErrorReport();
-        xpcReport->Init(jsReport.report(), jsReport.message(), category,
+        xpcReport->Init(jsReport.report(), jsReport.message(),
+                        nsContentUtils::IsCallerChrome(),
                         win ? win->WindowID() : 0);
         if (win) {
           DispatchScriptErrorEvent(win, JS_GetRuntime(cx()), xpcReport, exn);
         } else {
           xpcReport->LogToConsole();
         }
       } else {
         NS_WARNING("OOMed while acquiring uncaught exception from JSAPI");
@@ -443,20 +442,19 @@ AutoJSAPI::InitWithLegacyErrorReporting(
 // the console, so we can handle them easily here.
 //
 // Eventually, SpiderMonkey will have a special-purpose callback for warnings only.
 void
 WarningOnlyErrorReporter(JSContext* aCx, const char* aMessage, JSErrorReport* aRep)
 {
   MOZ_ASSERT(JSREPORT_IS_WARNING(aRep->flags));
   nsRefPtr<xpc::ErrorReport> xpcReport = new xpc::ErrorReport();
-  const char* category = nsContentUtils::IsCallerChrome() ? "chrome javascript"
-                                                          : "content javascript";
   nsPIDOMWindow* win = xpc::WindowGlobalOrNull(JS::CurrentGlobalOrNull(aCx));
-  xpcReport->Init(aRep, aMessage, category, win ? win->WindowID() : 0);
+  xpcReport->Init(aRep, aMessage, nsContentUtils::IsCallerChrome(),
+                  win ? win->WindowID() : 0);
   xpcReport->LogToConsole();
 }
 
 void
 AutoJSAPI::TakeOwnershipOfErrorReporting()
 {
   MOZ_ASSERT(NS_IsMainThread(), "Can't own error reporting off-main-thread yet");
   MOZ_ASSERT(!mOwnErrorReporting);