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.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_EventListenerService_h_
7 #define mozilla_EventListenerService_h_
9 #include "jsapi.h"
10 #include "mozilla/Attributes.h"
11 #include "nsAutoPtr.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "nsIDOMEventListener.h"
14 #include "nsIEventListenerService.h"
15 #include "nsString.h"
17 namespace mozilla {
19 template<typename T>
20 class Maybe;
22 class EventListenerInfo MOZ_FINAL : public nsIEventListenerInfo
23 {
24 public:
25 EventListenerInfo(const nsAString& aType,
26 already_AddRefed<nsIDOMEventListener> aListener,
27 bool aCapturing,
28 bool aAllowsUntrusted,
29 bool aInSystemEventGroup)
30 : mType(aType)
31 , mListener(aListener)
32 , mCapturing(aCapturing)
33 , mAllowsUntrusted(aAllowsUntrusted)
34 , mInSystemEventGroup(aInSystemEventGroup)
35 {
36 }
38 virtual ~EventListenerInfo() {}
40 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
41 NS_DECL_CYCLE_COLLECTION_CLASS(EventListenerInfo)
42 NS_DECL_NSIEVENTLISTENERINFO
44 protected:
45 bool GetJSVal(JSContext* aCx,
46 Maybe<JSAutoCompartment>& aAc,
47 JS::MutableHandle<JS::Value> aJSVal);
49 nsString mType;
50 // nsReftPtr because that is what nsListenerStruct uses too.
51 nsRefPtr<nsIDOMEventListener> mListener;
52 bool mCapturing;
53 bool mAllowsUntrusted;
54 bool mInSystemEventGroup;
55 };
57 class EventListenerService MOZ_FINAL : public nsIEventListenerService
58 {
59 public:
60 NS_DECL_ISUPPORTS
61 NS_DECL_NSIEVENTLISTENERSERVICE
62 };
64 } // namespace mozilla
66 #endif // mozilla_EventListenerService_h_