libhubbub parse error on google homepage

Dean Mao deanmao at gmail.com
Wed Oct 24 10:54:49 BST 2012


Here's a more compact test:

<script>for(var i=3D0;i<n;i++);</script>

Outputs:

START TAG: 'script'
CHARACTERS: 'for(var i=3D0;i'
START TAG: 'n;i++);<' attributes:
'script' =3D ''

Essentially everything inside a <script> tag should be treated as
characters until a </script> tag is seen.



On Wed, Oct 24, 2012 at 2:42 AM, Dean Mao <deanmao at gmail.com> wrote:

> I'm trying out the hubbub parser and I gave it a test run on the google
> homepage's html, but it thinks a piece of javascript as the beginning
> script tag.  I used the tokeniser.c in the test directory to test it out.
>
> Here's the relevant output:
> CHARACTERS: '&'
> CHARACTERS: 'd!=3Dthis;d=3Dd.parentNode){var E=3Dd,u,e=3DE;u=3Da;var
> v=3De.__jsaction;if(!v){var v=3De.__jsaction=3D{},l=3Df;"getAttribute"in =
e'
> CHARACTERS: '&'
> CHARACTERS: '&'
> CHARACTERS: '(l=3De.getAttribute("jsaction"));if(e=3Dl)for(var
> e=3De.split(p),l=3D0,n=3De?e.length:0;l'
> START TAG: 'n;l++){var' attributes:
>         'j' =3D 'e[l];if(j){var'
>         'g' =3D
> 'j.indexOf(":"),m=3D-1!=3Dg,w=3Dm?j.substr(0,g).replace(/^\s+/,"").replac=
e(/\s+$/,""):"click",j=3Dm?j.substr(g+1).replace(/^\s+/,"").replace(/\s+$/,=
""):j;v[w]=3Dj}}}if(u=3Dv[u]){a=3D{eventType:a,event:b,targetElement:t,acti=
on:u,actionElement:E};break'
>         'a}}a' =3D
> 'f}a&&(b.stopPropagation?b.stopPropagation():b.cancelBubble=3D!0,"A"=3D=
=3Da.actionElement.tagName&&"click"=3D=3Dh&&(b.preventDefault?b.preventDefa=
ult():b.returnValue=3D!1),c.d?c.d(a):(t=3Da,b=3D(d=3Di.document)&&!d.create=
Event&&d.createEventObject?d.createEventObject(b):b,t.event=3Db,c.c.push(a)=
))};var'
>         'g;g' =3D 'function(b){var'
>         'a' =3D
> 'h,c=3Dn,d=3D!1;if(b.addEventListener){if("focus"=3D=3Da||"blur"=3D=3Da)d=
=3D!0;b.addEventListener(a,c,d)}else'
>         'if(b.attachevent){"focus"' =3D
> '=3Da?a=3D"focusin":"blur"=3D=3Da&&(a=3D"focusout");var'
>
>
> Essentially there's some javascript in there that looks like this:
>
> for(var e=3De.split(p),l=3D0,n=3De?e.length:0;l<n;l++){var j=3De[l];if(j)=
{var
> g=3Dj.indexOf(":"),m=3D-1!=3Dg,w=3Dm?j.substr(0,g).replace(/^\s+/,"").rep=
lace(/\s+$/,""):"click",j=3Dm?j.substr(g+1).replace(/^\s+/,"").replace(/\s+=
$/,""):j;v[w]=3Dj}}}if(u=3Dv[u]){a=3D{eventType:a,event:b,targetElement:t,a=
ction:u,actionElement:E};break
>
> And it thinks that this is the beginning of an html tag:  <n;l++)   --
> it's a comparison statement inside the for-loop.
>
> Any clues where I might start looking to see why this might be?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://vlists.pepperfish.net/pipermail/netsurf-dev-netsurf-browser.org=
/attachments/20121024/2a0f6464/attachment.html


More information about the netsurf-dev mailing list