Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Regular Contributor
mja1986
Posts: 53
Registered: ‎08-27-2013
My Device: none
My Carrier: none

JavaScript execution exceeded Timeout; BB 6

Hi,

 

I am experiencing a Strange issue when trying to build our UI inside a BrowserField, once in a while it works fine, but most of the time the WebInspector tells me that "JavaScript execution exceeded Timeout.", last time I checked that was in the head of a for loop: "for ( ; i < len; i++ ) {" inside JQuery, i is initialized as 0 beforehand, so thats not the issue and the UI works just fine on Android and BlackBerry.

FYI: 

config.setProperty(BrowserFieldConfig.JAVASCRIPT_TIMEOUT, JAVASCRIPT_TIMEOUT);

while

private static final Integer JAVASCRIPT_TIMEOUT = new Integer(600000);

so, since the Timeout issue is happening rather quickly, I guess I am dealing with an error somewhere inside the BrowserField or the ScriptEngine.

Thanks in advance.

Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: JavaScript execution exceeded Timeout; BB 6

There was an automatic timeout on scripts of 10 seconds - this was an (old) prevention to help ensure battery life didn't get sucked away, as well as to try and stabilize runaway web page scripts.  That is the reason for that error.

 

When you say "rather quickly", is it sooner than 10 seconds?

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: JavaScript execution exceeded Timeout; BB 6

Another possible reason

 

Are you using Ripple?

 

I've been using Ripple for interface design (yes, it actually has a use) but there seems to be some online activity (I wish I didn't have) going to some CDN called Heroku (actually - they look good - might try them myself)

 

Having said that - the Heroku - Ripple crashing Chrome is not to be recommended

 

I've noticed another affectation of Ripple as well but that one deserves a sep thread

 

Simply put, if not using Ripple then as Adam says it's summat in the JS

 

A point made recently may expain it, however- have you got a race?

 

This is the only other situation I could see such a thing happening




Click the like button if you find my posts useful!
Please use plain text.
Regular Contributor
mja1986
Posts: 53
Registered: ‎08-27-2013
My Device: none
My Carrier: none

Re: JavaScript execution exceeded Timeout; BB 6

Thanks for your replies. I didn't check the exact time it takes yet, but 10 seconds could be about how long it takes, although I have the feeling that it happens sooner. I will have a look into it, is there a way to get around this issue?

 

I am only using JQuery (1.10.2 at the moment) and JQuery Mobile (but we will most likely drop that one as soon as possible). So, no ripple here.

 

 

Please use plain text.
Regular Contributor
mja1986
Posts: 53
Registered: ‎08-27-2013
My Device: none
My Carrier: none

Re: JavaScript execution exceeded Timeout; BB 6

Well, I had my javascript calculate its execution time at some points, and it seems that from where the script starts to the first point where the calculation is done I am well past 14 seconds, and 30 seconds at the second point, which doesnt really count because I was hanging at a breakpoint for a few seconds.

 

Does the 10 second timeout continue to count when i am waiting for a response to an xmlHttpRequest? Because thats how we implemented the communication between java and javascript. If not, the 14 and 30 seconds are useless because the pure javascript execution time would have been a little lower. Otherwise the 10 seconds timeout isn't what causes my problems here.

Please use plain text.
Regular Contributor
mja1986
Posts: 53
Registered: ‎08-27-2013
My Device: none
My Carrier: none

Re: JavaScript execution exceeded Timeout; BB 6

Well, it looks like timeouts are a way to circumvent this "safeguard", I just put everything thats not vital at this point of initialization into a function I put into setTimeout(function, 1);

I consider this a workaround, not a fix. There most likely isn't a fix to this issue.

Please use plain text.