javascript - 如何在 firefox 关闭时关闭线程

标签 javascript firefox-addon xpcom

我有一个使用工作线程的多线程扩展,如图所示 here . 每当工作线程向主线程返回值时,我都会更新 UI 并再次启动该线程,因为我想连续执行该操作。我不能使用 setInterval,因为内部线程是对 C++ XPCOM 组件函数的调用,该函数执行套接字接收阻塞调用,并且接收可能不是周期性的。

现在当我关闭 firefox 时,firefox 窗口关闭但 firefox 进程继续运行并消耗 99% 的 CPU。所以我总是需要强行关闭该进程。

如何完全关闭该进程。 扩展是这样覆盖的

<overlay id="helloworldOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<statusbar id="status-bar">
.
.
.
</statusbar>
</overlay>

最佳答案

关于javascript - 如何在 firefox 关闭时关闭线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1525993/

相关文章:

javascript - 删除图像时 p 取 100% 宽度

javascript - Gulp Concat 文件顺序然后任何其他 js 文件

javascript - 在没有 .idl 的 Javascript 中使用 C++ 类

javascript - Firefox 插件 : Have content script retrieve data stored by addon script (using a context menu if possible)

firefox - YQL 可以在 Firefox Add-on Builder 中使用吗?

javascript - 在不使用鼠标事件的情况下获取当前鼠标下的元素

javascript - firefox 在 "sdk/system/events"api 中检测标签 ID

javascript - 错误 : undefined is not an object (evaluating '$cordovaBarcodeScanner.scan' )

javascript - Sprite 图像的宽度调整为 Ajax 生成的内容

jquery - 如何在 Firefox 插件中的脚本之间移动 jQuery 对象?