[gjs/wip/ptomato/mozjs38: 32/32] WIP - mozjs38
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs38: 32/32] WIP - mozjs38
- Date: Tue, 17 Jan 2017 06:46:47 +0000 (UTC)
commit d9400c7aa5465111a3dd9f0f426569aaed875bc9
Author: Philip Chimento <philip chimento gmail com>
Date: Wed Jan 11 23:45:59 2017 -0800
WIP - mozjs38
gi/boxed.cpp | 4 ++--
gjs/byteArray.cpp | 3 ++-
gjs/context.cpp | 1 +
gjs/importer.cpp | 2 +-
gjs/jsapi-util-string.cpp | 11 +++++++++--
gjs/jsapi-util.cpp | 8 ++++----
gjs/runtime.cpp | 2 +-
7 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index f56d15b..9d02565 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -842,8 +842,8 @@ define_boxed_class_fields (JSContext *context,
bool result;
result = JS_DefineProperty(context, proto, field_name, JS::NullHandleValue,
- JSPROP_PERMANENT | JSPROP_SHARED,
- boxed_field_getter, boxed_field_setter);
+ JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_PROPOP_ACCESSORS,
+ (JSNative) boxed_field_getter, (JSNative) boxed_field_setter);
g_base_info_unref ((GIBaseInfo *)field);
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index 2809abd..73ce6f8 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -608,8 +608,9 @@ from_string_func(JSContext *context,
GError *error;
const char16_t *u16_chars;
gsize u16_len;
+ JS::AutoCheckCannotGC nogc;
- u16_chars = JS_GetStringCharsAndLength(context, argv[0].toString(), &u16_len);
+ u16_chars = JS_GetTwoByteStringCharsAndLength(context, nogc, argv[0].toString(), &u16_len);
if (u16_chars == NULL)
return false;
diff --git a/gjs/context.cpp b/gjs/context.cpp
index efcdbac..7d80621 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -78,6 +78,7 @@ struct _GjsContext {
guint auto_gc_id;
+ /* FIXME - array of PersistentRooted<jsid>? */
jsid const_strings[GJS_STRING_LAST];
};
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index cd3ddae..7c76d7c 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -213,7 +213,7 @@ seal_import(JSContext *cx,
if (!JS_DefineProperty(cx, descr.object(), name, descr.value(),
descr.attributes() | JSPROP_PERMANENT,
- descr.getter(), descr.setter())) {
+ (JSNative) descr.getter(), (JSNative) descr.setter())) {
gjs_debug(GJS_DEBUG_IMPORTER,
"Failed to redefine attributes to seal '%s' in importer",
name);
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index 6143b47..509413f 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -191,7 +191,12 @@ gjs_string_get_char16_data(JSContext *context,
goto out;
}
- js_data = JS_GetStringCharsAndLength(context, value.toString(), len_p);
+ /* Scope for nogc */
+ {
+ JS::AutoCheckCannotGC nogc;
+ js_data = JS_GetTwoByteStringCharsAndLength(context, nogc,
+ value.toString(), len_p);
+ }
if (js_data == NULL)
goto out;
@@ -231,7 +236,9 @@ gjs_string_to_ucs4(JSContext *cx,
size_t utf16_len;
GError *error = NULL;
- const char16_t *utf16 = JS_GetStringCharsAndLength(cx, str, &utf16_len);
+ JS::AutoCheckCannotGC nogc;
+ const char16_t *utf16 = JS_GetTwoByteStringCharsAndLength(cx, nogc, str,
+ &utf16_len);
if (utf16 == NULL) {
gjs_throw(cx, "Failed to get UTF-16 string data");
return false;
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 417e4af..16e2aed 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -89,9 +89,8 @@ gjs_init_context_standard (JSContext *context,
*
* setExtraWarnings: Report warnings to error reporter function.
*/
- JS::ContextOptionsRef(context)
- .setDontReportUncaught(true)
- .setExtraWarnings(extra_warnings);
+ JS::ContextOptionsRef(context).setDontReportUncaught(true);
+ JS::RuntimeOptionsRef(context).setExtraWarnings(extra_warnings);
if (!g_getenv("GJS_DISABLE_JIT")) {
gjs_debug(GJS_DEBUG_CONTEXT, "Enabling JIT");
@@ -378,7 +377,8 @@ gjs_string_readable (JSContext *context,
size_t i, len;
const char16_t *uchars;
- uchars = JS_GetStringCharsAndLength(context, string, &len);
+ JS::AutoCheckCannotGC nogc;
+ uchars = JS_GetTwoByteStringCharsAndLength(context, nogc, string, &len);
for (i = 0; i < len; i++) {
char16_t c = uchars[i];
diff --git a/gjs/runtime.cpp b/gjs/runtime.cpp
index 5ddf4b0..902fcd9 100644
--- a/gjs/runtime.cpp
+++ b/gjs/runtime.cpp
@@ -256,7 +256,7 @@ gjs_runtime_for_current_thread(void)
if (!runtime) {
g_assert(gjs_is_inited);
- runtime = JS_NewRuntime(32*1024*1024 /* max bytes */, JS_USE_HELPER_THREADS);
+ runtime = JS_NewRuntime(32 * 1024 * 1024 /* max bytes */);
if (runtime == NULL)
g_error("Failed to create javascript runtime");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]