seed r218 - in trunk: libseed tests



Author: racarr
Date: Sun Nov  9 07:14:31 2008
New Revision: 218
URL: http://svn.gnome.org/viewvc/seed?rev=218&view=rev

Log:
Add exceptions in signal handlers, and a test for such.


Added:
   trunk/tests/signal-exception.js   (contents, props changed)
Modified:
   trunk/libseed/seed-exceptions.c
   trunk/libseed/seed-exceptions.h
   trunk/libseed/seed-private.h
   trunk/libseed/seed-signals.c
   trunk/tests/Makefile.am

Modified: trunk/libseed/seed-exceptions.c
==============================================================================
--- trunk/libseed/seed-exceptions.c	(original)
+++ trunk/libseed/seed-exceptions.c	Sun Nov  9 07:14:31 2008
@@ -113,6 +113,8 @@
     g_free(mes);
     g_free(file);
     g_free(name);
+    
+    return ret;
 }
 
 

Modified: trunk/libseed/seed-exceptions.h
==============================================================================
--- trunk/libseed/seed-exceptions.h	(original)
+++ trunk/libseed/seed-exceptions.h	Sun Nov  9 07:14:31 2008
@@ -30,8 +30,7 @@
 gchar *seed_exception_get_message(JSValueRef e);
 guint seed_exception_get_line(JSValueRef e);
 gchar *seed_exception_get_file(JSValueRef e);
-
 gchar * seed_exception_to_string(JSValueRef e);
 
 
-#endif _SEED_ENGINE_H
+#endif

Modified: trunk/libseed/seed-private.h
==============================================================================
--- trunk/libseed/seed-private.h	(original)
+++ trunk/libseed/seed-private.h	Sun Nov  9 07:14:31 2008
@@ -45,5 +45,6 @@
 #include "seed-structs.h"
 #include "seed-closure.h"
 #include "seed-gtype.h"
+#include "seed-exceptions.h"
 
 #endif

Modified: trunk/libseed/seed-signals.c
==============================================================================
--- trunk/libseed/seed-signals.c	(original)
+++ trunk/libseed/seed-signals.c	Sun Nov  9 07:14:31 2008
@@ -110,7 +110,7 @@
 			 gpointer invocation_hint, gpointer marshall_data)
 {
     SeedClosure *seed_closure = (SeedClosure *) closure;
-    JSValueRef *args;
+    JSValueRef *args, exception = 0;
     gint i;
 
     args = g_newa(JSValueRef, n_param_values + 1);
@@ -132,7 +132,17 @@
 	args[i] = JSValueMakeNull(eng->context);
 
     JSObjectCallAsFunction(eng->context, seed_closure->function,
-			   seed_closure->this, n_param_values + 1, args, 0);
+			   seed_closure->this, 
+			   n_param_values + 1, 
+			   args, &exception);
+    
+    if (exception)
+    {
+	gchar * mes = seed_exception_to_string(exception);
+	g_warning("Exception in signal handler. %s \n", mes, 0);
+	g_free(mes);
+    }
+    
 }
 
 static JSValueRef

Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am	(original)
+++ trunk/tests/Makefile.am	Sun Nov  9 07:14:31 2008
@@ -9,6 +9,7 @@
     gtype.js \
     json.js \
     enum.js \
+    signal-exception.js \
     gerror.js \
     gobject-scope.js \
     include.js \

Added: trunk/tests/signal-exception.js
==============================================================================
--- (empty file)
+++ trunk/tests/signal-exception.js	Sun Nov  9 07:14:31 2008
@@ -0,0 +1,12 @@
+#!/usr/local/bin/seed
+// Returns: 0
+// STDIN:
+// STDOUT:
+// STDERR:\n\*\* \(seed:[0-9]+\): WARNING \*\*: Exception in signal handler. Line 10 in \.\/signal-exception.js: ReferenceError Left side of assignment is not a reference\.
+Seed.import_namespace("Gtk");
+Gtk.init(null, null);
+
+w = new Gtk.Window();
+
+w.signal.map.connect(function(){3 = undefined});
+w.show();



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