Bug 1176281 - Part 4: Simplify newWindowOpened using TestUtils.topicObserved. r=Gijs

This commit is contained in:
Birunthan Mohanathas 2015-06-19 09:15:26 -07:00
Родитель 279179c798
Коммит d5fbb010dc
1 изменённых файлов: 2 добавлений и 14 удалений

Просмотреть файл

@ -152,20 +152,8 @@ function someTabLoaded(aWindow) {
* @resolves With the new window once it's open and loaded.
*/
function newWindowOpened() {
return new Promise(function(resolve) {
Services.wm.addListener({
onOpenWindow: function(aXULWindow) {
Services.wm.removeListener(this);
var newWindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
delayedStartupFinished(newWindow).then(function() {
resolve(newWindow);
});
},
onCloseWindow: function(aXULWindow) { },
onWindowTitleChange: function(aXULWindow, aNewTitle) { }
});
});
return TestUtils.topicObserved("browser-delayed-startup-finished")
.then(([win]) => win);
}
/**