Image setUrl and setResources IE8 JavaScriptException

120 views
Skip to first unread message

Sven

unread,
Jul 4, 2010, 11:41:02 AM7/4/10
to Google Web Toolkit
Dear group,

I created a small GWT test project with just one component on the
start page. This component contains an image.

Into this image, I load two different GIF images, both 600x340 pixels
large, no alpha channel. To load one specific gif to the image, I can
click on four buttons:

Button 1 loads image A by setUrl() into the image.
Button 2 loads image B by setUrl() into the image.
Button 3 loads image A by setResource() into the image.
Button 4 loads image B by setResource() into the image.

The two images served by URL are in a subfolder of the war folder, the
two copies loaded as ImageResource are served as ClientBundle.

In Firefox 3.6 and Safari 5, both methods work fine. In IE 8, a
JavaScriptException (Invalid Argument, number: -2147024809) is thrown
when loading image B by hitting button 4. Also, no image is shown
(image switches to white/blank). After switching IE 8 to compatibility
mode, the page works fine again and button 4 operates like in other
browsers.

It seems that while using setResource() in IE 8 works in principle
(image A is loaded by button 3), it fails with my specific GIF. Also,
IE 8 is able to render the image (image B is loaded by button 2).

Image B, which fails loading, can be accessed through
http://www.dotvoting.org/images/DotVoteResult.gif

For image A, I used a GIF of same dimension drawn from scratch.

Does anybody has an idea what is wrong with image A and what is
causing the exception?

Thanks
Sven

Sven

unread,
Jul 8, 2010, 3:19:15 PM7/8/10
to Google Web Toolkit
Dear group,

if nobody has encountered this problem before, could you point me to
resources how to start debugging in this case best? The exception is
thrown somewhere in the JavaScript code and I am not familiar with
JavaScript debugging.

Thank you,
Sven

On 4 Jul., 17:41, Sven <sven.ti...@googlemail.com> wrote:
> Dear group,
>
> I created a small GWT test project with just one component on the
> start page. This component contains an image.
>
> Into this image, I load two different GIF images, both 600x340 pixels
> large, no alpha channel. To load one specific gif to the image, I can
> click on four buttons:
>
> Button 1 loads image A by setUrl() into the image.
> Button 2 loads image B by setUrl() into the image.
> Button 3 loads image A by setResource() into the image.
> Button 4 loads image B by setResource() into the image.
>
> The two images served by URL are in a subfolder of the war folder, the
> two copies loaded as ImageResource are served as ClientBundle.
>
> In Firefox 3.6 and Safari 5, both methods work fine. In IE 8, aJavaScriptException(Invalid Argument, number: -2147024809) is thrown
> when loading image B by hitting button 4. Also, no image is shown
> (image switches to white/blank). After switching IE 8 to compatibility
> mode, the page works fine again and button 4 operates like in other
> browsers.
>
> It seems that while using setResource() in IE 8 works in principle
> (image A is loaded by button 3), it fails with my specific GIF. Also,
> IE 8 is able to render the image (image B is loaded by button 2).
>
> Image B, which fails loading, can be accessed throughhttp://www.dotvoting.org/images/DotVoteResult.gif

Stefan Bachert

unread,
Jul 9, 2010, 10:21:24 AM7/9/10
to Google Web Toolkit
Hi Sven (hi again;-),

I did not encounter such a situation, yet. However, to my knowledge
IE8 has an limit on data-url of 32KB which are used by GWT
(url(data:...)).
Probably one gif is smaller than the limit but the other is NOT.

When this is the real cause, it is in the end a bug of GWT not to
change the strategy at the right limit.
So increasing (or reducing if you have an idea) the size of the image
may help. (Does it works with the original .png?)

For debugging just compile with "output style: detailed". This gives
you an idea of the position in your java code.

Stefan Bachert
http://gwtworld.de

Sven

unread,
Jul 11, 2010, 5:51:08 AM7/11/10
to Google Web Toolkit
Hi Stefan,

> I did not encounter such a situation, yet. However, to my knowledge
> IE8 has an limit on data-url of 32KB which are used by GWT
> (url(data:...)).
> Probably one gif is smaller than the limit but the other is NOT.

that seems to be the cause. However, only one out of four images in
the resoucebundle is (slightly) larger than 32k, the others are
smaller and still not displayed.

> For debugging just compile with "output style: detailed". This gives
> you an idea of the position in your java code.

Actually, I check the browser version and use setUrl() in case that it
is IE 8. Using the resource bundle works for other browsers (including
IE 7, but maybe I need to check).

Thanks,
Sven

PhilBeaudoin

unread,
Jul 12, 2010, 11:53:49 PM7/12/10
to Google Web Toolkit
I've encountered the problem and entered this as an issue in the
tracker:
http://code.google.com/p/google-web-toolkit/issues/detail?id=5114

Cheers,

Philippe
Reply all
Reply to author
Forward
0 new messages