Sat, 03 Jan 2015 20:18:00 +0100
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 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef mozilla_dom_MessagePortList_h |
michael@0 | 8 | #define mozilla_dom_MessagePortList_h |
michael@0 | 9 | |
michael@0 | 10 | #include "mozilla/Attributes.h" |
michael@0 | 11 | #include "mozilla/ErrorResult.h" |
michael@0 | 12 | #include "nsCycleCollectionParticipant.h" |
michael@0 | 13 | #include "mozilla/dom/MessagePort.h" |
michael@0 | 14 | #include "nsWrapperCache.h" |
michael@0 | 15 | #include "nsAutoPtr.h" |
michael@0 | 16 | #include "nsTArray.h" |
michael@0 | 17 | |
michael@0 | 18 | namespace mozilla { |
michael@0 | 19 | namespace dom { |
michael@0 | 20 | |
michael@0 | 21 | class MessagePortList MOZ_FINAL : public nsISupports |
michael@0 | 22 | , public nsWrapperCache |
michael@0 | 23 | { |
michael@0 | 24 | public: |
michael@0 | 25 | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
michael@0 | 26 | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MessagePortList) |
michael@0 | 27 | |
michael@0 | 28 | public: |
michael@0 | 29 | MessagePortList(nsISupports* aOwner, nsTArray<nsRefPtr<MessagePortBase>>& aPorts) |
michael@0 | 30 | : mOwner(aOwner) |
michael@0 | 31 | , mPorts(aPorts) |
michael@0 | 32 | { |
michael@0 | 33 | SetIsDOMBinding(); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | nsISupports* |
michael@0 | 37 | GetParentObject() const |
michael@0 | 38 | { |
michael@0 | 39 | return mOwner; |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | virtual JSObject* |
michael@0 | 43 | WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
michael@0 | 44 | |
michael@0 | 45 | uint32_t |
michael@0 | 46 | Length() const |
michael@0 | 47 | { |
michael@0 | 48 | return mPorts.Length(); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | MessagePortBase* |
michael@0 | 52 | Item(uint32_t aIndex) |
michael@0 | 53 | { |
michael@0 | 54 | return mPorts.SafeElementAt(aIndex); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | MessagePortBase* |
michael@0 | 58 | IndexedGetter(uint32_t aIndex, bool &aFound) |
michael@0 | 59 | { |
michael@0 | 60 | aFound = aIndex < mPorts.Length(); |
michael@0 | 61 | if (!aFound) { |
michael@0 | 62 | return nullptr; |
michael@0 | 63 | } |
michael@0 | 64 | return mPorts[aIndex]; |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | public: |
michael@0 | 68 | nsCOMPtr<nsISupports> mOwner; |
michael@0 | 69 | nsTArray<nsRefPtr<MessagePortBase>> mPorts; |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | } // namespace dom |
michael@0 | 73 | } // namespace mozilla |
michael@0 | 74 | |
michael@0 | 75 | #endif // mozilla_dom_MessagePortList_h |
michael@0 | 76 |