简体   繁体   English

Javascript-CallCom方法可阻止Firefox中的动画gif和计时器

[英]Javascript - callCom method blocks animated gif and timers in Firefox

I have a Firefox extension that pops up a log-in form (it's a c++ winform, not that it matters...). 我有一个Firefox扩展,它弹出一个登录表单(这是c ++ winform,并不重要...)。 It is done using callCom technique - meaning the c++ client is integrated, initializing Components.classes, then createInstance(), query interface etc. 这是使用callCom技术完成的-意味着集成了c ++客户端,初始化Components.classes,然后初始化createInstance(),查询接口等。

So, in Firefox, when I call my client's log-in screen the browser is waiting for it to close synchronously and so everything gets "stuck". 因此,在Firefox中,当我调用客户端的登录屏幕时,浏览器正在等待其同步关闭,因此所有内容都“卡住了”。 I mean, timers, animated gifs, etc. 我的意思是计时器,GIF动画等。

How can I solve this? 我该如何解决?

Without really knowing much about your extension - the XPCOM method you are calling needs to return immediately instead of waiting for something without processing any events. 在不十分了解您的扩展的情况下,您正在调用的XPCOM方法需要立即返回,而不是等待某些事件而不处理任何事件。 The general design principle is: blocking actions on the main thread are a bad idea. 一般的设计原则是:阻止主线程上的动作是一个坏主意。 Which probably means in your case: create a new thread, have this thread open the form and wait for it, allow the XPCOM method to return quickly without blocking the main thread. 在您的情况下,这可能意味着:创建一个新线程,让该线程打开表单并等待它,允许XPCOM方法快速返回而不会阻塞主线程。

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

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