dom/events/XULCommandEvent.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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 /* vim:set ts=2 sw=2 sts=2 et cindent: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 // This class implements a XUL "command" event.  See nsIDOMXULCommandEvent.idl
     9 #ifndef mozilla_dom_XULCommandEvent_h_
    10 #define mozilla_dom_XULCommandEvent_h_
    12 #include "mozilla/dom/UIEvent.h"
    13 #include "mozilla/dom/XULCommandEventBinding.h"
    14 #include "nsIDOMXULCommandEvent.h"
    16 namespace mozilla {
    17 namespace dom {
    19 class XULCommandEvent : public UIEvent,
    20                         public nsIDOMXULCommandEvent
    21 {
    22 public:
    23   XULCommandEvent(EventTarget* aOwner,
    24                   nsPresContext* aPresContext,
    25                   WidgetInputEvent* aEvent);
    27   NS_DECL_ISUPPORTS_INHERITED
    28   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULCommandEvent, UIEvent)
    29   NS_DECL_NSIDOMXULCOMMANDEVENT
    31   // Forward our inherited virtual methods to the base class
    32   NS_FORWARD_TO_UIEVENT
    34   virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE
    35   {
    36     return XULCommandEventBinding::Wrap(aCx, this);
    37   }
    39   bool AltKey();
    40   bool CtrlKey();
    41   bool ShiftKey();
    42   bool MetaKey();
    44   already_AddRefed<Event> GetSourceEvent()
    45   {
    46     nsRefPtr<Event> e =
    47       mSourceEvent ? mSourceEvent->InternalDOMEvent() : nullptr;
    48     return e.forget();
    49   }
    51   void InitCommandEvent(const nsAString& aType,
    52                         bool aCanBubble, bool aCancelable,
    53                         nsIDOMWindow* aView,
    54                         int32_t aDetail,
    55                         bool aCtrlKey, bool aAltKey,
    56                         bool aShiftKey, bool aMetaKey,
    57                         Event* aSourceEvent,
    58                         ErrorResult& aRv)
    59   {
    60     aRv = InitCommandEvent(aType, aCanBubble, aCancelable, aView, aDetail,
    61                            aCtrlKey, aAltKey, aShiftKey, aMetaKey,
    62                            aSourceEvent);
    63   }
    65 protected:
    66   nsCOMPtr<nsIDOMEvent> mSourceEvent;
    67 };
    69 } // namespace dom
    70 } // namespace mozilla
    72 #endif // mozilla_dom_XULCommandEvent_h_

mercurial