Faraz Azhar
Faraz Azhar

Reputation: 569

GeckoFX: Script Taking Too Long dialog

I have an application set up to perform some automation using GeckoFX web browser. My application is nicely setup, everything is working fine.

The problem that I'm running into is that when Gecko loads a webpage into itself, it sometimes doesn't fire the DocumentComplete event for a long time, instead gives an error dialog box that The script is taking too long, with two buttons Continue or Stop the script (although this happens rarely, but does happen).

I can't figure out how to suppress this error/warning dialog. In case the web browser is having a script error, I want it to stop processing and fire the DocumentComplete event anyway, I have coded my application in a manner to handle partially loaded webpages. But I can't reach to this point since the application gets stuck up at the error dialog.

Any suggestions on how to suppress scripting errors like this in GeckoFX? The IE Web Browser control had a property called SuppressErrors (or something).

Thanks in advance!

Upvotes: 1

Views: 848

Answers (1)

TehCorwiz
TehCorwiz

Reputation: 365

There exists an about:config setting dom.max_script_run_time which controls how long a script can run before this error appears. Setting this to 0 will disable the dialog entirely.

This can be done programatically in GeckoFX:

Gecko.GeckoPreferences.User("dom.max_script_run_time") = 0;

Via: https://support.mozilla.org/en-US/kb/warning-unresponsive-script

Upvotes: 3

Related Questions