зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1711096 - [devtools] Add support for multiple target types to getAllFronts r=nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D115071
This commit is contained in:
Родитель
869464f64f
Коммит
50a85d3429
|
@ -196,7 +196,7 @@ class AccessibilityProxy {
|
|||
*/
|
||||
async withAllAccessibilityFronts(taskFn) {
|
||||
const accessibilityFronts = await this.commands.targetCommand.getAllFronts(
|
||||
this.commands.targetCommand.TYPES.FRAME,
|
||||
[this.commands.targetCommand.TYPES.FRAME],
|
||||
"accessibility"
|
||||
);
|
||||
const tasks = [];
|
||||
|
|
|
@ -273,7 +273,7 @@ Inspector.prototype = {
|
|||
*/
|
||||
async getAllInspectorFronts() {
|
||||
return this.commands.targetCommand.getAllFronts(
|
||||
this.commands.targetCommand.TYPES.FRAME,
|
||||
[this.commands.targetCommand.TYPES.FRAME],
|
||||
"inspector"
|
||||
);
|
||||
},
|
||||
|
|
|
@ -16,7 +16,7 @@ class InspectorCommand {
|
|||
*/
|
||||
async getAllInspectorFronts() {
|
||||
return this.commands.targetCommand.getAllFronts(
|
||||
this.commands.targetCommand.TYPES.FRAME,
|
||||
[this.commands.targetCommand.TYPES.FRAME],
|
||||
"inspector"
|
||||
);
|
||||
}
|
||||
|
|
|
@ -635,16 +635,19 @@ class TargetCommand extends EventEmitter {
|
|||
}
|
||||
|
||||
/**
|
||||
* For all the target fronts of a given type, retrieve all the target-scoped fronts of a given type.
|
||||
* For all the target fronts of given types, retrieve all the target-scoped fronts of the given types.
|
||||
*
|
||||
* @param {String} targetType
|
||||
* The type of target to iterate over. Constant of TargetCommand.TYPES.
|
||||
* @param {Array<String>} targetTypes
|
||||
* The types of target to iterate over. Constant of TargetCommand.TYPES.
|
||||
* @param {String} frontType
|
||||
* The type of target-scoped front to retrieve. It can be "inspector", "console", "thread",...
|
||||
*/
|
||||
async getAllFronts(targetType, frontType) {
|
||||
async getAllFronts(targetTypes, frontType) {
|
||||
if (!Array.isArray(targetTypes) || !targetTypes?.length) {
|
||||
throw new Error("getAllFronts expects a non-empty array of target types");
|
||||
}
|
||||
const fronts = [];
|
||||
const targets = this.getAllTargets([targetType]);
|
||||
const targets = this.getAllTargets(targetTypes);
|
||||
for (const target of targets) {
|
||||
const front = await target.getFront(frontType);
|
||||
fronts.push(front);
|
||||
|
|
Загрузка…
Ссылка в новой задаче