Name Description Size
BeforeStopRequestListener.sys.mjs The BeforeStopRequestListener can be used to listen for http-on-before-stop-request notifications emitted right before a network channel is stopped. At this point the response should be completely decoded and the channel decodedBodySize property should have the expected value. This notification needs to be monitored in content processes, because decodedBodySize is always set to 0 in the parent process. Example: ``` const listener = new BeforeStopRequestListener(); listener.on("beforeStopRequest", onBeforeStopRequest); listener.startListening(); const onBeforeStopRequest = (eventName, data = {}) => { const { channel, decodedBodySize } = data; ... }; ``` @fires message The BeforeStopRequestListener emits "beforeStopRequest" events with the following object as payload: - {nsIHttpChannel} channel The channel for which the observer notification was emitted. - {number} decodedBodySize The decoded body size for the channel. 2404
BrowsingContextListener.sys.mjs The BrowsingContextListener can be used to listen for notifications coming from browsing contexts that get attached or discarded. Example: ``` const listener = new BrowsingContextListener(); listener.on("attached", onAttached); listener.startListening(); const onAttached = (eventName, data = {}) => { const { browsingContext, why } = data; ... }; ``` @fires message The BrowsingContextListener emits "attached" and "discarded" events, with the following object as payload: - {BrowsingContext} browsingContext Browsing context the notification relates to. - {string} why Usually "attach" or "discard", but will contain "replace" if the browsing context gets replaced by a cross-group navigation. 3630
CachedResourceListener.sys.mjs The CachedResourceListener can be used to listen for http-on-resource-cache-response notifications emitted for resources which are served by the image/CSS/JS cache. This notification needs to be monitored in content processes. Example: ``` const listener = new CachedResourceListener(); listener.on("cached-resource-sent", CachedResourceListener); listener.startListening(); const onCachedResourceSent = (eventName, data = {}) => { const { channel } = data; ... }; ``` @fires cached-resource-sent The CachedResourceListener emits "cached-resource-sent" event with the following object as payload: - {nsIHttpChannel} channel The channel for which the observer notification was emitted. 2803
ConsoleAPIListener.sys.mjs The ConsoleAPIListener can be used to listen for messages coming from console API usage in a given windowGlobal, eg. console.log, console.error, ... Example: ``` const listener = new ConsoleAPIListener(innerWindowId); listener.on("message", onConsoleAPIMessage); listener.startListening(); const onConsoleAPIMessage = (eventName, data = {}) => { const { arguments: msgArguments, level, stacktrace, timeStamp } = data; ... }; ``` @fires message The ConsoleAPIListener emits "message" events, with the following object as payload: - {Array<Object>} arguments - Arguments as passed-in when the method was called. - {String} level - Importance, one of `info`, `warn`, `error`, `debug`, `trace`. - {Array<Object>} stacktrace - List of stack frames, starting from most recent. - {Number} timeStamp - Timestamp when the method was called. 3461
ConsoleListener.sys.mjs The ConsoleListener can be used to listen for console messages related to Javascript errors, certain warnings which all happen within a specific windowGlobal. Consumers can listen for the message types "error", "warn" and "info". Example: ``` const onJavascriptError = (eventName, data = {}) => { const { level, message, stacktrace, timestamp } = data; ... }; const listener = new ConsoleListener(innerWindowId); listener.on("error", onJavascriptError); listener.startListening(); ... listener.stopListening(); ``` @fires message The ConsoleListener emits "error", "warn" and "info" events, with the following object as payload: - {String} level - Importance, one of `info`, `warn`, `error`, `debug`, `trace`. - {String} message - Actual message from the console entry. - {Array<StackFrame>} stacktrace - List of stack frames, starting from most recent. - {Number} timeStamp - Timestamp when the method was called. 4249
ContextualIdentityListener.sys.mjs The ContextualIdentityListener can be used to listen for notifications about contextual identities (containers) being created or deleted. Example: ``` const listener = new ContextualIdentityListener(); listener.on("created", onCreated); listener.startListening(); const onCreated = (eventName, data = {}) => { const { identity } = data; ... }; ``` @fires message The ContextualIdentityListener emits "created" and "deleted" events, with the following object as payload: - {object} identity The contextual identity which was created or deleted. 2107
LoadListener.sys.mjs The LoadListener can be used to listen for load events. Example: ``` const listener = new LoadListener(); listener.on("DOMContentLoaded", onDOMContentLoaded); listener.startListening(); const onDOMContentLoaded = (eventName, data = {}) => { const { target } = data; ... }; ``` @fires message The LoadListener emits "DOMContentLoaded" and "load" events, with the following object as payload: - {Document} target The target document. 2665
NavigationListener.sys.mjs The NavigationListener simply wraps a NavigationManager instance and exposes it with a convenient listener API, more consistent with the rest of the remote codebase. NavigationManager is a singleton per session so it can't be instanciated for each and every consumer. Example: ``` const onNavigationStarted = (eventName, data = {}) => { const { level, message, stacktrace, timestamp } = data; ... }; const listener = new NavigationListener(this.messageHandler.navigationManager); listener.on("navigation-started", onNavigationStarted); listener.startListening(); ... listener.stopListening(); ``` @fires message The NavigationListener emits "fragment-navigated", "navigation-started", "navigation-stopped", and "same-document-changed" events, with the following object as payload: - {string} navigationId - The UUID for the navigation. - {string} navigableId - The UUID for the navigable. - {string} url - The target url for the navigation. 2922
NetworkEventRecord.sys.mjs The NetworkEventRecord implements the interface expected from network event owners for consumers of the DevTools NetworkObserver. The NetworkEventRecord emits the before-request-sent event on behalf of the NetworkListener instance which created it. 11388
NetworkListener.sys.mjs The NetworkListener listens to all network activity from the parent process. Example: ``` const listener = new NetworkListener(); listener.on("before-request-sent", onBeforeRequestSent); listener.startListening(); const onBeforeRequestSent = (eventName, data = {}) => { const { cntextId, redirectCount, requestData, requestId, timestamp } = data; ... }; ``` @fires before-request-sent The NetworkListener emits "before-request-sent" events, with the following object as payload: - {number} browsingContextId - The browsing context id of the browsing context where this request was performed. - {number} redirectCount - The request's redirect count. - {RequestData} requestData - The request's data as expected by WebDriver BiDi. - {string} requestId - The id of the request, consistent across redirects. - {number} timestamp - Timestamp when the event was generated. 3648
PromptListener.sys.mjs The PromptListener listens to the DialogObserver events. Example: ``` const listener = new PromptListener(); listener.on("opened", onPromptOpened); listener.startListening(); const onPromptOpened = (eventName, data = {}) => { const { contentBrowser, prompt } = data; ... }; ``` @fires message The PromptListener emits "opened" events, with the following object as payload: - {XULBrowser} contentBrowser The <xul:browser> which hold the <var>prompt</var>. - {modal.Dialog} prompt Returns instance of the Dialog class. The PromptListener emits "closed" events, with the following object as payload: - {XULBrowser} contentBrowser The <xul:browser> which is the target of the event. - {object} detail {boolean=} detail.accepted Returns true if a user prompt was accepted and false if it was dismissed. {string=} detail.userText The user text specified in a prompt. 8440
test