[gjs] jsapi-util: Don't log any existing exceptions



commit 3752c955459a90507edc06a32a858aa167386acd
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jan 15 19:18:33 2014 -0500

    jsapi-util: Don't log any existing exceptions
    
    This is wrong -- the person who threw the old exception needs to be the
    one to bubble it back up. We shouldn't implicitly clear it. Warn instead.
    
    It was also wrong because we weren't in a compartment when we tried to
    log the exception.

 gjs/jsapi-util.cpp |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 7c85503..5ff2836 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -1285,9 +1285,9 @@ gjs_eval_with_scope(JSContext    *context,
                                     &start_line_number);
 
     /* log and clear exception if it's set (should not be, normally...) */
-    if (gjs_log_exception(context)) {
-        gjs_debug(GJS_DEBUG_CONTEXT,
-                  "Exception was set prior to JS_EvaluateScript()");
+    if (JS_IsExceptionPending(context)) {
+        g_warning("gjs_eval_in_scope called with a pending exception");
+        goto out;
     }
 
     /* JS_EvaluateScript requires a request even though it sort of seems like


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