Bug 1286717 - Part 4: Resolve a promise for persist() in private browsing mode, r=janv
authorShawn Huang <shuang@mozilla.com>
Mon, 17 Apr 2017 15:07:02 +0800
changeset 353393 fe9127b627b80a73e076a0bd7c08677c1d233c0c
parent 353392 3845c01a7d8ce1f94eda757f71293444264d020a
child 353394 aa2f6f1f7bd62a9286f9b39d259a4ace994512e2
push id89247
push usershuang@mozilla.com
push dateMon, 17 Apr 2017 07:07:30 +0000
treeherdermozilla-inbound@aa2f6f1f7bd6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanv
bugs1286717
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1286717 - Part 4: Resolve a promise for persist() in private browsing mode, r=janv
dom/quota/StorageManager.cpp
--- a/dom/quota/StorageManager.cpp
+++ b/dom/quota/StorageManager.cpp
@@ -297,17 +297,22 @@ ExecuteOpOnMainOrWorkerThread(nsIGlobalO
 
         break;
       }
 
       case RequestResolver::Type::Persist: {
         RefPtr<PersistentStoragePermissionRequest> request =
           new PersistentStoragePermissionRequest(principal, window, promise);
 
-        aRv = request->Start();
+        // In private browsing mode, no permission prompt.
+        if (nsContentUtils::IsInPrivateBrowsing(doc)) {
+          aRv = request->Cancel();
+        } else {
+          aRv = request->Start();
+        }
 
         break;
       }
 
       case RequestResolver::Type::Estimate: {
         RefPtr<RequestResolver> resolver =
           new RequestResolver(RequestResolver::Type::Estimate, promise);