Bug 889714 - Removed unused ShouldReportWarnings and ShouldCompoleOnly [sic] machinery. r=mrbkap

lol @ 'ShouldCompoleOnly'.
This commit is contained in:
Bobby Holley
2013-07-16 20:38:45 -07:00
parent ffac366450
commit 40980f8e77
2 changed files with 32 additions and 60 deletions

View File

@@ -1,4 +1,5 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
/* vim: set ts=8 sts=4 et sw=4 tw=80:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -119,12 +120,6 @@ ScriptErrorReporter(JSContext *cx,
return;
}
/* Conditionally ignore reported warnings. */
if (JSREPORT_IS_WARNING(report->flags) &&
!Environment(cx)->ShouldReportWarnings()) {
return;
}
if (report->filename)
prefix = JS_smprintf("%s:", report->filename);
if (report->lineno) {
@@ -290,8 +285,7 @@ Load(JSContext *cx,
if (!script)
return JS_FALSE;
if (!Environment(cx)->ShouldCompileOnly() &&
!JS_ExecuteScript(cx, obj, script, result.address())) {
if (!JS_ExecuteScript(cx, obj, script, result.address())) {
return JS_FALSE;
}
}
@@ -554,7 +548,7 @@ ProcessFile(JSContext *cx,
.setFileAndLine(filename, 1)
.setPrincipals(env->GetPrincipal());
JSScript* script = JS::Compile(cx, obj, options, file);
if (script && !env->ShouldCompileOnly())
if (script)
(void)JS_ExecuteScript(cx, obj, script, result.address());
return;
@@ -594,22 +588,20 @@ ProcessFile(JSContext *cx,
if (script) {
JSErrorReporter older;
if (!env->ShouldCompileOnly()) {
ok = JS_ExecuteScript(cx, obj, script, result.address());
if (ok && result != JSVAL_VOID) {
/* Suppress error reports from JS_ValueToString(). */
older = JS_SetErrorReporter(cx, NULL);
str = JS_ValueToString(cx, result);
JSAutoByteString bytes;
if (str)
bytes.encodeLatin1(cx, str);
JS_SetErrorReporter(cx, older);
ok = JS_ExecuteScript(cx, obj, script, result.address());
if (ok && result != JSVAL_VOID) {
/* Suppress error reports from JS_ValueToString(). */
older = JS_SetErrorReporter(cx, NULL);
str = JS_ValueToString(cx, result);
JSAutoByteString bytes;
if (str)
bytes.encodeLatin1(cx, str);
JS_SetErrorReporter(cx, older);
if (!!bytes)
fprintf(stdout, "%s\n", bytes.ptr());
else
ok = JS_FALSE;
}
if (!!bytes)
fprintf(stdout, "%s\n", bytes.ptr());
else
ok = JS_FALSE;
}
}
} while (!hitEOF && !env->IsQuitting());
@@ -670,9 +662,7 @@ XPCShellEnvironment::XPCShellEnvironment()
: mCx(NULL),
mJSPrincipals(NULL),
mExitCode(0),
mQuitting(JS_FALSE),
mReportWarnings(JS_TRUE),
mCompileOnly(JS_FALSE)
mQuitting(JS_FALSE)
{
}
@@ -851,24 +841,22 @@ XPCShellEnvironment::EvaluateString(const nsString& aString,
return false;
}
if (!ShouldCompileOnly()) {
if (aResult) {
aResult->Truncate();
}
if (aResult) {
aResult->Truncate();
}
JS::Rooted<JS::Value> result(mCx);
JSBool ok = JS_ExecuteScript(mCx, global, script, result.address());
if (ok && result != JSVAL_VOID) {
JSErrorReporter old = JS_SetErrorReporter(mCx, NULL);
JSString* str = JS_ValueToString(mCx, result);
nsDependentJSString depStr;
if (str)
depStr.init(mCx, str);
JS_SetErrorReporter(mCx, old);
JS::Rooted<JS::Value> result(mCx);
JSBool ok = JS_ExecuteScript(mCx, global, script, result.address());
if (ok && result != JSVAL_VOID) {
JSErrorReporter old = JS_SetErrorReporter(mCx, NULL);
JSString* str = JS_ValueToString(mCx, result);
nsDependentJSString depStr;
if (str)
depStr.init(mCx, str);
JS_SetErrorReporter(mCx, old);
if (!depStr.IsEmpty() && aResult) {
aResult->Assign(depStr);
}
if (!depStr.IsEmpty() && aResult) {
aResult->Assign(depStr);
}
}