简体   繁体   English

GeckoFX:脚本占用太长的对话框

[英]GeckoFX: Script Taking Too Long dialog

I have an application set up to perform some automation using GeckoFX web browser. 我有一个应用程序设置为使用GeckoFX Web浏览器执行一些自动化。 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). 我遇到的问题是,当Gecko将网页加载到自身时,它有时不会长时间触发DocumentComplete事件,而是提供一个错误对话框,脚本占用时间过长,有两个按钮继续或者停止脚本(虽然这很少发生,但确实发生了)。

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. 如果Web浏览器出现脚本错误,我希望它停止处理并触发DocumentComplete事件,我已经以处理部分加载的网页的方式编写了我的应用程序。 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? 有关如何在GeckoFX中抑制这样的脚本错误的任何建议? The IE Web Browser control had a property called SuppressErrors (or something). IE Web浏览器控件有一个名为SuppressErrors(或其他)的属性。

Thanks in advance! 提前致谢!

There exists an about:config setting dom.max_script_run_time which controls how long a script can run before this error appears. 存在about:config设置dom.max_script_run_time ,它控制脚本在出现此错误之前可以运行多长时间。 Setting this to 0 will disable the dialog entirely. 将此值设置为0将完全禁用对话框。

This can be done programatically in GeckoFX: 这可以在GeckoFX中以编程方式完成:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM