Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef mozilla_EventListenerService_h_ |
michael@0 | 7 | #define mozilla_EventListenerService_h_ |
michael@0 | 8 | |
michael@0 | 9 | #include "jsapi.h" |
michael@0 | 10 | #include "mozilla/Attributes.h" |
michael@0 | 11 | #include "nsAutoPtr.h" |
michael@0 | 12 | #include "nsCycleCollectionParticipant.h" |
michael@0 | 13 | #include "nsIDOMEventListener.h" |
michael@0 | 14 | #include "nsIEventListenerService.h" |
michael@0 | 15 | #include "nsString.h" |
michael@0 | 16 | |
michael@0 | 17 | namespace mozilla { |
michael@0 | 18 | |
michael@0 | 19 | template<typename T> |
michael@0 | 20 | class Maybe; |
michael@0 | 21 | |
michael@0 | 22 | class EventListenerInfo MOZ_FINAL : public nsIEventListenerInfo |
michael@0 | 23 | { |
michael@0 | 24 | public: |
michael@0 | 25 | EventListenerInfo(const nsAString& aType, |
michael@0 | 26 | already_AddRefed<nsIDOMEventListener> aListener, |
michael@0 | 27 | bool aCapturing, |
michael@0 | 28 | bool aAllowsUntrusted, |
michael@0 | 29 | bool aInSystemEventGroup) |
michael@0 | 30 | : mType(aType) |
michael@0 | 31 | , mListener(aListener) |
michael@0 | 32 | , mCapturing(aCapturing) |
michael@0 | 33 | , mAllowsUntrusted(aAllowsUntrusted) |
michael@0 | 34 | , mInSystemEventGroup(aInSystemEventGroup) |
michael@0 | 35 | { |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | virtual ~EventListenerInfo() {} |
michael@0 | 39 | |
michael@0 | 40 | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
michael@0 | 41 | NS_DECL_CYCLE_COLLECTION_CLASS(EventListenerInfo) |
michael@0 | 42 | NS_DECL_NSIEVENTLISTENERINFO |
michael@0 | 43 | |
michael@0 | 44 | protected: |
michael@0 | 45 | bool GetJSVal(JSContext* aCx, |
michael@0 | 46 | Maybe<JSAutoCompartment>& aAc, |
michael@0 | 47 | JS::MutableHandle<JS::Value> aJSVal); |
michael@0 | 48 | |
michael@0 | 49 | nsString mType; |
michael@0 | 50 | // nsReftPtr because that is what nsListenerStruct uses too. |
michael@0 | 51 | nsRefPtr<nsIDOMEventListener> mListener; |
michael@0 | 52 | bool mCapturing; |
michael@0 | 53 | bool mAllowsUntrusted; |
michael@0 | 54 | bool mInSystemEventGroup; |
michael@0 | 55 | }; |
michael@0 | 56 | |
michael@0 | 57 | class EventListenerService MOZ_FINAL : public nsIEventListenerService |
michael@0 | 58 | { |
michael@0 | 59 | public: |
michael@0 | 60 | NS_DECL_ISUPPORTS |
michael@0 | 61 | NS_DECL_NSIEVENTLISTENERSERVICE |
michael@0 | 62 | }; |
michael@0 | 63 | |
michael@0 | 64 | } // namespace mozilla |
michael@0 | 65 | |
michael@0 | 66 | #endif // mozilla_EventListenerService_h_ |