[gjs/wip/ptomato/mozjs52: 33/40] js: Adapt to options changes



commit d0d35fb9f42fa27718db4d14102364bda395a709
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue May 2 22:29:33 2017 -0700

    js: Adapt to options changes
    
    JS::RuntimeOptions and JS::ContextOptions have merged into one
    JS::ContextOptions class. JS::CompartmentOptions, on the other hand, has
    split into "creation options" (can be set only at construct time) and
    "behaviors" (can be changed at run time.)
    
    The DontReportUncaught option is removed and is now activated
    unconditionally.

 gjs/coverage.cpp   |    2 +-
 gjs/jsapi-util.cpp |   16 ++++------------
 2 files changed, 5 insertions(+), 13 deletions(-)
---
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 85777bb..f0fba85 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1593,7 +1593,7 @@ bootstrap_coverage(GjsCoverage *coverage)
 
     JSObject *debuggee = gjs_get_import_global(context);
     JS::CompartmentOptions options;
-    options.setVersion(JSVERSION_LATEST);
+    options.behaviors().setVersion(JSVERSION_LATEST);
     JS::RootedObject debugger_compartment(context,
         JS_NewGlobalObject(context, &coverage_global_class, NULL,
                            JS::FireOnNewGlobalHook, options));
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index dca61c9..613a3bf 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -82,29 +82,21 @@ gjs_init_context_standard (JSContext              *context,
 {
     JS::CompartmentOptions compartment_options;
 
-    bool extra_warnings = false;
+    /* setExtraWarnings: Be extra strict about code that might hide a bug */
     if (!g_getenv("GJS_DISABLE_EXTRA_WARNINGS")) {
         gjs_debug(GJS_DEBUG_CONTEXT, "Enabling extra warnings");
-        extra_warnings = true;
+        JS::ContextOptionsRef(context).setExtraWarnings(true);
     }
 
-    /* setDontReportUncaught: Don't send exceptions to our error report handler;
-     * instead leave them set. This allows us to get at the exception object.
-     *
-     * setExtraWarnings: Report warnings to error reporter function.
-     */
-    JS::ContextOptionsRef(context).setDontReportUncaught(true);
-    JS::RuntimeOptionsRef(context).setExtraWarnings(extra_warnings);
-
     if (!g_getenv("GJS_DISABLE_JIT")) {
         gjs_debug(GJS_DEBUG_CONTEXT, "Enabling JIT");
-        JS::RuntimeOptionsRef(context)
+        JS::ContextOptionsRef(context)
             .setIon(true)
             .setBaseline(true)
             .setAsmJS(true);
     }
 
-    compartment_options.setVersion(JSVERSION_LATEST);
+    compartment_options.behaviors().setVersion(JSVERSION_LATEST);
     global.set(JS_NewGlobalObject(context, &global_class, NULL,
                                   JS::FireOnNewGlobalHook, compartment_options));
     if (global == NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]