[gjs/mozjs78: 5/17] js: Remove JSREPORT_ERROR and JSREPORT_WARNING




commit 3cb7b8052546d20b0a1240f011f556c8bc8fe971
Author: Evan Welsh <noreply evanwelsh com>
Date:   Sat Jul 4 22:27:34 2020 -0500

    js: Remove JSREPORT_ERROR and JSREPORT_WARNING
    
    The JSErrorReport flags are no longer exposed. Instead use the isWarning
    method to distinguish between a warning and an error.
    
    See: GNOME/gjs#329

 gjs/jsapi-util-error.cpp | 5 ++---
 modules/console.cpp      | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index 6148c894..94c11115 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -238,15 +238,14 @@ void gjs_warning_reporter(JSContext*, JSErrorReport* report) {
     g_assert(report);
 
     if (gjs_environment_variable_is_set("GJS_ABORT_ON_OOM") &&
-        report->flags == JSREPORT_ERROR &&
-        report->errorNumber == 137) {
+        !report->isWarning() && report->errorNumber == 137) {
         /* 137, JSMSG_OUT_OF_MEMORY */
         g_error("GJS ran out of memory at %s: %i.",
                 report->filename,
                 report->lineno);
     }
 
-    if ((report->flags & JSREPORT_WARNING) != 0) {
+    if (report->isWarning()) {
         warning = "WARNING";
         level = G_LOG_LEVEL_MESSAGE;
 
diff --git a/modules/console.cpp b/modules/console.cpp
index a8519bc6..96cadf66 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -226,7 +226,7 @@ public:
 
         JSErrorReport* report = error_from_exception_value(v_exn);
         if (report) {
-            g_assert(!JSREPORT_IS_WARNING(report->flags));
+            g_assert(!report->isWarning());
             gjs_console_print_error(report);
         } else {
             GjsAutoChar display_str = gjs_value_debug_string(m_cx, v_exn);


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