Bug 1283855 part 5 - Make warning reporter APIs take JSContext instead of JSRuntime. r=arai
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user