зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1062631 - Remove exception swallowing code in NS_ScriptErrorReporter. r=bz
See bug 1062631 comment 0.
This commit is contained in:
Родитель
33f4e1dcb0
Коммит
06cc2ae3c2
|
@ -532,32 +532,6 @@ NS_ScriptErrorReporter(JSContext *cx,
|
|||
const char *message,
|
||||
JSErrorReport *report)
|
||||
{
|
||||
// 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)) {
|
||||
nsIXPConnect* xpc = nsContentUtils::XPConnect();
|
||||
if (JS::DescribeScriptedCaller(cx)) {
|
||||
xpc->MarkErrorUnreported(cx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (xpc) {
|
||||
nsAXPCNativeCallContext *cc = nullptr;
|
||||
xpc->GetCurrentNativeCallContext(&cc);
|
||||
if (cc) {
|
||||
nsAXPCNativeCallContext *prev = cc;
|
||||
while (NS_SUCCEEDED(prev->GetPreviousCallContext(&prev)) && prev) {
|
||||
uint16_t lang;
|
||||
if (NS_SUCCEEDED(prev->GetLanguage(&lang)) &&
|
||||
lang == nsAXPCNativeCallContext::LANG_JS) {
|
||||
xpc->MarkErrorUnreported(cx);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> exception(cx);
|
||||
::JS_GetPendingException(cx, &exception);
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ interface nsIXPCFunctionThisTranslator : nsISupports
|
|||
{ 0xbd, 0xd6, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
|
||||
%}
|
||||
|
||||
[noscript, uuid(89b8525d-5c22-48bd-8a79-66aac9cd705e)]
|
||||
[noscript, uuid(a632b020-331f-11e4-8c21-0800200c9a66)]
|
||||
interface nsIXPConnect : nsISupports
|
||||
{
|
||||
%{ C++
|
||||
|
@ -572,11 +572,4 @@ interface nsIXPConnect : nsISupports
|
|||
|
||||
[noscript] JSObjectPtr readFunction(in nsIObjectInputStream aStream,
|
||||
in JSContextPtr aJSContext);
|
||||
|
||||
/**
|
||||
* This function should be called in JavaScript error reporters
|
||||
* to signal that they are ignoring the error. In this case,
|
||||
* XPConnect can print a warning to the console.
|
||||
*/
|
||||
[noscript] void markErrorUnreported(in JSContextPtr aJSContext);
|
||||
};
|
||||
|
|
|
@ -844,12 +844,7 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx,
|
|||
if (reportable && is_js_exception &&
|
||||
JS_GetErrorReporter(cx) != xpcWrappedJSErrorReporter)
|
||||
{
|
||||
// If the error reporter ignores the error, it will call
|
||||
// xpc->MarkErrorUnreported().
|
||||
xpcc->ClearUnreportedError();
|
||||
reportable = !JS_ReportPendingException(cx);
|
||||
if (!xpcc->WasErrorReported())
|
||||
reportable = true;
|
||||
}
|
||||
|
||||
if (reportable) {
|
||||
|
|
|
@ -1373,14 +1373,6 @@ nsXPConnect::ReadFunction(nsIObjectInputStream *stream, JSContext *cx, JSObject
|
|||
return ReadScriptOrFunction(stream, cx, nullptr, functionObjp);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPConnect::MarkErrorUnreported(JSContext *cx)
|
||||
{
|
||||
XPCContext *xpcc = XPCContext::GetXPCContext(cx);
|
||||
xpcc->MarkErrorUnreported();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* These are here to be callable from a debugger */
|
||||
extern "C" {
|
||||
JS_EXPORT_API(void) DumpJSStack()
|
||||
|
|
|
@ -739,10 +739,6 @@ public:
|
|||
|
||||
void DebugDump(int16_t depth);
|
||||
|
||||
void MarkErrorUnreported() { mErrorUnreported = true; }
|
||||
void ClearUnreportedError() { mErrorUnreported = false; }
|
||||
bool WasErrorReported() { return !mErrorUnreported; }
|
||||
|
||||
~XPCContext();
|
||||
|
||||
private:
|
||||
|
|
|
@ -20,6 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=895340
|
|||
<script type="application/javascript"><![CDATA[
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.expectUncaughtException();
|
||||
|
||||
const Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/Services.jsm", this);
|
||||
|
|
Загрузка…
Ссылка в новой задаче