[gjs/wip/ptomato/mozjs52: 7/7] WIP - fixup error reporting



commit 6723c2a2a63c9101be5bee5e8d4c06c99b74939f
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue May 2 23:17:40 2017 -0700

    WIP - fixup error reporting
    
    See
    https://bugzilla.mozilla.org/show_bug.cgi?id=1276400
    https://bugzilla.mozilla.org/show_bug.cgi?id=1277278

 gjs/jsapi-util.cpp          |    2 +-
 gjs/runtime.cpp             |    2 +-
 modules/console.cpp         |    7 ++++---
 test/gjs-test-call-args.cpp |    4 ++--
 test/gjs-test-utils.cpp     |    2 +-
 5 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index e9b84ad..f1a6acd 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -90,10 +90,10 @@ gjs_init_context_standard (JSContext              *context,
 
     /* setDontReportUncaught: Don't send exceptions to our error report handler;
      * instead leave them set. This allows us to get at the exception object.
+     * FIXME
      *
      * setExtraWarnings: Report warnings to error reporter function.
      */
-    JS::ContextOptionsRef(context).setDontReportUncaught(true);
     JS::ContextOptionsRef(context).setExtraWarnings(extra_warnings);
 
     if (!g_getenv("GJS_DISABLE_JIT")) {
diff --git a/gjs/runtime.cpp b/gjs/runtime.cpp
index 83c272a..a98e233 100644
--- a/gjs/runtime.cpp
+++ b/gjs/runtime.cpp
@@ -222,7 +222,7 @@ gjs_create_js_context(GjsContext *js_context)
     // JS_SetGCParameter(cx, JSGC_ALLOCATION_THRESHOLD, 30);
     // JS_SetGCParameter(cx, JSGC_DECOMMIT_THRESHOLD, 32);
     JS_SetLocaleCallbacks(cx, &gjs_locale_callbacks);
-    JS_SetErrorReporter(cx, gjs_error_reporter);
+    //JS_SetErrorReporter(cx, gjs_error_reporter);
 
     return cx;
 }
diff --git a/modules/console.cpp b/modules/console.cpp
index df0d5f8..ac56724 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -177,7 +177,8 @@ gjs_console_interact(JSContext *context,
     int startline;
     FILE *file = stdin;
 
-    JS_SetErrorReporter(JS_GetRuntime(context), gjs_console_error_reporter);
+    //FIXME
+    //JS_SetErrorReporter(JS_GetRuntime(context), gjs_console_error_reporter);
 
         /* It's an interactive filehandle; drop into read-eval-print loop. */
     lineno = 1;
@@ -221,8 +222,8 @@ gjs_console_interact(JSContext *context,
         gjs_schedule_gc_if_needed(context);
 
         if (JS_GetPendingException(context, &result)) {
-            if (!JS_ReportPendingException(context))
-                return false;
+            // if (!JS_ReportPendingException(context))
+            //     return false;
             goto next;
         } else if (result.isUndefined()) {
             goto next;
diff --git a/test/gjs-test-call-args.cpp b/test/gjs-test-call-args.cpp
index 1331210..8ab8539 100644
--- a/test/gjs-test-call-args.cpp
+++ b/test/gjs-test-call-args.cpp
@@ -274,7 +274,7 @@ run_code(GjsUnitTestFixture *fx,
 
     JS::RootedValue ignored(fx->cx);
     bool ok = JS::Evaluate(fx->cx, options, script, strlen(script), &ignored);
-    JS_ReportPendingException(fx->cx);
+    //JS_ReportPendingException(fx->cx);
 
     g_assert_null(fx->message);
     g_assert_true(ok);
@@ -293,7 +293,7 @@ run_code_expect_exception(GjsUnitTestFixture *fx,
     bool ok = JS::Evaluate(fx->cx, options, script, strlen(script), &ignored);
     g_assert_false(ok);
     g_assert_true(JS_IsExceptionPending(fx->cx));
-    JS_ReportPendingException(fx->cx);
+    //JS_ReportPendingException(fx->cx);
     g_assert_nonnull(fx->message);
 
     /* Cheap way to shove an expected exception message into the data argument */
diff --git a/test/gjs-test-utils.cpp b/test/gjs-test-utils.cpp
index 8c39dde..070b747 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(JS_GetRuntime(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]