我使用Mozilla addons-sdk制作Firefox扩展程序。我在面板中显示特定的HTML页面。基于收到的某个事件,我想重新加载扩展(而不仅仅是页面)。重新加载=重新运行main.js,就像浏览器重启时一样。
重新加载HTML页面的问题在于,当重新加载发生时,页面工作者仍然是旧的,并且在重新加载期间收到的事件未得到正确处理。对应于这些事件,您会收到以下错误:
Timestamp: 4/11/13 12:34:20 PM
Error: ubp-install: An exception occurred.
Traceback (most recent call last):
File "resource://onebutton-at-user043-dot-com/addon-sdk/lib/sdk/panel.js", line 273, in _onHide
this._emit('hide');
File "resource://onebutton-at-user043-dot-com/addon-sdk/lib/sdk/deprecated/events.js", line 123, in _emit
return this._emitOnObject.apply(this, args);
File "resource://onebutton-at-user043-dot-com/addon-sdk/lib/sdk/deprecated/events.js", line 153, in _emitOnObject
listener.apply(targetObj, params);
File "resource://onebutton-at-user043-dot-com/ubp-install/lib/main.js", line 232, in
type: 'Application_reload'
File "resource://onebutton-at-user043-dot-com/addon-sdk/lib/sdk/content/worker.js", line 369, in
emit: function () self._emitEventToContent(Array.slice(arguments))
File "resource://onebutton-at-user043-dot-com/addon-sdk/lib/sdk/content/worker.js", line 404, in _emitEventToContent
throw new Error(ERR_FROZEN);
Error: The page is currently hidden and can no longer be used until it is visible again.
简而言之,我需要一种方法来重新加载firefox扩展。