2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2017-02-22 22:05:50 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Various functions useful for automated fuzzing that are enabled
|
|
|
|
* only in --enable-fuzzing builds, because they may be dangerous to
|
|
|
|
* enable on untrusted pages.
|
|
|
|
*/
|
|
|
|
|
2019-09-27 18:26:14 +03:00
|
|
|
[Pref="fuzzing.enabled",
|
|
|
|
Exposed=Window]
|
2017-02-22 22:05:50 +03:00
|
|
|
interface FuzzingFunctions {
|
|
|
|
/**
|
|
|
|
* Synchronously perform a garbage collection.
|
|
|
|
*/
|
2022-09-21 10:44:58 +03:00
|
|
|
static undefined garbageCollect();
|
2022-12-28 12:52:44 +03:00
|
|
|
|
2020-11-30 05:15:38 +03:00
|
|
|
/**
|
|
|
|
* Synchronously perform a compacting garbage collection.
|
|
|
|
*/
|
2022-09-21 10:44:58 +03:00
|
|
|
static undefined garbageCollectCompacting();
|
2017-02-22 22:05:50 +03:00
|
|
|
|
2021-09-15 21:24:04 +03:00
|
|
|
/**
|
|
|
|
* Trigger a forced crash.
|
|
|
|
*/
|
2022-09-21 10:44:58 +03:00
|
|
|
static undefined crash(optional DOMString reason = "");
|
2021-09-15 21:24:04 +03:00
|
|
|
|
2017-02-22 22:05:50 +03:00
|
|
|
/**
|
|
|
|
* Synchronously perform a cycle collection.
|
|
|
|
*/
|
2022-09-21 10:44:58 +03:00
|
|
|
static undefined cycleCollect();
|
2017-11-17 00:42:39 +03:00
|
|
|
|
2020-11-30 05:15:38 +03:00
|
|
|
/**
|
|
|
|
* Send a memory pressure event, causes shrinking GC, cycle collection and
|
|
|
|
* other actions.
|
|
|
|
*/
|
2022-09-21 10:44:58 +03:00
|
|
|
static undefined memoryPressure();
|
2020-11-30 05:15:38 +03:00
|
|
|
|
2017-11-17 00:42:39 +03:00
|
|
|
/**
|
|
|
|
* Enable accessibility.
|
|
|
|
*/
|
|
|
|
[Throws]
|
2022-09-21 10:44:58 +03:00
|
|
|
static undefined enableAccessibility();
|
2018-10-02 15:16:45 +03:00
|
|
|
|
2022-05-05 18:39:24 +03:00
|
|
|
/**
|
|
|
|
* Send IPC fuzzing ready event to parent.
|
|
|
|
*/
|
2022-09-21 10:44:58 +03:00
|
|
|
static undefined signalIPCReady();
|
2022-05-05 18:39:24 +03:00
|
|
|
|
2018-10-02 15:16:45 +03:00
|
|
|
/**
|
|
|
|
* synthesizeKeyboardEvents() synthesizes a set of "keydown",
|
2021-04-08 03:11:26 +03:00
|
|
|
* "keypress" (only when it's necessary) and "keyup" events in top DOM window
|
|
|
|
* in current process (and the synthesized events will be retargeted to
|
|
|
|
* focused window/document/element). I.e, this is currently not dispatched
|
|
|
|
* via the main process if you call this in a content process. Therefore, in
|
|
|
|
* the case, some default action handlers which are only in the main process
|
|
|
|
* will never run. Note that this does not allow to synthesize keyboard
|
|
|
|
* events if this is called from a keyboard event or composition event
|
|
|
|
* listener.
|
2018-10-02 15:16:45 +03:00
|
|
|
*
|
|
|
|
* @param aKeyValue If you want to synthesize non-printable key
|
|
|
|
* events, you need to set one of key values
|
|
|
|
* defined by "UI Events KeyboardEvent key Values".
|
|
|
|
* You can check our current support values in
|
|
|
|
* dom/events/KeyNameList.h
|
|
|
|
* If you want to synthesize printable key events,
|
|
|
|
* you can set any string value including empty
|
|
|
|
* string.
|
|
|
|
* Note that |key| value in aDictionary is always
|
|
|
|
* ignored.
|
|
|
|
* @param aDictionary If you want to synthesize simple key press
|
|
|
|
* without any modifiers, you can omit this.
|
|
|
|
* Otherwise, specify this with proper values.
|
|
|
|
* If |code| is omitted or empty string, this
|
|
|
|
* guesses proper code value in US-English
|
|
|
|
* keyboard. Otherwise, the value must be empty
|
|
|
|
* string or known code value defined by "UI Events
|
|
|
|
* KeyboardEvent code Values". You can check our
|
|
|
|
* current support values in
|
|
|
|
* dom/events/PhysicalKeyCodeNameList.h.
|
|
|
|
* If |keyCode| is omitted or 0, this guesses
|
|
|
|
* proper keyCode value in US-English keyboard.
|
|
|
|
* If |location| is omitted or 0, this assumes
|
|
|
|
* that left modifier key is pressed if aKeyValue
|
|
|
|
* is one of such modifier keys.
|
|
|
|
* |key|, |isComposing|, |charCode| and |which|
|
|
|
|
* are always ignored.
|
|
|
|
* Modifier states like |shiftKey|, |altKey|,
|
|
|
|
* |modifierAltGraph|, |modifierCapsLock| and
|
|
|
|
* |modifierNumLock| are not adjusted for
|
|
|
|
* aKeyValue. Please specify them manually if
|
|
|
|
* necessary.
|
|
|
|
* Note that this API does not allow to dispatch
|
|
|
|
* known key events with empty |code| value and
|
|
|
|
* 0 |keyCode| value since it's unsual situation
|
|
|
|
* especially 0 |keyCode| value with known key.
|
|
|
|
* Note that when you specify only one of |code|
|
|
|
|
* and |keyCode| value, the other will be guessed
|
|
|
|
* from US-English keyboard layout. So, if you
|
|
|
|
* want to emulate key press with another keyboard
|
|
|
|
* layout, you should specify both values.
|
|
|
|
*
|
2022-12-28 12:52:44 +03:00
|
|
|
* For example:
|
2018-10-02 15:16:45 +03:00
|
|
|
* // Synthesize "Tab" key events.
|
|
|
|
* synthesizeKeyboardEvents("Tab");
|
|
|
|
* // Synthesize Shift + Tab key events.
|
|
|
|
* synthesizeKeyboardEvents("Tab", { shiftKey: true });
|
|
|
|
* // Synthesize Control + A key events.
|
|
|
|
* synthesizeKeyboardEvents("a", { controlKey: true });
|
|
|
|
* // Synthesize Control + Shift + A key events.
|
|
|
|
* synthesizeKeyboardEvents("A", { controlKey: true,
|
|
|
|
* shitKey: true });
|
|
|
|
* // Synthesize "Enter" key on numpad.
|
|
|
|
* synthesizeKeyboardEvents("Enter", { code: "NumpadEnter" });
|
|
|
|
* // Synthesize right "Shift" key.
|
|
|
|
* synthesizeKeyboardEvents("Shift", { code: "ShiftRight" });
|
|
|
|
* // Synthesize "1" on numpad.
|
|
|
|
* synthesizeKeyboardEvents("1", { code: "Numpad1",
|
|
|
|
* modifierNumLock: true });
|
|
|
|
* // Synthesize "End" on numpad.
|
|
|
|
* synthesizeKeyboardEvents("End", { code: "Numpad1" });
|
|
|
|
* // Synthesize "%" key of US-English keyboard layout.
|
|
|
|
* synthesizeKeyboardEvents("%", { shiftKey: true });
|
|
|
|
* // Synthesize "*" key of Japanese keyboard layout.
|
|
|
|
* synthesizeKeyboardEvents("*", { code: "Quote",
|
|
|
|
* shiftKey: true,
|
|
|
|
* keyCode: KeyboardEvent.DOM_VK_COLON });
|
|
|
|
*/
|
|
|
|
[Throws]
|
2022-09-21 10:44:58 +03:00
|
|
|
static undefined synthesizeKeyboardEvents(DOMString aKeyValue,
|
|
|
|
optional KeyboardEventInit aDictionary = {});
|
2017-02-22 22:05:50 +03:00
|
|
|
};
|