Bug 933010 - AsyncErrorReporter takes bool isChromeError. r=bz

This commit is contained in:
Nikhil Marathe 2013-10-30 16:17:36 -07:00
parent 2ee0d6c6eb
commit 8349e7f288
3 changed files with 8 additions and 7 deletions

View File

@ -337,7 +337,7 @@ namespace dom {
AsyncErrorReporter::AsyncErrorReporter(JSRuntime* aRuntime,
JSErrorReport* aErrorReport,
const char* aFallbackMessage,
nsIPrincipal* aGlobalPrincipal,
bool aIsChromeError,
nsPIDOMWindow* aWindow)
: mSourceLine(static_cast<const PRUnichar*>(aErrorReport->uclinebuf))
, mLineNumber(aErrorReport->lineno)
@ -365,9 +365,8 @@ AsyncErrorReporter::AsyncErrorReporter(JSRuntime* aRuntime,
mErrorMsg.AssignWithConversion(aFallbackMessage);
}
mCategory = nsContentUtils::IsSystemPrincipal(aGlobalPrincipal) ?
NS_LITERAL_CSTRING("chrome javascript") :
NS_LITERAL_CSTRING("content javascript");
mCategory = aIsChromeError ? NS_LITERAL_CSTRING("chrome javascript") :
NS_LITERAL_CSTRING("content javascript");
mInnerWindowID = 0;
if (aWindow && aWindow->IsOuterWindow()) {
@ -421,7 +420,8 @@ public:
bool aDispatchEvent)
// Pass an empty category, then compute ours
: AsyncErrorReporter(aRuntime, aErrorReport, aFallbackMessage,
aGlobalPrincipal, aWindow)
nsContentUtils::IsSystemPrincipal(aGlobalPrincipal),
aWindow)
, mScriptGlobal(aScriptGlobal)
, mOriginPrincipal(aScriptOriginPrincipal)
, mDispatchEvent(aDispatchEvent)

View File

@ -208,7 +208,7 @@ public:
AsyncErrorReporter(JSRuntime* aRuntime,
JSErrorReport* aErrorReport,
const char* aFallbackMessage,
nsIPrincipal* aGlobalPrincipal, // To determine category
bool aIsChromeError, // To determine category
nsPIDOMWindow* aWindow);
NS_IMETHOD Run()

View File

@ -445,12 +445,13 @@ Promise::MaybeReportRejected()
nsCOMPtr<nsPIDOMWindow> win =
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(&mResult.toObject()));
nsIPrincipal* principal = nsContentUtils::GetObjectPrincipal(&mResult.toObject());
// Now post an event to do the real reporting async
NS_DispatchToCurrentThread(
new AsyncErrorReporter(JS_GetObjectRuntime(&mResult.toObject()),
report,
nullptr,
nsContentUtils::GetObjectPrincipal(&mResult.toObject()),
nsContentUtils::IsSystemPrincipal(principal),
win));
}