dom/indexedDB/CheckPermissionsHelper.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim: set ts=2 et sw=2 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_dom_indexeddb_checkpermissionshelper_h__
     8 #define mozilla_dom_indexeddb_checkpermissionshelper_h__
    10 // Only meant to be included in IndexedDB source files, not exported.
    11 #include "OpenDatabaseHelper.h"
    13 #include "nsIInterfaceRequestor.h"
    14 #include "nsIObserver.h"
    15 #include "nsIRunnable.h"
    17 class nsIDOMWindow;
    18 class nsIThread;
    20 BEGIN_INDEXEDDB_NAMESPACE
    22 class CheckPermissionsHelper MOZ_FINAL : public nsIRunnable,
    23                                          public nsIInterfaceRequestor,
    24                                          public nsIObserver
    25 {
    26 public:
    27   NS_DECL_THREADSAFE_ISUPPORTS
    28   NS_DECL_NSIRUNNABLE
    29   NS_DECL_NSIINTERFACEREQUESTOR
    30   NS_DECL_NSIOBSERVER
    32   CheckPermissionsHelper(OpenDatabaseHelper* aHelper,
    33                          nsIDOMWindow* aWindow)
    34   : mHelper(aHelper),
    35     mWindow(aWindow),
    36     // If we're trying to delete the database, we should never prompt the user.
    37     // Anything that would prompt is translated to denied.
    38     mPromptAllowed(!aHelper->mForDeletion),
    39     mHasPrompted(false),
    40     mPromptResult(0)
    41   {
    42     NS_ASSERTION(aHelper, "Null pointer!");
    43     NS_ASSERTION(aHelper->mPersistenceType == quota::PERSISTENCE_TYPE_PERSISTENT,
    44                  "Checking permission for non persistent databases?!");
    45   }
    47 private:
    48   nsRefPtr<OpenDatabaseHelper> mHelper;
    49   nsCOMPtr<nsIDOMWindow> mWindow;
    50   bool mPromptAllowed;
    51   bool mHasPrompted;
    52   uint32_t mPromptResult;
    53 };
    55 END_INDEXEDDB_NAMESPACE
    57 #endif // mozilla_dom_indexeddb_checkpermissionshelper_h__

mercurial