зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1176281 - Part 4: Simplify newWindowOpened using TestUtils.topicObserved. r=Gijs
This commit is contained in:
Родитель
279179c798
Коммит
d5fbb010dc
|
@ -152,20 +152,8 @@ function someTabLoaded(aWindow) {
|
||||||
* @resolves With the new window once it's open and loaded.
|
* @resolves With the new window once it's open and loaded.
|
||||||
*/
|
*/
|
||||||
function newWindowOpened() {
|
function newWindowOpened() {
|
||||||
return new Promise(function(resolve) {
|
return TestUtils.topicObserved("browser-delayed-startup-finished")
|
||||||
Services.wm.addListener({
|
.then(([win]) => win);
|
||||||
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) { }
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче