From d5fbb010dc0b565e4dd643016ea1198a328b1f79 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Fri, 19 Jun 2015 09:15:26 -0700 Subject: [PATCH] Bug 1176281 - Part 4: Simplify newWindowOpened using TestUtils.topicObserved. r=Gijs --- browser/base/content/test/referrer/head.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/browser/base/content/test/referrer/head.js b/browser/base/content/test/referrer/head.js index 45a559deb934..e390bf944ce0 100644 --- a/browser/base/content/test/referrer/head.js +++ b/browser/base/content/test/referrer/head.js @@ -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); } /**