From b11c3672e8ad64475f74ca7adf1437792bd89cb5 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Thu, 18 Nov 2021 15:00:44 +0000 Subject: [PATCH] Bug 1738264 - don't show session restore infobar for private browsing windows, r=sfoster This is a test. Differential Revision: https://phabricator.services.mozilla.com/D129971 --- browser/components/BrowserGlue.jsm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm index c412765d3e24..44ae9c891aa1 100644 --- a/browser/components/BrowserGlue.jsm +++ b/browser/components/BrowserGlue.jsm @@ -4137,8 +4137,13 @@ BrowserGlue.prototype = { return; } - // We've restarted at least once; we will show the notification if possible: - if (!SessionStore.canRestoreLastSession) { + const win = BrowserWindowTracker.getTopWindow(); + // We've restarted at least once; we will show the notification if possible. + // We can't do that if there's no session to restore, or this is a private window. + if ( + !SessionStore.canRestoreLastSession || + PrivateBrowsingUtils.isWindowPrivate(win) + ) { return; } @@ -4147,7 +4152,6 @@ BrowserGlue.prototype = { ++count ); - const win = BrowserWindowTracker.getTopWindow(); const messageFragment = win.document.createDocumentFragment(); const message = win.document.createElement("span"); const icon = win.document.createElement("img");