From 8b421a48d38eebdc96d60553572aab9b6858b127 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Mon, 29 Sep 2014 15:34:21 +0200 Subject: [PATCH] Bug 1070842 - Factor script error event dispatch into a separate function. r=bz --- dom/base/nsJSEnvironment.cpp | 9 ++++++++- js/xpconnect/src/xpcpublic.h | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 839138122c76..20021f980fa8 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -486,10 +486,17 @@ SystemErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) // 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 exception) +{ + nsContentUtils::AddScriptRunner(new ScriptErrorEvent(win, rt, xpcReport, exception)); +} + } /* namespace xpc */ #ifdef DEBUG diff --git a/js/xpconnect/src/xpcpublic.h b/js/xpconnect/src/xpcpublic.h index 15305bc2f752..39204ab309f9 100644 --- a/js/xpconnect/src/xpcpublic.h +++ b/js/xpconnect/src/xpcpublic.h @@ -532,6 +532,10 @@ class ErrorReport { ~ErrorReport() {} }; +void +DispatchScriptErrorEvent(nsPIDOMWindow *win, JSRuntime *rt, xpc::ErrorReport *xpcReport, + JS::Handle exception); + } // namespace xpc namespace mozilla {