From 4d0d5937ecfc0288cb6c87102b75a137f4411ffa Mon Sep 17 00:00:00 2001 From: Kevin Jones Date: Thu, 11 May 2017 22:31:15 +0200 Subject: [PATCH] Bug 1363078 - Refuse to insert lazy browsers in closed windows. r=dao MozReview-Commit-ID: Gc783ESwXjv --- browser/base/content/tabbrowser.xml | 4 +- .../components/sessionstore/test/browser.ini | 1 + .../test/browser_906076_lazy_tabs.js | 88 +++++++++++++++++++ 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 browser/components/sessionstore/test/browser_906076_lazy_tabs.js diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 61395a893855..d7c3bb622ef3 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -2149,8 +2149,8 @@ { + newWindow.addEventListener("unload", () => { + info("Check that no lazy browsers get inserted when window closes"); + is(countNonLazyTabs(newWindow), 1, "Window has only 1 non-lazy tab"); + + info("Check that it is not possible to insert a lazy browser after the window closed"); + ok(!newWindow.gBrowser.browsers[1].isConnected, "The browser that we're attempting to insert is indeed lazy"); + newWindow.gBrowser._insertBrowser(newWindow.gBrowser.tabs[1]); + is(countNonLazyTabs(newWindow), 1, "Window still has only 1 non-lazy tab"); + + resolve(); + }, { once: true }); + + newWindow.close(); + }); + + // Cleanup. + yield promiseBrowserState(backupState); +}); +