зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1539213 - Emit `Target.targetCreated` for already-opened tabs. r=ato
When `Target.setDiscoverTargets` is called, one `Target.targetCreated` event should be sent per already opened tab. Differential Revision: https://phabricator.services.mozilla.com/D25558 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
360f8973bc
Коммит
0b2e8e6e9d
|
@ -32,6 +32,9 @@ class Target extends Domain {
|
|||
} else {
|
||||
targets.off("connect", this.onTargetCreated);
|
||||
}
|
||||
for (const target of targets) {
|
||||
this.onTargetCreated("connect", target);
|
||||
}
|
||||
}
|
||||
|
||||
onTargetCreated(eventName, target) {
|
||||
|
|
|
@ -42,9 +42,15 @@ async function testCDP() {
|
|||
const {Target} = client;
|
||||
ok("Target" in client, "Target domain is available");
|
||||
|
||||
const targetCreatedForAlreadyOpenedTab = Target.targetCreated();
|
||||
|
||||
// Instruct the server to fire Target.targetCreated events
|
||||
Target.setDiscoverTargets({ discover: true });
|
||||
|
||||
// Calling `setDiscoverTargets` will dispatch `targetCreated` event for all
|
||||
// already opened tabs
|
||||
await targetCreatedForAlreadyOpenedTab;
|
||||
|
||||
// Create a new target so that the test runs against a fresh new tab
|
||||
const targetCreated = Target.targetCreated();
|
||||
const {targetId} = await Target.createTarget();
|
||||
|
|
Загрузка…
Ссылка в новой задаче