On Thu, Aug 05, 2010 at 06:21:09PM -0400, Chris Butler wrote:
> forwarded 591132 https://rt.cpan.org/Public/Bug/Display.html?id=60120
> thanks
> 
> This seems to be triggered by a change in libmozjs. The package builds fine
> with libmozjs 1.9.1.10, but not with 1.9.1.11.
> 
> I've had a look at the changes between the two, but can't see anything
> relevant. I've forwarded it upstream to see if they've got any more clue.

The error in $@ after the parsing failure is
 XML cannot be the whole program at main line 21 in 2 

I'm pretty sure the relevant change is
 http://hg.mozilla.org/releases/mozilla-1.9.1/rev/d4b2224cf458

which unfortunately points to the non public bug
 https://bugzilla.mozilla.org/show_bug.cgi?id=568148

Background of the 'XML cannot be the whole program' error can be found at
 http://hg.mozilla.org/releases/mozilla-1.9.1/rev/c4ba70070012
 https://bugzilla.mozilla.org/show_bug.cgi?id=375250

As I understand it, the test for basic E4X functionality got broken by
a security related change that now rejects treating pure XML as valid
top level JavaScript.

A workaround is to change the test so that it mixes some real JavaScript
code with the XML element, for example by explicitly getting the value
of the object. See the attached patch.

It's possible that the code should rather be changed to work around
this (perhaps by adding an extra call frame?). I'll take this up in the
upstream ticket next.
-- 
Niko Tyni   nt...@debian.org
>From 156005a29965b6cada95af97ac53bfa16a6e5b2b Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Sat, 21 Aug 2010 20:56:48 +0300
Subject: [PATCH] Fix E4X test failure with new SpiderMonkey versions

As of Mozilla 1.9.1.11, a pure XML element is not treated as valid
top level JavaScript but rather gets rejected with "XML cannot be the
whole program".

Work around this by throwing some valid JavaScript in the mix that
explicitly takes the value of the object.

See
 http://hg.mozilla.org/releases/mozilla-1.9.1/rev/d4b2224cf458
 http://hg.mozilla.org/releases/mozilla-1.9.1/rev/c4ba70070012
 https://bugzilla.mozilla.org/show_bug.cgi?id=375250
---
 t/26-e4x.t |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/26-e4x.t b/t/26-e4x.t
index de799fb..aeb9c8e 100644
--- a/t/26-e4x.t
+++ b/t/26-e4x.t
@@ -19,7 +19,7 @@ my $runtime = new JavaScript::Runtime();
 my $context = $runtime->create_context();
 
 my $ret = $context->eval(<<'EOP');
-<xml>this is an E4X object</xml>
+(<xml>this is an E4X object</xml>).valueOf();
 EOP
 is($ret, '<xml>this is an E4X object</xml>');
 
-- 
1.7.1

Reply via email to