Bug 1283855 part 5 - Make warning reporter APIs take JSContext instead of JSRuntime. r=arai

This commit is contained in:
Jan de Mooij
2016-07-05 11:06:05 +02:00
parent 97cade1c39
commit 31bd9d01bb
12 changed files with 31 additions and 31 deletions

View File

@@ -374,12 +374,12 @@ XPCShellEnvironment::ProcessFile(JSContext *cx,
ok = JS_ExecuteScript(cx, script, &result);
if (ok && !result.isUndefined()) {
/* Suppress warnings from JS::ToString(). */
older = JS::SetWarningReporter(JS_GetRuntime(cx), nullptr);
older = JS::SetWarningReporter(cx, nullptr);
str = JS::ToString(cx, result);
JSAutoByteString bytes;
if (str)
bytes.encodeLatin1(cx, str);
JS::SetWarningReporter(JS_GetRuntime(cx), older);
JS::SetWarningReporter(cx, older);
if (!!bytes)
fprintf(stdout, "%s\n", bytes.ptr());
@@ -595,12 +595,12 @@ XPCShellEnvironment::EvaluateString(const nsString& aString,
JS::Rooted<JS::Value> result(cx);
bool ok = JS_ExecuteScript(cx, script, &result);
if (ok && !result.isUndefined()) {
JS::WarningReporter old = JS::SetWarningReporter(JS_GetRuntime(cx), nullptr);
JS::WarningReporter old = JS::SetWarningReporter(cx, nullptr);
JSString* str = JS::ToString(cx, result);
nsAutoJSString autoStr;
if (str)
autoStr.init(cx, str);
JS::SetWarningReporter(JS_GetRuntime(cx), old);
JS::SetWarningReporter(cx, old);
if (!autoStr.IsEmpty() && aResult) {
aResult->Assign(autoStr);