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.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
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 #include "SpeechRecognitionResultList.h"
9 #include "mozilla/dom/SpeechRecognitionResultListBinding.h"
11 #include "SpeechRecognition.h"
13 namespace mozilla {
14 namespace dom {
16 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(SpeechRecognitionResultList, mParent, mItems)
17 NS_IMPL_CYCLE_COLLECTING_ADDREF(SpeechRecognitionResultList)
18 NS_IMPL_CYCLE_COLLECTING_RELEASE(SpeechRecognitionResultList)
19 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SpeechRecognitionResultList)
20 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
21 NS_INTERFACE_MAP_ENTRY(nsISupports)
22 NS_INTERFACE_MAP_END
24 SpeechRecognitionResultList::SpeechRecognitionResultList(SpeechRecognition* aParent)
25 : mParent(aParent)
26 {
27 SetIsDOMBinding();
28 }
30 SpeechRecognitionResultList::~SpeechRecognitionResultList()
31 {
32 }
34 nsISupports*
35 SpeechRecognitionResultList::GetParentObject() const
36 {
37 return static_cast<DOMEventTargetHelper*>(mParent.get());
38 }
40 JSObject*
41 SpeechRecognitionResultList::WrapObject(JSContext* aCx)
42 {
43 return SpeechRecognitionResultListBinding::Wrap(aCx, this);
44 }
46 already_AddRefed<SpeechRecognitionResult>
47 SpeechRecognitionResultList::IndexedGetter(uint32_t aIndex, bool& aPresent)
48 {
49 if (aIndex >= Length()) {
50 aPresent = false;
51 return nullptr;
52 }
54 aPresent = true;
55 return Item(aIndex);
56 }
58 uint32_t
59 SpeechRecognitionResultList::Length() const
60 {
61 return mItems.Length();
62 }
64 already_AddRefed<SpeechRecognitionResult>
65 SpeechRecognitionResultList::Item(uint32_t aIndex)
66 {
67 nsRefPtr<SpeechRecognitionResult> result = mItems.ElementAt(aIndex);
68 return result.forget();
69 }
70 } // namespace dom
71 } // namespace mozilla