Bug 1283058 - Part 3: Remove JSREPORT_STRICT_MODE_ERROR and JSREPORT_IS_STRICT_MODE_ERROR. r=jwalden

This commit is contained in:
Tooru Fujisawa 2016-07-13 11:32:51 +09:00
Родитель 695e08c70d
Коммит 676a8282ad
2 изменённых файлов: 2 добавлений и 26 удалений

Просмотреть файл

@ -5196,15 +5196,6 @@ class JSErrorReport
#define JSREPORT_EXCEPTION 0x2 /* exception was thrown */ #define JSREPORT_EXCEPTION 0x2 /* exception was thrown */
#define JSREPORT_STRICT 0x4 /* error or warning due to strict option */ #define JSREPORT_STRICT 0x4 /* error or warning due to strict option */
/*
* This condition is an error in strict mode code, a warning if
* JS_HAS_STRICT_OPTION(cx), and otherwise should not be reported at
* all. We check the strictness of the context's top frame's script;
* where that isn't appropriate, the caller should do the right checks
* itself instead of using this flag.
*/
#define JSREPORT_STRICT_MODE_ERROR 0x8
/* /*
* If JSREPORT_EXCEPTION is set, then a JavaScript-catchable exception * If JSREPORT_EXCEPTION is set, then a JavaScript-catchable exception
* has been thrown for this runtime error, and the host should ignore it. * has been thrown for this runtime error, and the host should ignore it.
@ -5215,8 +5206,7 @@ class JSErrorReport
#define JSREPORT_IS_WARNING(flags) (((flags) & JSREPORT_WARNING) != 0) #define JSREPORT_IS_WARNING(flags) (((flags) & JSREPORT_WARNING) != 0)
#define JSREPORT_IS_EXCEPTION(flags) (((flags) & JSREPORT_EXCEPTION) != 0) #define JSREPORT_IS_EXCEPTION(flags) (((flags) & JSREPORT_EXCEPTION) != 0)
#define JSREPORT_IS_STRICT(flags) (((flags) & JSREPORT_STRICT) != 0) #define JSREPORT_IS_STRICT(flags) (((flags) & JSREPORT_STRICT) != 0)
#define JSREPORT_IS_STRICT_MODE_ERROR(flags) (((flags) & \
JSREPORT_STRICT_MODE_ERROR) != 0)
namespace JS { namespace JS {
typedef void typedef void

Просмотреть файл

@ -303,21 +303,7 @@ js::ReportAllocationOverflow(ExclusiveContext* cxArg)
static bool static bool
checkReportFlags(JSContext* cx, unsigned* flags) checkReportFlags(JSContext* cx, unsigned* flags)
{ {
if (JSREPORT_IS_STRICT_MODE_ERROR(*flags)) { if (JSREPORT_IS_STRICT(*flags)) {
/*
* Error in strict code; warning with extra warnings option; okay
* otherwise. We assume that if the top frame is a native, then it is
* strict if the nearest scripted frame is strict, see bug 536306.
*/
jsbytecode* pc;
JSScript* script = cx->currentScript(&pc);
if (script && IsCheckStrictOp(JSOp(*pc)))
*flags &= ~JSREPORT_WARNING;
else if (cx->compartment()->behaviors().extraWarnings(cx))
*flags |= JSREPORT_WARNING;
else
return true;
} else if (JSREPORT_IS_STRICT(*flags)) {
/* Warning/error only when JSOPTION_STRICT is set. */ /* Warning/error only when JSOPTION_STRICT is set. */
if (!cx->compartment()->behaviors().extraWarnings(cx)) if (!cx->compartment()->behaviors().extraWarnings(cx))
return true; return true;