Skip Menu |

This queue is for tickets about the JavaScript CPAN distribution.

Report information
The Basics
Id: 29412
Status: open
Priority: 0/
Queue: JavaScript

People
Owner: CLAESJAC [...] cpan.org
Requestors: agentzh [...] gmail.com
Cc:
AdminCc:

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



CC: "Claes Jakobsson" <claesjac [...] cpan.org>
Subject: "this can't happen" happens just too often
Date: Mon, 17 Sep 2007 16:54:12 +0800
To: bug-javascript [...] rt.cpan.org
From: "Agent Zhang" <agentzh [...] gmail.com>
Hi, Claes I'm writing something big atop this module (integrating HTML::DOM into JS). First of all I must say JavaScript.pm is really a great module; thank you for your excellent work ;) However, I just get the following error too often today: "this can't happen." I'd expect if JavaScript.xs fails to convert a JS object to a Perl hash, it should simply convert it to a string (by calling the JS obj's toString method or some such). Also, it seems to me, calling die in Perl callbacks also triggers this error message, for example: $context->bind_function('die' => sub { die "@_" }); I'd expect it to propagate the Perl exception instead of simply ignoring the detailed message and giving a helpless "this can't happen" hint. Currently I have to use "warn" everywhere in my Perl callbacks :( Hopefully these will get fixed soon :) Thanks! agentz
Oops...I'm very sorry...the RT was just responding too slowly and I clicked the "Submit" button many times...oh my...they all appeared 18 minutes after... Sorry again for the inconvenience... Cheers, agentz On Mon Sep 17 04:59:19 2007, agentzh@gmail.com wrote: Show quoted text
> Hi, Claes > > I'm writing something big atop this module (integrating HTML::DOM into > JS). First of all I must say JavaScript.pm is really a great module; > thank you for your excellent work ;)
Hi, Can you supply a test-script that shows the behavior as well as what platform, perl version and SpiderMonkey library version (and built options) you're getting this error with. I've tried the binding die with SpiderMonkey 1.7 version retrieved from FIREFOX_2_0_0_7_RELEASE tag in Mozilla CVS and can't seem to get the error. This is w/ perl 5.8.6 on Darwin. Cheers, Claes On Mon Sep 17 04:59:19 2007, agentzh@gmail.com wrote: Show quoted text
> Hi, Claes > > I'm writing something big atop this module (integrating HTML::DOM into > JS). First of all I must say JavaScript.pm is really a great module; > thank you for your excellent work ;) > > However, I just get the following error too often today: > > "this can't happen." > > I'd expect if JavaScript.xs fails to convert a JS object to a Perl > hash, it should simply convert it to a string (by calling the JS obj's > toString method or some such). > > Also, it seems to me, calling die in Perl callbacks also triggers this > error message, for example: > > $context->bind_function('die' => sub { die "@_" }); > > I'd expect it to propagate the Perl exception instead of simply > ignoring the detailed message and giving a helpless "this can't > happen" hint. > > Currently I have to use "warn" everywhere in my Perl callbacks :( > > Hopefully these will get fixed soon :) > > Thanks! > agentz
Subject: Re: [rt.cpan.org #29412] "this can't happen" happens just too often
Date: Mon, 17 Sep 2007 19:19:59 +0800
To: bug-JavaScript [...] rt.cpan.org
From: "Agent Zhang" <agentzh [...] gmail.com>
On 9/17/07, Claes Jakobsson via RT <bug-JavaScript@rt.cpan.org> wrote: Show quoted text
> Hi, > > Can you supply a test-script that shows the behavior as well as what platform, perl version > and SpiderMonkey library version (and built options) you're getting this error with. >
I've attached my stuff...sorry, I can't make it any smaller...die works fine in small cases. You know, I'm building something really big here...predictability is very important for me... please extract the ajaxperl-tmp directory from this .tar.gz, and do the following: $ cd ajaxperl-tmp $ ./test.t it will gives something like: 1..11 ok 1 ok 2 ok 3 ok 4 - URL works ok 5 ok 6 - getAttribute works ok 7 - tagName works ok 8 - document.write works ok 9 Can't convert perl error into JSVAL at /usr/local/lib/perl/5.8.8/JavaScript/Context.pm line 40, <$fh> line 35. BEGIN failed--compilation aborted at ./test.t line 4. # Looks like you planned 11 tests but only ran 9. # Looks like your test died just after 9. The error is caused by a die call around AjaxPerl.pm's line 94. By commenting out that die statement, all tests are passing for me. I'm using js-1.60.tar.gz which was downloaded from ftp://ftp.mozilla.org/pub/mozilla.org/js And my perl -v shows: $ perl -v This is perl, v5.8.8 built for i486-linux-gnu-thread-multi Hope this helps :) Cheers, agentz
Download ajaxperl-tmp.tar.gz
application/x-gzip 6.7k

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #29412] "this can't happen" happens just too often
Date: Mon, 17 Sep 2007 19:26:13 +0800
To: bug-JavaScript [...] rt.cpan.org
From: "Agent Zhang" <agentzh [...] gmail.com>
On 9/17/07, Agent Zhang <agentzh@gmail.com> wrote: Show quoted text
> ok 7 - tagName works > ok 8 - document.write works > ok 9 > Can't convert perl error into JSVAL at > /usr/local/lib/perl/5.8.8/JavaScript/Context.pm line 40, <$fh> line > 35.
For this case, I didn't get "this can't happen". What weird error message I actually get seems to depend on the position of the die call in my AjaxPerl.pm...and sometimes it just has nothing to do with "die" at all...It's very hard to trace... Seems it has something to do with the JS/Perl type casting logic...What type of values I pass between JS and Perl really matters here, which gave me a lot of troubles today...Alas... Thanks, agentz
Subject: Re: [rt.cpan.org #29412] "this can't happen" happens just too often
Date: Mon, 17 Sep 2007 14:26:47 +0200
To: bug-JavaScript [...] rt.cpan.org
From: Claes Jakobsson <claes [...] surfar.nu>
Hm.. In order to be able to pass Perl blessed object to JavaScript the classes must be defined in the context using bind_class. That's why you're getting the "Can't convert perl error into JSVAL" error. Maybe the error message should say something better tho. However, I'll check if it really is necessary in future releases to require all classes to be declared. Would be great if you could supply me with an testcase where the other error occurs. Thanks, Claes On 17 sep 2007, at 13.26, agentzh@gmail.com via RT wrote: Show quoted text
> > Queue: JavaScript > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=29412 > > > On 9/17/07, Agent Zhang <agentzh@gmail.com> wrote:
>> ok 7 - tagName works >> ok 8 - document.write works >> ok 9 >> Can't convert perl error into JSVAL at >> /usr/local/lib/perl/5.8.8/JavaScript/Context.pm line 40, <$fh> line >> 35.
> > For this case, I didn't get "this can't happen". What weird error > message I actually get seems to depend on the position of the die call > in my AjaxPerl.pm...and sometimes it just has nothing to do with "die" > at all...It's very hard to trace... > > Seems it has something to do with the JS/Perl type casting > logic...What type of values I pass between JS and Perl really matters > here, which gave me a lot of troubles today...Alas... > > Thanks, > agentz >