Bug 1111555 - Don't accidentally cancel downloads if we think we're exiting private browsing. r=ehsan
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 11 Jun 2015 18:53:31 -0700
changeset 266645 3fdc89601dd5e3d8cf7b1adbabd267230bf5af70
parent 266644 298c695564e9821a31f8e9e2cafc366580863b90
child 266646 d947d66c49dc96c2d25ee7ece0429c85484bdd4f
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-esr52@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1111555
milestone41.0a1
Bug 1111555 - Don't accidentally cancel downloads if we think we're exiting private browsing. r=ehsan
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -4338,17 +4338,22 @@ bool
 ContentParent::RecvPrivateDocShellsExist(const bool& aExist)
 {
     if (!sPrivateContent)
         sPrivateContent = new nsTArray<ContentParent*>();
     if (aExist) {
         sPrivateContent->AppendElement(this);
     } else {
         sPrivateContent->RemoveElement(this);
-        if (!sPrivateContent->Length()) {
+
+        // Only fire the notification if we have private and non-private
+        // windows: if privatebrowsing.autostart is true, all windows are
+        // private.
+        if (!sPrivateContent->Length() &&
+            !Preferences::GetBool("browser.privatebrowsing.autostart")) {
             nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
             obs->NotifyObservers(nullptr, "last-pb-context-exited", nullptr);
             delete sPrivateContent;
             sPrivateContent = nullptr;
         }
     }
     return true;
 }