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.

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

mercurial