[gjs/mozjs31: 8/14] js: Remove deprecated JS_{Get,Set}Options
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/mozjs31: 8/14] js: Remove deprecated JS_{Get,Set}Options
- Date: Tue, 15 Nov 2016 00:15:23 +0000 (UTC)
commit b4d67815c9105f2137ae2aa745f9330d7f71880d
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()).
There is no equivalent for JSOPTION_TYPE_INFERENCE, it is always turned
on. According to the people in #jsapi it should never have been exposed
in the first place.
https://bugzilla.gnome.org/show_bug.cgi?id=751252
gjs/coverage.cpp | 6 ++++--
gjs/jsapi-util.cpp | 36 ++++++++++++++++++++----------------
2 files changed, 24 insertions(+), 18 deletions(-)
---
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 899e41c..2dd6425 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1696,8 +1696,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::RuntimeOptionsRef(context)
+ .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 e8b1e27..7fbf07e 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -64,32 +64,36 @@ bool
gjs_init_context_standard (JSContext *context,
JS::MutableHandleObject global)
{
- JS::CompartmentOptions options;
- guint32 options_flags;
+ 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.
+ bool extra_warnings = false;
+ if (!g_getenv("GJS_DISABLE_EXTRA_WARNINGS")) {
+ gjs_debug(GJS_DEBUG_CONTEXT, "Enabling extra warnings");
+ extra_warnings = true;
+ }
+
+ /* 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;
+ JS::ContextOptionsRef(context)
+ .setDontReportUncaught(true)
+ .setExtraWarnings(extra_warnings);
if (!g_getenv("GJS_DISABLE_JIT")) {
gjs_debug(GJS_DEBUG_CONTEXT, "Enabling JIT");
- options_flags |= JSOPTION_TYPE_INFERENCE | JSOPTION_ION | JSOPTION_BASELINE | JSOPTION_ASMJS;
- }
-
- if (!g_getenv("GJS_DISABLE_EXTRA_WARNINGS")) {
- gjs_debug(GJS_DEBUG_CONTEXT, "Enabling extra warnings");
- options_flags |= JSOPTION_EXTRA_WARNINGS;
+ JS::RuntimeOptionsRef(context)
+ .setIon(true)
+ .setBaseline(true)
+ .setAsmJS(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]