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 CycleCollect(const GlobalObject&); 31 32 static void MemoryPressure(const GlobalObject&); 33 34 static void EnableAccessibility(const GlobalObject&, ErrorResult& aRv); 35 36 MOZ_CAN_RUN_SCRIPT_BOUNDARY static void SynthesizeKeyboardEvents( 37 const GlobalObject& aGlobalObject, const nsAString& aKeyValue, 38 const KeyboardEventInit& aKeyboardEvent, ErrorResult& aRv); 39 40 private: 41 /** 42 * ActivateModifiers() activates aModifiers in the TextInputProcessor. 43 * 44 * @param aTextInputProcessor The TIP whose modifier state you want to change. 45 * @param aModifiers Modifiers which you want to activate. 46 * @param aWidget The widget which should be set to 47 * WidgetKeyboardEvent. 48 * @param aRv Returns error if TextInputProcessor fails to 49 * dispatch a modifier key event. 50 * @return Modifiers which are activated by the call. 51 */ 52 MOZ_CAN_RUN_SCRIPT static Modifiers ActivateModifiers( 53 TextInputProcessor* aTextInputProcessor, Modifiers aModifiers, 54 nsIWidget* aWidget, ErrorResult& aRv); 55 56 /** 57 * InactivateModifiers() inactivates aModifiers in the TextInputProcessor. 58 * 59 * @param aTextInputProcessor The TIP whose modifier state you want to change. 60 * @param aModifiers Modifiers which you want to inactivate. 61 * @param aWidget The widget which should be set to 62 * WidgetKeyboardEvent. 63 * @param aRv Returns error if TextInputProcessor fails to 64 * dispatch a modifier key event. 65 * @return Modifiers which are inactivated by the call. 66 */ 67 MOZ_CAN_RUN_SCRIPT static Modifiers InactivateModifiers( 68 TextInputProcessor* aTextInputProcessor, Modifiers aModifiers, 69 nsIWidget* aWidget, ErrorResult& aRv); 70 }; 71 72 } // namespace dom 73 } // namespace mozilla 74 75 #endif // mozilla_dom_FuzzingFunctions 76