[gjs] gerror: Define a columnNumber on GError-backed errors
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] gerror: Define a columnNumber on GError-backed errors
- Date: Sun, 13 Aug 2017 23:39:31 +0000 (UTC)
commit 1ca63422a420953f6af9546c7285a933e3727613
Author: Philip Chimento <philip endlessm com>
Date: Fri Aug 11 13:38:37 2017 +0100
gerror: Define a columnNumber on GError-backed errors
Newer JS defines a columnNumber property on Error objects, so our
GError-backed ones should have this property as well.
https://bugzilla.gnome.org/show_bug.cgi?id=786183
gi/gerror.cpp | 7 ++++++-
gjs/context.cpp | 4 ++--
gjs/jsapi-util.h | 1 +
3 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index 509c3e6..d4d5e28 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -398,7 +398,7 @@ define_error_properties(JSContext *cx,
JS::RootedObject frame(cx);
JS::RootedString stack(cx);
JS::RootedString source(cx);
- uint32_t line;
+ uint32_t line, column;
JS::AutoSaveExceptionState exc(cx);
if (!JS::CaptureCurrentStack(cx, &frame) ||
@@ -414,11 +414,16 @@ define_error_properties(JSContext *cx,
result = JS::GetSavedFrameLine(cx, frame, &line);
g_assert(result == JS::SavedFrameResult::Ok);
+ result = JS::GetSavedFrameColumn(cx, frame, &column);
+ g_assert(result == JS::SavedFrameResult::Ok);
+
if (!gjs_object_define_property(cx, obj, GJS_STRING_STACK, stack,
JSPROP_ENUMERATE) ||
!gjs_object_define_property(cx, obj, GJS_STRING_FILENAME, source,
JSPROP_ENUMERATE) ||
!gjs_object_define_property(cx, obj, GJS_STRING_LINE_NUMBER, line,
+ JSPROP_ENUMERATE) ||
+ !gjs_object_define_property(cx, obj, GJS_STRING_COLUMN_NUMBER, column,
JSPROP_ENUMERATE))
exc.restore();
}
diff --git a/gjs/context.cpp b/gjs/context.cpp
index ab2faed..3551986 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -102,8 +102,8 @@ static const char *const_strings[] = {
"__gjsKeepAlive", "__gjsPrivateNS",
"gi", "versions", "overrides",
"_init", "_instance_init", "_new_internal", "new",
- "message", "code", "stack", "fileName", "lineNumber", "name",
- "x", "y", "width", "height", "__modulePath__"
+ "message", "code", "stack", "fileName", "lineNumber", "columnNumber",
+ "name", "x", "y", "width", "height", "__modulePath__"
};
G_STATIC_ASSERT(G_N_ELEMENTS(const_strings) == GJS_STRING_LAST);
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index b9d1959..cb90a2f 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -283,6 +283,7 @@ typedef enum {
GJS_STRING_STACK,
GJS_STRING_FILENAME,
GJS_STRING_LINE_NUMBER,
+ GJS_STRING_COLUMN_NUMBER,
GJS_STRING_NAME,
GJS_STRING_X,
GJS_STRING_Y,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]