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

mercurial