views:

48

answers:

2

I am making a firefox extension and I have a manual script entry box. I don't want the script to hang the browser when it is run. How can I make an unresponsive script error popup come up if the script runs for longer than a second.

A: 

The long running script prompt cannot be controlled in that way. Firefox automatically shows it after a certain number of JS operations have been done without returning control (it's something around 30 seconds on average).

sdwilsh
The prompt doesn't seem to come up in an extension
tmim
Er, right; I missed that this was an extension. The dialog is disabled for chrome (where extensions live). You should break up your task into smaller chunks, possibly using generators, so you can interrupt it yourself.
sdwilsh
+1  A: 

This is controlled by the user by entering about:config in Firefox, and changing the dom.max_script_run_time value.

Zachary
This setting doesn't seem to affect code running in an extension
tmim