dom/datastore/DataStoreCursor.cpp

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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #include "mozilla/dom/DataStore.h"
     6 #include "mozilla/dom/DataStoreCursor.h"
     7 #include "mozilla/dom/DataStoreBinding.h"
     8 #include "mozilla/dom/DataStoreImplBinding.h"
     9 #include "mozilla/dom/Promise.h"
    10 #include "mozilla/ErrorResult.h"
    11 #include "nsPIDOMWindow.h"
    13 namespace mozilla {
    14 namespace dom {
    16 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DataStoreCursor, AddRef)
    17 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DataStoreCursor, Release)
    19 NS_IMPL_CYCLE_COLLECTION(DataStoreCursor, mCursor)
    21 already_AddRefed<DataStoreCursor>
    22 DataStoreCursor::Constructor(GlobalObject& aGlobal, ErrorResult& aRv)
    23 {
    24   nsRefPtr<DataStoreCursor> cursor = new DataStoreCursor();
    25   return cursor.forget();
    26 }
    28 JSObject*
    29 DataStoreCursor::WrapObject(JSContext* aCx)
    30 {
    31   return DataStoreCursorBinding::Wrap(aCx, this);
    32 }
    34 already_AddRefed<DataStore>
    35 DataStoreCursor::GetStore(ErrorResult& aRv)
    36 {
    37   MOZ_ASSERT(NS_IsMainThread());
    38   MOZ_ASSERT(mCursor);
    40   return mCursor->GetStore(aRv);
    41 }
    43 already_AddRefed<Promise>
    44 DataStoreCursor::Next(ErrorResult& aRv)
    45 {
    46   MOZ_ASSERT(NS_IsMainThread());
    47   MOZ_ASSERT(mCursor);
    49   return mCursor->Next(aRv);
    50 }
    52 void
    53 DataStoreCursor::Close(ErrorResult& aRv)
    54 {
    55   MOZ_ASSERT(NS_IsMainThread());
    56   MOZ_ASSERT(mCursor);
    58   mCursor->Close(aRv);
    59 }
    61 void
    62 DataStoreCursor::SetDataStoreCursorImpl(DataStoreCursorImpl& aCursor)
    63 {
    64   MOZ_ASSERT(NS_IsMainThread());
    65   MOZ_ASSERT(!mCursor);
    67   mCursor = &aCursor;
    68 }
    70 } //namespace dom
    71 } //namespace mozilla

mercurial