Title: [230705] trunk
Revision
230705
Author
[email protected]
Date
2018-04-17 01:41:04 -0700 (Tue, 17 Apr 2018)

Log Message

[GLIB] Add API to clear JSCContext uncaught exception
https://bugs.webkit.org/show_bug.cgi?id=184685

Reviewed by Žan Doberšek.

Source/_javascript_Core:

Add jsc_context_clear_exception() to clear any possible uncaught exception in a JSCContext.

* API/glib/JSCContext.cpp:
(jsc_context_clear_exception):
* API/glib/JSCContext.h:
* API/glib/docs/jsc-glib-4.0-sections.txt:

Tools:

Add test cases for the new API.

* TestWebKitAPI/Tests/_javascript_Core/glib/TestJSC.cpp:
(testJSCExceptions):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/glib/JSCContext.cpp (230704 => 230705)


--- trunk/Source/_javascript_Core/API/glib/JSCContext.cpp	2018-04-17 08:15:28 UTC (rev 230704)
+++ trunk/Source/_javascript_Core/API/glib/JSCContext.cpp	2018-04-17 08:41:04 UTC (rev 230705)
@@ -589,6 +589,19 @@
 }
 
 /**
+ * jsc_context_clear_exception:
+ * @context: a #JSCContext
+ *
+ * Clear the uncaught exception in @context if any.
+ */
+void jsc_context_clear_exception(JSCContext* context)
+{
+    g_return_if_fail(JSC_IS_CONTEXT(context));
+
+    context->priv->exception = nullptr;
+}
+
+/**
  * JSCExceptionHandler:
  * @context: a #JSCContext
  * @exception: a #JSCException

Modified: trunk/Source/_javascript_Core/API/glib/JSCContext.h (230704 => 230705)


--- trunk/Source/_javascript_Core/API/glib/JSCContext.h	2018-04-17 08:15:28 UTC (rev 230704)
+++ trunk/Source/_javascript_Core/API/glib/JSCContext.h	2018-04-17 08:41:04 UTC (rev 230705)
@@ -88,6 +88,9 @@
                                       JSCException       *exception);
 
 JSC_API void
+jsc_context_clear_exception          (JSCContext         *context);
+
+JSC_API void
 jsc_context_push_exception_handler   (JSCContext         *context,
                                       JSCExceptionHandler handler,
                                       gpointer            user_data,

Modified: trunk/Source/_javascript_Core/API/glib/docs/jsc-glib-4.0-sections.txt (230704 => 230705)


--- trunk/Source/_javascript_Core/API/glib/docs/jsc-glib-4.0-sections.txt	2018-04-17 08:15:28 UTC (rev 230704)
+++ trunk/Source/_javascript_Core/API/glib/docs/jsc-glib-4.0-sections.txt	2018-04-17 08:41:04 UTC (rev 230705)
@@ -32,6 +32,7 @@
 jsc_context_get_exception
 jsc_context_throw
 jsc_context_throw_exception
+jsc_context_clear_exception
 jsc_context_push_exception_handler
 jsc_context_pop_exception_handler
 jsc_context_get_current

Modified: trunk/Source/_javascript_Core/ChangeLog (230704 => 230705)


--- trunk/Source/_javascript_Core/ChangeLog	2018-04-17 08:15:28 UTC (rev 230704)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-04-17 08:41:04 UTC (rev 230705)
@@ -1,5 +1,19 @@
 2018-04-17  Carlos Garcia Campos  <[email protected]>
 
+        [GLIB] Add API to clear JSCContext uncaught exception
+        https://bugs.webkit.org/show_bug.cgi?id=184685
+
+        Reviewed by Žan Doberšek.
+
+        Add jsc_context_clear_exception() to clear any possible uncaught exception in a JSCContext.
+
+        * API/glib/JSCContext.cpp:
+        (jsc_context_clear_exception):
+        * API/glib/JSCContext.h:
+        * API/glib/docs/jsc-glib-4.0-sections.txt:
+
+2018-04-17  Carlos Garcia Campos  <[email protected]>
+
         [GLIB] Add API to query, delete and enumerate properties
         https://bugs.webkit.org/show_bug.cgi?id=184647
 

Modified: trunk/Tools/ChangeLog (230704 => 230705)


--- trunk/Tools/ChangeLog	2018-04-17 08:15:28 UTC (rev 230704)
+++ trunk/Tools/ChangeLog	2018-04-17 08:41:04 UTC (rev 230705)
@@ -1,5 +1,17 @@
 2018-04-17  Carlos Garcia Campos  <[email protected]>
 
+        [GLIB] Add API to clear JSCContext uncaught exception
+        https://bugs.webkit.org/show_bug.cgi?id=184685
+
+        Reviewed by Žan Doberšek.
+
+        Add test cases for the new API.
+
+        * TestWebKitAPI/Tests/_javascript_Core/glib/TestJSC.cpp:
+        (testJSCExceptions):
+
+2018-04-17  Carlos Garcia Campos  <[email protected]>
+
         [GLIB] Add API to query, delete and enumerate properties
         https://bugs.webkit.org/show_bug.cgi?id=184647
 

Modified: trunk/Tools/TestWebKitAPI/Tests/_javascript_Core/glib/TestJSC.cpp (230704 => 230705)


--- trunk/Tools/TestWebKitAPI/Tests/_javascript_Core/glib/TestJSC.cpp	2018-04-17 08:15:28 UTC (rev 230704)
+++ trunk/Tools/TestWebKitAPI/Tests/_javascript_Core/glib/TestJSC.cpp	2018-04-17 08:41:04 UTC (rev 230705)
@@ -1622,6 +1622,9 @@
         g_assert_cmpstr(jsc_exception_get_message(exception), ==, "Can't find variable: foo");
         g_assert_cmpuint(jsc_exception_get_line_number(exception), ==, 1);
         g_assert_false(jsc_exception_get_source_uri(exception));
+
+        jsc_context_clear_exception(context.get());
+        g_assert_null(jsc_context_get_exception(context.get()));
     }
 
     {
@@ -1638,6 +1641,9 @@
         g_assert_true(JSC_IS_EXCEPTION(exception));
         checker.watch(exception);
         g_assert_cmpuint(jsc_exception_get_line_number(exception), ==, 2);
+
+        jsc_context_clear_exception(context.get());
+        g_assert_null(jsc_context_get_exception(context.get()));
     }
 
     {
@@ -1654,6 +1660,9 @@
         g_assert_true(JSC_IS_EXCEPTION(exception));
         checker.watch(exception);
         g_assert_cmpstr(jsc_exception_get_source_uri(exception), ==, "file:///foo/script.js");
+
+        jsc_context_clear_exception(context.get());
+        g_assert_null(jsc_context_get_exception(context.get()));
     }
 
     {
@@ -1682,6 +1691,9 @@
         g_assert_cmpstr(jsc_exception_get_message(exception), ==, "API exception");
         g_assert_cmpuint(jsc_exception_get_line_number(exception), ==, 1);
         g_assert_false(jsc_exception_get_source_uri(exception));
+
+        jsc_context_clear_exception(context.get());
+        g_assert_null(jsc_context_get_exception(context.get()));
     }
 
     {
@@ -1745,6 +1757,9 @@
         g_assert_false(test.wasDeleted);
         jsc_context_pop_exception_handler(context.get());
         g_assert_true(test.wasDeleted);
+
+        jsc_context_clear_exception(context.get());
+        g_assert_null(jsc_context_get_exception(context.get()));
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to