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_KeyboardEvent_h_
7 #define mozilla_dom_KeyboardEvent_h_
9 #include "mozilla/dom/UIEvent.h"
10 #include "mozilla/dom/KeyboardEventBinding.h"
11 #include "mozilla/EventForwards.h"
12 #include "nsIDOMKeyEvent.h"
14 namespace mozilla {
15 namespace dom {
17 class KeyboardEvent : public UIEvent,
18 public nsIDOMKeyEvent
19 {
20 public:
21 KeyboardEvent(EventTarget* aOwner,
22 nsPresContext* aPresContext,
23 WidgetKeyboardEvent* aEvent);
25 NS_DECL_ISUPPORTS_INHERITED
27 // nsIDOMKeyEvent Interface
28 NS_DECL_NSIDOMKEYEVENT
30 // Forward to base class
31 NS_FORWARD_TO_UIEVENT
33 static already_AddRefed<KeyboardEvent> Constructor(
34 const GlobalObject& aGlobal,
35 const nsAString& aType,
36 const KeyboardEventInit& aParam,
37 ErrorResult& aRv);
39 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE
40 {
41 return KeyboardEventBinding::Wrap(aCx, this);
42 }
44 bool AltKey();
45 bool CtrlKey();
46 bool ShiftKey();
47 bool MetaKey();
49 bool GetModifierState(const nsAString& aKey)
50 {
51 return GetModifierStateInternal(aKey);
52 }
54 bool Repeat();
55 bool IsComposing();
56 uint32_t CharCode();
57 uint32_t KeyCode();
58 virtual uint32_t Which() MOZ_OVERRIDE;
59 uint32_t Location();
61 void InitKeyEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
62 nsIDOMWindow* aView, bool aCtrlKey, bool aAltKey,
63 bool aShiftKey, bool aMetaKey,
64 uint32_t aKeyCode, uint32_t aCharCode,
65 ErrorResult& aRv)
66 {
67 aRv = InitKeyEvent(aType, aCanBubble, aCancelable, aView,
68 aCtrlKey, aAltKey, aShiftKey,aMetaKey,
69 aKeyCode, aCharCode);
70 }
72 private:
73 // True, if the instance is created with Constructor().
74 bool mInitializedByCtor;
75 // If the instance is created with Constructor(), which may have independent
76 // value. mInitializedWhichValue stores it. I.e., this is invalid when
77 // mInitializedByCtor is false.
78 uint32_t mInitialzedWhichValue;
79 };
81 } // namespace dom
82 } // namespace mozilla
84 #endif // mozilla_dom_KeyboardEvent_h_