r18825 - in /branches/upstream/libjavascript-perl/current: CREDITS Changes META.yml PJS_Class.c lib/JavaScript.pm lib/JavaScript/Context.pm t/20-bind-class.t

roberto at users.alioth.debian.org roberto at users.alioth.debian.org
Sat Apr 19 16:07:23 UTC 2008


Author: roberto
Date: Sat Apr 19 16:07:22 2008
New Revision: 18825

URL: http://svn.debian.org/wsvn/?sc=1&rev=18825
Log:
[svn-upgrade] Integrating new upstream version, libjavascript-perl (1.06)

Modified:
    branches/upstream/libjavascript-perl/current/CREDITS
    branches/upstream/libjavascript-perl/current/Changes
    branches/upstream/libjavascript-perl/current/META.yml
    branches/upstream/libjavascript-perl/current/PJS_Class.c
    branches/upstream/libjavascript-perl/current/lib/JavaScript.pm
    branches/upstream/libjavascript-perl/current/lib/JavaScript/Context.pm
    branches/upstream/libjavascript-perl/current/t/20-bind-class.t

Modified: branches/upstream/libjavascript-perl/current/CREDITS
URL: http://svn.debian.org/wsvn/branches/upstream/libjavascript-perl/current/CREDITS?rev=18825&op=diff
==============================================================================
--- branches/upstream/libjavascript-perl/current/CREDITS (original)
+++ branches/upstream/libjavascript-perl/current/CREDITS Sat Apr 19 16:07:22 2008
@@ -14,6 +14,7 @@
 Peter Stamfest
 Toru Yamaguchi
 Daniel Burke
+Gavin Carr
 
 -- And it wouldn't be possible without the extraordinary works by
 

Modified: branches/upstream/libjavascript-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libjavascript-perl/current/Changes?rev=18825&op=diff
==============================================================================
--- branches/upstream/libjavascript-perl/current/Changes (original)
+++ branches/upstream/libjavascript-perl/current/Changes Sat Apr 19 16:07:22 2008
@@ -1,5 +1,11 @@
 Revision history for Perl extension JavaScript.
 
+1.06 ...
+    - Objects returned when creating constructor for bound classes should not increment
+      refcount because this causes the objects to never be freed (James Duncan)
+    - Docs stated argument constructor could be omitted in bind_class which wasn't the case and 
+      so now it can and a default constructor will be created.
+      
 1.05 Tue Apr 1 2008
     - Drop support for error handlers
     - This module now requires SpiderMonkey 1.7 or later.

Modified: branches/upstream/libjavascript-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libjavascript-perl/current/META.yml?rev=18825&op=diff
==============================================================================
--- branches/upstream/libjavascript-perl/current/META.yml (original)
+++ branches/upstream/libjavascript-perl/current/META.yml Sat Apr 19 16:07:22 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                JavaScript
-version:             1.05
+version:             1.06
 abstract:            Perl extension for executing embedded JavaScript
 license:             perl
 author:              

Modified: branches/upstream/libjavascript-perl/current/PJS_Class.c
URL: http://svn.debian.org/wsvn/branches/upstream/libjavascript-perl/current/PJS_Class.c?rev=18825&op=diff
==============================================================================
--- branches/upstream/libjavascript-perl/current/PJS_Class.c (original)
+++ branches/upstream/libjavascript-perl/current/PJS_Class.c Sat Apr 19 16:07:22 2008
@@ -208,9 +208,7 @@
             /* We must have thrown an exception */
             return JS_FALSE;
         }
-        
-        SvREFCNT_inc(rsv);
-        
+                
         JS_SetPrivate(cx, obj, (void *) rsv); 
     }
 

Modified: branches/upstream/libjavascript-perl/current/lib/JavaScript.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libjavascript-perl/current/lib/JavaScript.pm?rev=18825&op=diff
==============================================================================
--- branches/upstream/libjavascript-perl/current/lib/JavaScript.pm (original)
+++ branches/upstream/libjavascript-perl/current/lib/JavaScript.pm Sat Apr 19 16:07:22 2008
@@ -23,7 +23,7 @@
 
 our %EXPORT_TAGS = ( all => [@EXPORT_OK] );
 
-our $VERSION = '1.05';
+our $VERSION = '1.06';
 
 our $MAXBYTES = 1024 ** 2;
 

Modified: branches/upstream/libjavascript-perl/current/lib/JavaScript/Context.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libjavascript-perl/current/lib/JavaScript/Context.pm?rev=18825&op=diff
==============================================================================
--- branches/upstream/libjavascript-perl/current/lib/JavaScript/Context.pm (original)
+++ branches/upstream/libjavascript-perl/current/lib/JavaScript/Context.pm Sat Apr 19 16:07:22 2008
@@ -211,8 +211,8 @@
     die "Argument 'name' must match /^[A-Za-z0-9_]+\$/" unless($args{name} =~ /^[A-Za-z0-9\_]+$/);
     
     # Check if constructor is supplied and it's an coderef
-    die "Missing argument 'constructor'\n" unless(exists $args{constructor});
-    my $cons = _resolve_method($args{constructor}, 1);
+    my $cons; 
+    $cons = _resolve_method($args{constructor}, 1) if exists $args{constructor};
     
     if (exists $args{flags}) {
         die "Argument 'flags' is not numeric\n" unless($args{flags} =~ /^\d+$/);
@@ -226,6 +226,13 @@
     
     my $name = $args{name};
     my $pkg = $args{package} || $name;
+    
+    # Create a default constructor
+    if (!defined $cons) {
+        $cons = sub {
+            $pkg->new(@_);
+        };
+    }
     
     # Per-object methods
     my $fs = _extract_methods(\%args, qw(methods fs));

Modified: branches/upstream/libjavascript-perl/current/t/20-bind-class.t
URL: http://svn.debian.org/wsvn/branches/upstream/libjavascript-perl/current/t/20-bind-class.t?rev=18825&op=diff
==============================================================================
--- branches/upstream/libjavascript-perl/current/t/20-bind-class.t (original)
+++ branches/upstream/libjavascript-perl/current/t/20-bind-class.t Sat Apr 19 16:07:22 2008
@@ -2,7 +2,7 @@
 
 package Foo;
 
-use Test::More tests => 23;
+use Test::More tests => 25;
 
 use Test::Exception;
 
@@ -42,7 +42,21 @@
                      package => "Foo",
                  );
     my $p = $cx1->eval("new Bar()");
+    isa_ok($o, "Foo");    
+}
+
+{
+    # Default constructor
+    # If we don't define package assume same as name
+    my $cx1 = $rt1->create_context();
+    $cx1->bind_class(name => "Foo");
+    $cx1->bind_class(name => "Baz", package => "Foo");
+
+    my $o = $cx1->eval("new Foo();");
     isa_ok($o, "Foo");
+    $o = $cx1->eval("new Baz();");
+    isa_ok($o, "Foo");
+
 }
 
 # Check fs and static_fs




More information about the Pkg-perl-cvs-commits mailing list