From 1651f71fd2fc56b54cdb42735cf519bd3d841268 Mon Sep 17 00:00:00 2001 From: Saurabh Anand Date: Wed, 27 Jun 2012 15:14:45 +0530 Subject: [PATCH] Bug 722994 - globalOverlay.js uses global Private Browsing state to control display of a prompt; r=ehsan --- browser/components/nsBrowserGlue.js | 13 ++++++------- toolkit/content/globalOverlay.js | 15 ++------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index 5ebe789ff5c..6478cc38ed1 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -492,13 +492,6 @@ BrowserGlue.prototype = { if (!aQuitType) aQuitType = "quit"; - // Never show a prompt inside private browsing mode - var inPrivateBrowsing = Cc["@mozilla.org/privatebrowsing;1"]. - getService(Ci.nsIPrivateBrowsingService). - privateBrowsingEnabled; - if (inPrivateBrowsing) - return; - var showPrompt = false; var mostRecentBrowserWindow; @@ -530,6 +523,12 @@ BrowserGlue.prototype = { return; } + var inPrivateBrowsing = Cc["@mozilla.org/privatebrowsing;1"]. + getService(Ci.nsIPrivateBrowsingService). + privateBrowsingEnabled; + if (inPrivateBrowsing) + return; + if (!showPrompt) return; diff --git a/toolkit/content/globalOverlay.js b/toolkit/content/globalOverlay.js index f62d8dc5abd..ba894c4a073 100644 --- a/toolkit/content/globalOverlay.js +++ b/toolkit/content/globalOverlay.js @@ -16,22 +16,11 @@ function closeWindow(aClose, aPromptFunction) if (++windowCount == 2) break; } - - var inPrivateBrowsing = false; - try { - if (["@mozilla.org/privatebrowsing;1"] in Components.classes) { - var pbSvc = Components.classes["@mozilla.org/privatebrowsing;1"] - .getService(Components.interfaces.nsIPrivateBrowsingService); - inPrivateBrowsing = pbSvc.privateBrowsingEnabled; - } - } catch(e) { - // safe to ignore - } - + // If we're down to the last window and someone tries to shut down, check to make sure we can! if (windowCount == 1 && !canQuitApplication("lastwindow")) return false; - else if (windowCount != 1 || inPrivateBrowsing) + else if (windowCount != 1) #endif if (typeof(aPromptFunction) == "function" && !aPromptFunction()) return false;