[gjs/wip/ptomato/mozjs52: 34/42] js: Report warnings and errors with encoding
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs52: 34/42] js: Report warnings and errors with encoding
- Date: Sat, 24 Jun 2017 06:00:20 +0000 (UTC)
commit 334dc943dce841b1657655bc865c9b15a6f62cb4
Author: Philip Chimento <philip chimento gmail com>
Date: Tue May 2 22:02:51 2017 -0700
js: Report warnings and errors with encoding
JS_ReportWarning() and JS_ReportError() are changed in SpiderMonkey 52 to
specify their character encodings. Therefore, we use JS_ReportWarningUTF8()
and JS_ReportErrorUTF8(), except in a few cases where we use the ASCII
version because the argument is a string literal with only ASCII characters
and no format codes.
gi/function.cpp | 6 +++---
gi/repo.cpp | 2 +-
gjs/jsapi-util-error.cpp | 8 +++-----
3 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/gi/function.cpp b/gi/function.cpp
index 70306cd..1a89821 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -769,9 +769,9 @@ gjs_invoke_c_function(JSContext *context,
*/
if (args.length() > function->expected_js_argc) {
GjsAutoChar name = format_function_name(function, is_method);
- JS_ReportWarning(context, "Too many arguments to %s: expected %d, "
- "got %" G_GSIZE_FORMAT, name.get(),
- function->expected_js_argc, args.length());
+ JS_ReportWarningUTF8(context, "Too many arguments to %s: expected %d, "
+ "got %" G_GSIZE_FORMAT, name.get(),
+ function->expected_js_argc, args.length());
} else if (args.length() < function->expected_js_argc) {
GjsAutoChar name = format_function_name(function, is_method);
gjs_throw(context, "Too few arguments to %s: "
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 123b381..929e2fc 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -107,7 +107,7 @@ resolve_namespace_object(JSContext *context,
"versions available; use "
"imports.gi.versions to pick one",
ns_name, nversions);
- JS_ReportWarning(context, warn_text);
+ JS_ReportWarningUTF8(context, "%s", warn_text.get());
}
g_list_free_full(versions, g_free);
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index 56d3ec7..88ab949 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -83,13 +83,13 @@ gjs_throw_valist(JSContext *context,
result = false;
if (!gjs_string_from_utf8(context, s, -1, error_args[0])) {
- JS_ReportError(context, "Failed to copy exception string");
+ JS_ReportErrorASCII(context, "Failed to copy exception string");
goto out;
}
if (!JS_GetProperty(context, global, error_class, &v_constructor) ||
!v_constructor.isObject()) {
- JS_ReportError(context, "??? Missing Error constructor in global object?");
+ JS_ReportErrorASCII(context, "??? Missing Error constructor in global object?");
goto out;
}
@@ -119,9 +119,7 @@ gjs_throw_valist(JSContext *context,
/* try just reporting it to error handler? should not
* happen though pretty much
*/
- JS_ReportError(context,
- "Failed to throw exception '%s'",
- s);
+ JS_ReportErrorUTF8(context, "Failed to throw exception '%s'", s);
}
g_free(s);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]