mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1176281 - Part 4: Simplify newWindowOpened using TestUtils.topicObserved. r=Gijs
This commit is contained in:
parent
279179c798
commit
d5fbb010dc
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user