Bug 1070842 - Factor script error event dispatch into a separate function. r=bz
authorBobby Holley <bobbyholley@gmail.com>
Mon, 29 Sep 2014 15:34:21 +0200
changeset 207700 e84e6017e656d440dcce915f6873d758dd18b664
parent 207699 0627cc72985f03237631c047ff13cef5f88bdd19
child 207701 c8b6d2fd42f05b865f3f8154cbdac8166e72fd84
push id27564
push userryanvm@gmail.com
push dateMon, 29 Sep 2014 18:57:04 +0000
treeherdermozilla-central@ce9a0b34225e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1070842
milestone35.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 1070842 - Factor script error event dispatch into a separate function. r=bz
dom/base/nsJSEnvironment.cpp
js/xpconnect/src/xpcpublic.h
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -481,20 +481,27 @@ SystemErrorReporter(JSContext *cx, const
         report->errorNumber == JSMSG_OUT_OF_MEMORY)
     {
       xpcReport->LogToConsole();
       return;
     }
 
     // Otherwise, we need to asynchronously invoke onerror before we can decide
     // whether or not to report the error to the console.
-    nsContentUtils::AddScriptRunner(new ScriptErrorEvent(win, JS_GetRuntime(cx), xpcReport, exception));
+    DispatchScriptErrorEvent(win, JS_GetRuntime(cx), xpcReport, exception);
   }
 }
 
+void
+DispatchScriptErrorEvent(nsPIDOMWindow *win, JSRuntime *rt, xpc::ErrorReport *xpcReport,
+                         JS::Handle<JS::Value> exception)
+{
+  nsContentUtils::AddScriptRunner(new ScriptErrorEvent(win, rt, xpcReport, exception));
+}
+
 } /* namespace xpc */
 
 #ifdef DEBUG
 // A couple of useful functions to call when you're debugging.
 nsGlobalWindow *
 JSObject2Win(JSObject *obj)
 {
   return xpc::WindowOrNull(obj);
--- a/js/xpconnect/src/xpcpublic.h
+++ b/js/xpconnect/src/xpcpublic.h
@@ -527,16 +527,20 @@ class ErrorReport {
     uint32_t mColumn;
     uint32_t mFlags;
     bool mIsMuted;
 
   private:
     ~ErrorReport() {}
 };
 
+void
+DispatchScriptErrorEvent(nsPIDOMWindow *win, JSRuntime *rt, xpc::ErrorReport *xpcReport,
+                         JS::Handle<JS::Value> exception);
+
 } // namespace xpc
 
 namespace mozilla {
 namespace dom {
 
 typedef JSObject*
 (*DefineInterface)(JSContext *cx, JS::Handle<JSObject*> global,
                    JS::Handle<jsid> id, bool defineOnGlobal);