3

I have a web application written in java gwt. When opening the website in IE8 there always popups the message that says 'A script on this page is causing your web browser to run slowly' The message only appears in IE8 no higher version and not in FF or Chrome!

Since the application is written in java gwt its pretty difficult to debug the javascript code , is there another possibility to determine the problem?

The application also has many asynchronous calls a database might that be the problem?

wasp256
  • 5,943
  • 12
  • 72
  • 119

3 Answers3

9

This message means that JavaScript blocks browser thread for quite a long time.

Its implementation in IE8 is really silly. It counts number of JavaScript lines of code (instructions) it executes and if it reaches certain threshold this message is shown.

Actually this limit is configured in Windows registry, by default it is 5000000 or something like that. It could be increased, which is not a recommended solution of course.

One of the ways to avoid this message is to use GWT DeferredCommand. If you could split the work being done to chunks small enough not to trigger IE8 guard constraint you will be fine. Also try to merge multiple asynchronous requests into as few as possible and improve rendering logic, potentially shifting from Widgets to UI Binder or plain DOM.

This is related question (Disabling the long-running-script message in Internet Explorer)

Community
  • 1
  • 1
Dmitry Buzdin
  • 1,233
  • 1
  • 9
  • 15
1

I would slightly disagree on - "java gwt its pretty difficult to debug the javascript code"

MSDN article for disabling slow script warning only hides the problem.

The slow script warning occurs when you have a heavy for loop or deep recursive call. This can happen in 2 scenarios -

1) Poorly coded client side processing logic - example tree navigation
2) Deep object graph in rpc.

You can quickly isolate the trouble spot if you familiarize yourself with

1) Using Speed Tracer - https://developers.google.com/web-toolkit/speedtracer/

2) Using GWT logging - https://developers.google.com/web-toolkit/doc/latest/DevGuideLogging

3) Using Chrome Dev Tools & Firebug to capture timeline, profiling etc

4) IE8 has profiling , but it is darn slow and cumbersome.

5) Use GWT Pretty mode instead OBF mode when profiling.

Once you are sure which part of the code is causing the slow script warning Just FIX it.

appbootup
  • 9,537
  • 3
  • 33
  • 65
0

Because some scripts may take an excessive amount of time to run, Internet Explorer prompts the user to decide whether they would like to continue running the slow script.

If the Generated Cache.js Javascript file is some what in big size that message may come .

So The message box for Internet Explorer versions 4.0, 5.0, 6, 7, and 8 come with a message

Read this article on MS blog

And refer the below question

a script on this page is causing ie to run slowly

Community
  • 1
  • 1
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
  • 4
    "The normal GWT application cache.js is about 600kb-1MB" Where did you get those numbers? And how exactly do you determine that an app is a "normal GWT application"? – rodrigo-silveira Feb 12 '13 at 13:53
  • "normal" is different for different apps. We have app that runs into several MB's if compiled without using Code Splitting. We do use CodeSplitting and split up the app into smaller chunks !!! – appbootup Feb 12 '13 at 14:12
  • @SSR Agreed.We do faced the same situation and removed unnecessary css ,unused widgets,found places to do some code splitting etc and take down the file to 750kb now . – Suresh Atta Feb 12 '13 at 14:19