diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /devtools/server/actors/watcher/target-helpers/process-helper.js | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/server/actors/watcher/target-helpers/process-helper.js')
-rw-r--r-- | devtools/server/actors/watcher/target-helpers/process-helper.js | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/devtools/server/actors/watcher/target-helpers/process-helper.js b/devtools/server/actors/watcher/target-helpers/process-helper.js deleted file mode 100644 index e36f0a204c..0000000000 --- a/devtools/server/actors/watcher/target-helpers/process-helper.js +++ /dev/null @@ -1,115 +0,0 @@ -/* 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/. */ - -"use strict"; - -/** - * Return the list of all DOM Processes except the one for the parent process - * - * @return Array<nsIDOMProcessParent> - */ -function getAllContentProcesses() { - return ChromeUtils.getAllDOMProcesses().filter( - process => process.childID !== 0 - ); -} - -/** - * Instantiate all Content Process targets in all the DOM Processes. - * - * @param {WatcherActor} watcher - */ -async function createTargets(watcher) { - const promises = []; - for (const domProcess of getAllContentProcesses()) { - const processActor = domProcess.getActor("DevToolsProcess"); - promises.push( - processActor.instantiateTarget({ - watcherActorID: watcher.actorID, - connectionPrefix: watcher.conn.prefix, - sessionContext: watcher.sessionContext, - sessionData: watcher.sessionData, - }) - ); - } - await Promise.all(promises); -} - -/** - * @param {WatcherActor} watcher - * @param {object} options - * @param {boolean} options.isModeSwitching - * true when this is called as the result of a change to the devtools.browsertoolbox.scope pref - */ -function destroyTargets(watcher, options) { - for (const domProcess of getAllContentProcesses()) { - const processActor = domProcess.getActor("DevToolsProcess"); - processActor.destroyTarget({ - watcherActorID: watcher.actorID, - isModeSwitching: options.isModeSwitching, - }); - } -} - -/** - * Go over all existing content processes in order to communicate about new data entries - * - * @param {Object} options - * @param {WatcherActor} options.watcher - * The Watcher Actor providing new data entries - * @param {string} options.type - * The type of data to be added - * @param {Array<Object>} options.entries - * The values to be added to this type of data - * @param String updateType - * "add" will only add the new entries in the existing data set. - * "set" will update the data set with the new entries. - */ -async function addOrSetSessionDataEntry({ - watcher, - type, - entries, - updateType, -}) { - const promises = []; - for (const domProcess of getAllContentProcesses()) { - const processActor = domProcess.getActor("DevToolsProcess"); - promises.push( - processActor.addOrSetSessionDataEntry({ - watcherActorID: watcher.actorID, - type, - entries, - updateType, - }) - ); - } - await Promise.all(promises); -} - -/** - * Notify all existing content processes that some data entries have been removed - * - * See addOrSetSessionDataEntry for argument documentation. - */ -async function removeSessionDataEntry({ watcher, type, entries }) { - const promises = []; - for (const domProcess of getAllContentProcesses()) { - const processActor = domProcess.getActor("DevToolsProcess"); - promises.push( - processActor.removeSessionDataEntry({ - watcherActorID: watcher.actorID, - type, - entries, - }) - ); - } - await Promise.all(promises); -} - -module.exports = { - createTargets, - destroyTargets, - addOrSetSessionDataEntry, - removeSessionDataEntry, -}; |