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: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "CallEvent.h"
8 #include "mozilla/dom/CallEventBinding.h"
10 #include "TelephonyCall.h"
12 using namespace mozilla::dom;
13 using mozilla::ErrorResult;
15 /* static */
16 already_AddRefed<CallEvent>
17 CallEvent::Create(EventTarget* aOwner, const nsAString& aType,
18 TelephonyCall* aCall, bool aCanBubble,
19 bool aCancelable)
20 {
21 nsRefPtr<CallEvent> event = new CallEvent(aOwner, nullptr, nullptr);
22 event->mCall = aCall;
23 event->InitEvent(aType, aCanBubble, aCancelable);
24 return event.forget();
25 }
27 JSObject*
28 CallEvent::WrapObject(JSContext* aCx)
29 {
30 return CallEventBinding::Wrap(aCx, this);
31 }
33 NS_IMPL_CYCLE_COLLECTION_CLASS(CallEvent)
35 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(CallEvent, Event)
36 NS_IMPL_CYCLE_COLLECTION_UNLINK(mCall)
37 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
39 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(CallEvent, Event)
40 NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCall)
41 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
43 NS_IMPL_ADDREF_INHERITED(CallEvent, Event)
44 NS_IMPL_RELEASE_INHERITED(CallEvent, Event)
46 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(CallEvent)
47 NS_INTERFACE_MAP_END_INHERITING(Event)
49 // WebIDL
51 /* static */
52 already_AddRefed<CallEvent>
53 CallEvent::Constructor(const GlobalObject& aGlobal, const nsAString& aType,
54 const CallEventInit& aOptions, ErrorResult& aRv)
55 {
56 nsCOMPtr<EventTarget> target = do_QueryInterface(aGlobal.GetAsSupports());
58 if (!target) {
59 aRv.Throw(NS_ERROR_UNEXPECTED);
60 return nullptr;
61 }
63 nsRefPtr<CallEvent> event = Create(target, aType, aOptions.mCall, false, false);
65 return event.forget();
66 }
68 already_AddRefed<TelephonyCall>
69 CallEvent::GetCall() const
70 {
71 nsRefPtr<TelephonyCall> call = mCall;
72 return call.forget();
73 }