You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Johan Compagner <jc...@gmail.com> on 2007/02/07 17:01:03 UTC
AbstractAjaxTimerBehavior change (by frank/jpq?)
it was this:
protected final String getJsTimeoutCall(final Duration updateInterval)
{
return "setTimeout(function() { " + getCallbackScript(false, true) +
" }, "
+ updateInterval.getMilliseconds() + ");";
}
and now this:
protected final String getJsTimeoutCall(final Duration updateInterval)
{
// this might look strange, but it is necessary for IE not to leak
:(
return "setTimeout(\"" + getCallbackScript(false, true) + "\", "
+ updateInterval.getMilliseconds() + ");";
}
So now it is escaped with an extra \" xxx \"
But this will generated wrong kind of things now for example an onload:
<body onKeyUp="checkForFunctionKey(event);"
onload="onPageLoad();setTimeout(\"var
wcall=wicketAjaxGet('?wicket:interface=:17:screensaver:ss_login:keepalive:-1:IUnversionedBehaviorListener:0&wicket:ignoreIfNotActive=true',
function() { }, function() { });\", 900000);">
This is wrong because now FF complains that there is an illegal char.
Re: AbstractAjaxTimerBehavior change (by frank/jpq?)
Posted by Johan Compagner <jc...@gmail.com>.
thx will change that.
On 2/7/07, Jean-Baptiste Quenot <jb...@apache.org> wrote:
>
> * Johan Compagner:
> > it was this:
> >
> > protected final String getJsTimeoutCall(final Duration updateInterval)
> > {
> > return "setTimeout(function() { " + getCallbackScript(false,
> true) +
> > " }, "
> > + updateInterval.getMilliseconds() + ");";
> > }
> >
> > and now this:
> >
> > protected final String getJsTimeoutCall(final Duration updateInterval)
> > {
> > // this might look strange, but it is necessary for IE not to
> leak
> > :(
> > return "setTimeout(\"" + getCallbackScript(false, true) + "\", "
> > + updateInterval.getMilliseconds() + ");";
> > }
> >
> > So now it is escaped with an extra \" xxx \"
> >
> > But this will generated wrong kind of things now for example an onload:
> >
> > <body onKeyUp="checkForFunctionKey(event);"
> > onload="onPageLoad();setTimeout(\"var
> >
> wcall=wicketAjaxGet('?wicket:interface=:17:screensaver:ss_login:keepalive:-1:IUnversionedBehaviorListener:0&wicket:ignoreIfNotActive=true',
> > function() { }, function() { });\", 900000);">
> >
> >
> > This is wrong because now FF complains that there is an illegal char.
>
> Hi Johan,
>
> I remember this change, and you're right JavaScript on the client
> side behaves differently. It requires proper XML escaping.
>
> The fix to the fix is to replace \" with "
>
> I tested it locally with a sample HTML file and works fine.
>
> I don't use this AjaxTimer myself, that's why I didn't encounter
> the problem.
>
> Cheers,
> --
> Jean-Baptiste Quenot
> aka John Banana Qwerty
> http://caraldi.com/jbq/
>
Re: AbstractAjaxTimerBehavior change (by frank/jpq?)
Posted by Jean-Baptiste Quenot <jb...@apache.org>.
* Johan Compagner:
> it was this:
>
> protected final String getJsTimeoutCall(final Duration updateInterval)
> {
> return "setTimeout(function() { " + getCallbackScript(false, true) +
> " }, "
> + updateInterval.getMilliseconds() + ");";
> }
>
> and now this:
>
> protected final String getJsTimeoutCall(final Duration updateInterval)
> {
> // this might look strange, but it is necessary for IE not to leak
> :(
> return "setTimeout(\"" + getCallbackScript(false, true) + "\", "
> + updateInterval.getMilliseconds() + ");";
> }
>
> So now it is escaped with an extra \" xxx \"
>
> But this will generated wrong kind of things now for example an onload:
>
> <body onKeyUp="checkForFunctionKey(event);"
> onload="onPageLoad();setTimeout(\"var
> wcall=wicketAjaxGet('?wicket:interface=:17:screensaver:ss_login:keepalive:-1:IUnversionedBehaviorListener:0&wicket:ignoreIfNotActive=true',
> function() { }, function() { });\", 900000);">
>
>
> This is wrong because now FF complains that there is an illegal char.
Hi Johan,
I remember this change, and you're right JavaScript on the client
side behaves differently. It requires proper XML escaping.
The fix to the fix is to replace \" with "
I tested it locally with a sample HTML file and works fine.
I don't use this AjaxTimer myself, that's why I didn't encounter
the problem.
Cheers,
--
Jean-Baptiste Quenot
aka John Banana Qwerty
http://caraldi.com/jbq/