Reputation: 19111
I'm reading Firefox configuration settings for Dom.max_script_run_time
http://kb.mozillazine.org/Dom.max_script_run_time
and default is set to 10 seconds.
My ajax timeout is also set to 10 seconds.
I understand ajax timeout count starts from sending xmlhttp request and until the response comes back.
But I'm not sure if Firefox Dom.max_script_run_time includes the time for ajax to wait for response.
For instance:
1. user click on the button on the web page.
2. onclick event is triggered (Dom.max_script_run_time start?)
3. js grag input form data and construct JSON.
4. Using the JSON string, send ajax request.
5. main js thread ends. (Dom.max_script_run_time end here???)
6. xmlHttpRequest object still waiting for the ajax response back from the server.
7. xmlHttpRequest object receives response from the server.
8. Display response text on the web page (part of ajax callback) (Dom.max_script_run_time end here???)
Does the Dom.max_script_run_time stops at main js thread end because ajax is another thread? (i.e. script execution is timed per threads?)
Upvotes: 0
Views: 1396
Reputation: 35074
The max script run time covers the time a script is away from the event loop. The idea is to let the user kill off "hung" scripts.
So if you do an asynchronous XHR, it shouldn't be a problem (because between your send()
and your callback firing the browser is free to process user events and whatnot, hence your script doesn't look "hung" from a user perspective).
Upvotes: 1