Skip Menu |

This queue is for tickets about the JavaScript-SpiderMonkey CPAN distribution.

Report information
The Basics
Id: 14204
Status: open
Priority: 0/
Queue: JavaScript-SpiderMonkey

People
Owner: Nobody in particular
Requestors: valyala [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.11
Fixed in: (no value)



Subject: property_by_path() doesn't work as expected
distribution name: JavaScript-SpiderMonkey-0.11 perl version: v5.8.7 built for i386-linux-thread-multi operating system: Linux hst2 2.6.8-1-386 #1 Mon Sep 13 23:29:55 EDT 2004 i686 GNU/Linux Function property_by_path() doesn't work as expected. The following perl code emits segmentation fault: use JavaScript::SpiderMonkey; my $js = JavaScript::SpiderMonkey->new(); $js->init(); $js->property_by_path('a.a'); $js->eval('a.a = 1'); Another problem that property_by_path() modifies parent objects in property path to Global object. This is completely unexpected behaviour: my $js = JavaScript::SpiderMonkey->new(); $js->init(); $js->function_set("alert", sub { print shift(@_) . "\n"; }); # creates object [a] with Object property [b], which has Number property [c] with value [123]. $js->eval('a = {b:{c:123}};'); # try to setup getter handler on a.b.innerHTML $js->property_by_path('a.b.innerHTML', 'test', sub { print "getter\n";} ); # check elements of object [a] $js->eval('alert(a.b.innerHTML)'); # prints "getter\ntest\n". All ok $js->eval('alert(a.b.c)'); # prints "undefined". Expected "123" $js->eval('alert(a.b)'); # prints "object Global". Expected "object Object" $js->eval('alert(a)'); # prints "object Global". Expected "object Object"
From: benkasminbullock [...] gmail.com
On Wed Aug 17 04:11:16 2005, guest wrote: Show quoted text
> distribution name: JavaScript-SpiderMonkey-0.11 > perl version: v5.8.7 built for i386-linux-thread-multi > operating system: Linux hst2 2.6.8-1-386 #1 Mon Sep 13 23:29:55 EDT > 2004 i686 GNU/Linux > > Function property_by_path() doesn't work as expected. The following > perl code emits segmentation fault: > > use JavaScript::SpiderMonkey; > > my $js = JavaScript::SpiderMonkey->new(); > $js->init(); > $js->property_by_path('a.a'); > $js->eval('a.a = 1');
property_by_path sets up setter_dispatcher even when "setter" is undef, as in the above. This bug could easily be fixed simply by testing "setter" in the property_by_path call, and setting the value of setter to NULL if it is undef. I'll hold off sending a patch until I hear from you about the last thing I sent.