tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

FuzzingFunctions.h (3011B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      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/. */
      6 
      7 #ifndef mozilla_dom_FuzzingFunctions
      8 #define mozilla_dom_FuzzingFunctions
      9 
     10 #include "mozilla/EventForwards.h"
     11 
     12 class nsIWidget;
     13 
     14 namespace mozilla {
     15 
     16 class ErrorResult;
     17 class TextInputProcessor;
     18 
     19 namespace dom {
     20 
     21 class GlobalObject;
     22 struct KeyboardEventInit;
     23 
     24 class FuzzingFunctions final {
     25 public:
     26  static void GarbageCollect(const GlobalObject&);
     27 
     28  static void GarbageCollectCompacting(const GlobalObject&);
     29 
     30  static void Crash(const GlobalObject& aGlobalObject,
     31                    const nsAString& aKeyValue);
     32 
     33  static void KillGPUProcess(const GlobalObject&);
     34 
     35  static void CycleCollect(const GlobalObject&);
     36 
     37  static void MemoryPressure(const GlobalObject&);
     38 
     39  static void SignalIPCReady(const GlobalObject&);
     40 
     41  static void EnableAccessibility(const GlobalObject&, ErrorResult& aRv);
     42 
     43  MOZ_CAN_RUN_SCRIPT_BOUNDARY static void SynthesizeKeyboardEvents(
     44      const GlobalObject& aGlobalObject, const nsAString& aKeyValue,
     45      const KeyboardEventInit& aKeyboardEvent, ErrorResult& aRv);
     46 
     47  static void SpinEventLoopFor(const GlobalObject&, uint32_t aMilliseconds);
     48 
     49 private:
     50  /**
     51   * ActivateModifiers() activates aModifiers in the TextInputProcessor.
     52   *
     53   * @param aTextInputProcessor The TIP whose modifier state you want to change.
     54   * @param aModifiers          Modifiers which you want to activate.
     55   * @param aWidget             The widget which should be set to
     56   *                            WidgetKeyboardEvent.
     57   * @param aRv                 Returns error if TextInputProcessor fails to
     58   *                            dispatch a modifier key event.
     59   * @return                    Modifiers which are activated by the call.
     60   */
     61  MOZ_CAN_RUN_SCRIPT static Modifiers ActivateModifiers(
     62      TextInputProcessor* aTextInputProcessor, Modifiers aModifiers,
     63      nsIWidget* aWidget, ErrorResult& aRv);
     64 
     65  /**
     66   * InactivateModifiers() inactivates aModifiers in the TextInputProcessor.
     67   *
     68   * @param aTextInputProcessor The TIP whose modifier state you want to change.
     69   * @param aModifiers          Modifiers which you want to inactivate.
     70   * @param aWidget             The widget which should be set to
     71   *                            WidgetKeyboardEvent.
     72   * @param aRv                 Returns error if TextInputProcessor fails to
     73   *                            dispatch a modifier key event.
     74   * @return                    Modifiers which are inactivated by the call.
     75   */
     76  MOZ_CAN_RUN_SCRIPT static Modifiers InactivateModifiers(
     77      TextInputProcessor* aTextInputProcessor, Modifiers aModifiers,
     78      nsIWidget* aWidget, ErrorResult& aRv);
     79 };
     80 
     81 }  // namespace dom
     82 }  // namespace mozilla
     83 
     84 #endif  // mozilla_dom_FuzzingFunctions