summaryrefslogtreecommitdiff
path: root/gjs
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2017-05-02 22:02:51 -0700
committerPhilip Chimento <philip.chimento@gmail.com>2017-07-09 12:55:47 -0700
commit39f4a7a64b8f964edc2e3dd81d05a6b221f9b42f (patch)
treeb592c1b0ebfcff90c59b93b71d48937a091f22ac /gjs
parent3199806e73acb424fef911838edb380e10a17b60 (diff)
downloadgjs-39f4a7a64b8f964edc2e3dd81d05a6b221f9b42f.tar.gz
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. https://bugzilla.gnome.org/show_bug.cgi?id=784196
Diffstat (limited to 'gjs')
-rw-r--r--gjs/jsapi-util-error.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index 56d3ec78..ce1bbd59 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_ReportErrorUTF8(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_ReportErrorUTF8(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);