[gjs/wip/ptomato/mozjs31: 11/12] js: Remove deprecated JS_{Get, Set}Options
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs31: 11/12] js: Remove deprecated JS_{Get, Set}Options
- Date: Thu, 27 Oct 2016 02:52:38 +0000 (UTC)
commit 1f48f75ff31d2789d575b9a000eca11973fb3eb0
Author: Philip Chimento <philip endlessm com>
Date: Tue Oct 25 15:22:03 2016 -0700
js: Remove deprecated JS_{Get,Set}Options
The options have been shuffled around, now some apply to the runtime
(fetched with JS::RuntimeOptionsRef()) and some apply to the context
(fetched with JS::ContextOptionsRef()).
gjs/coverage.cpp | 6 ++++--
gjs/jsapi-util.cpp | 26 ++++++++++++++------------
2 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index b4d8ec2..ec2ad31 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1697,8 +1697,10 @@ gjs_coverage_constructed(GObject *object)
JSContext *context = (JSContext *) gjs_context_get_native_context(priv->context);
/* Before bootstrapping, turn off the JIT on the context */
- guint32 options_flags = JS_GetOptions(context) & ~(JSOPTION_ION | JSOPTION_BASELINE | JSOPTION_ASMJS);
- JS_SetOptions(context, options_flags);
+ JS::RuntimeOptions options(JS::RuntimeOptionsRef(context));
+ options.setIon(false)
+ .setBaseline(false)
+ .setAsmJS(false);
if (!bootstrap_coverage(coverage)) {
JSAutoCompartment compartment(context, gjs_get_import_global(context));
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index cb49d49..9516265 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -65,32 +65,34 @@ bool
gjs_init_context_standard (JSContext *context,
JS::MutableHandleObject global)
{
- JS::CompartmentOptions options;
- guint32 options_flags;
+ JS::ContextOptions context_options(JS::ContextOptionsRef(context));
+ JS::CompartmentOptions compartment_options;
- /* JSOPTION_DONT_REPORT_UNCAUGHT: Don't send exceptions to our
- * error report handler; instead leave them set. This allows us
- * to get at the exception object.
+ /* setDontReportUncaught: Don't send exceptions to our error report handler;
+ * instead leave them set. This allows us to get at the exception object.
*
- * JSOPTION_STRICT: Report warnings to error reporter function.
+ * setExtraWarnings: Report warnings to error reporter function.
*/
- options_flags = JSOPTION_DONT_REPORT_UNCAUGHT;
+ context_options.setDontReportUncaught(true);
if (!g_getenv("GJS_DISABLE_JIT")) {
gjs_debug(GJS_DEBUG_CONTEXT, "Enabling JIT");
- options_flags |= JSOPTION_TYPE_INFERENCE | JSOPTION_ION | JSOPTION_BASELINE | JSOPTION_ASMJS;
+ JS::RuntimeOptions runtime_options(JS::RuntimeOptionsRef(context));
+ runtime_options.setIon(true)
+ .setBaseline(true)
+ .setAsmJS(true);
}
if (!g_getenv("GJS_DISABLE_EXTRA_WARNINGS")) {
gjs_debug(GJS_DEBUG_CONTEXT, "Enabling extra warnings");
- options_flags |= JSOPTION_EXTRA_WARNINGS;
+ context_options.setExtraWarnings(true);
}
- JS_SetOptions(context, JS_GetOptions(context) | options_flags);
JS_SetErrorReporter(context, gjs_error_reporter);
- options.setVersion(JSVERSION_LATEST);
- global.set(JS_NewGlobalObject(context, &global_class, NULL, options));
+ compartment_options.setVersion(JSVERSION_LATEST);
+ global.set(JS_NewGlobalObject(context, &global_class, NULL,
+ compartment_options));
if (global == NULL)
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]