|
沙发
楼主 |
发表于 2016-5-7 16:57:11
|
只看该作者
本帖最后由 hechengjin 于 2016-5-7 17:02 编辑
outer-window-destroyed
chrome-document-global-created
- function close(window) {
- let deferred = defer();
- let toplevelWindow = getToplevelWindow(window);
- let outerId = getOuterId(toplevelWindow);
- events.on("outer-window-destroyed", function onclose({subject}) {
- let id = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
- if (id == outerId) {
- events.off("outer-window-destroyed", onclose);
- deferred.resolve();
- }
- }, true);
- window.close();
- return deferred.promise;
- }
复制代码
const events = require('../system/events');
comm-central/mozilla/addon-sdk/source/lib/sdk/system/events.js
\xulrunner\modules\commonjs\sdk\system\events.js
|
|