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_dom_DataContainerEvent_h_
7 #define mozilla_dom_DataContainerEvent_h_
9 #include "mozilla/dom/DataContainerEventBinding.h"
10 #include "mozilla/dom/Event.h"
11 #include "nsIDOMDataContainerEvent.h"
12 #include "nsInterfaceHashtable.h"
14 namespace mozilla {
15 namespace dom {
17 class DataContainerEvent : public Event,
18 public nsIDOMDataContainerEvent
19 {
20 public:
21 DataContainerEvent(EventTarget* aOwner,
22 nsPresContext* aPresContext,
23 WidgetEvent* aEvent);
25 NS_DECL_ISUPPORTS_INHERITED
27 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DataContainerEvent, Event)
29 NS_FORWARD_TO_EVENT
31 NS_DECL_NSIDOMDATACONTAINEREVENT
33 virtual JSObject*
34 WrapObject(JSContext* aCx) MOZ_OVERRIDE
35 {
36 return DataContainerEventBinding::Wrap(aCx, this);
37 }
39 already_AddRefed<nsIVariant> GetData(const nsAString& aKey)
40 {
41 nsCOMPtr<nsIVariant> val;
42 GetData(aKey, getter_AddRefs(val));
43 return val.forget();
44 }
46 void SetData(JSContext* aCx, const nsAString& aKey,
47 JS::Handle<JS::Value> aVal, ErrorResult& aRv);
49 private:
50 static PLDHashOperator
51 TraverseEntry(const nsAString& aKey, nsIVariant* aDataItem, void* aUserArg);
53 nsInterfaceHashtable<nsStringHashKey, nsIVariant> mData;
54 };
56 } // namespace dom
57 } // namespace mozilla
59 #endif // mozilla_dom_DataContainerEvent_h_