[gjs/wip/ptomato/mozjs38: 25/35] js: Adapt to new JS_SetErrorReporter() API



commit 2a3a55b4771a490990b4079e774f9c2482a063f5
Author: Philip Chimento <philip chimento gmail com>
Date:   Wed Jan 11 23:13:44 2017 -0800

    js: Adapt to new JS_SetErrorReporter() API
    
    JS_SetErrorReporter() now acts on a JSRuntime, not a JSContext.
    (JSRuntime and JSContext will be merged in a future version of
    SpiderMonkey anyway.)

 gjs/jsapi-util.cpp      |    2 --
 gjs/runtime.cpp         |    1 +
 modules/console.cpp     |    2 +-
 test/gjs-test-utils.cpp |    2 +-
 4 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index d1d3091..7a6110b 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -101,8 +101,6 @@ gjs_init_context_standard (JSContext              *context,
             .setAsmJS(true);
     }
 
-    JS_SetErrorReporter(context, gjs_error_reporter);
-
     compartment_options.setVersion(JSVERSION_LATEST);
     global.set(JS_NewGlobalObject(context, &global_class, NULL,
                                   JS::FireOnNewGlobalHook, compartment_options));
diff --git a/gjs/runtime.cpp b/gjs/runtime.cpp
index fbeb6b6..eebeaf4 100644
--- a/gjs/runtime.cpp
+++ b/gjs/runtime.cpp
@@ -310,6 +310,7 @@ gjs_runtime_for_current_thread(void)
         JS_SetGCParameter(runtime, JSGC_MAX_BYTES, 0xffffffff);
         JS_SetLocaleCallbacks(runtime, &gjs_locale_callbacks);
         JS_SetFinalizeCallback(runtime, gjs_finalize_callback);
+        JS_SetErrorReporter(runtime, gjs_error_reporter);
 
         g_private_set(&thread_runtime, runtime);
     }
diff --git a/modules/console.cpp b/modules/console.cpp
index b746136..60f095b 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -169,7 +169,7 @@ gjs_console_interact(JSContext *context,
     int startline;
     FILE *file = stdin;
 
-    JS_SetErrorReporter(context, gjs_console_error_reporter);
+    JS_SetErrorReporter(JS_GetRuntime(context), gjs_console_error_reporter);
 
         /* It's an interactive filehandle; drop into read-eval-print loop. */
     lineno = 1;
diff --git a/test/gjs-test-utils.cpp b/test/gjs-test-utils.cpp
index 1540e28..16965cb 100644
--- a/test/gjs-test-utils.cpp
+++ b/test/gjs-test-utils.cpp
@@ -58,7 +58,7 @@ gjs_unit_test_fixture_setup(GjsUnitTestFixture *fx,
 
     /* This is for shoving private data into the error reporter callback */
     g_object_set_data(G_OBJECT(fx->gjs_context), "test fixture", fx);
-    JS_SetErrorReporter(fx->cx, test_error_reporter);
+    JS_SetErrorReporter(JS_GetRuntime(fx->cx), test_error_reporter);
 
     JS_BeginRequest(fx->cx);
 


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