et.listRemoteFrames();

    const promises = frames
      .filter(
        // As we listen for frameDescriptor's on the RootFront, we get
        // all the frames and not only the one related to the given `target`.
        // TODO: support deeply nested frames
        descriptor =>
          descriptor.parentID == this.target.browsingContextID ||
          descriptor.id == this.target.browsingContextID
      )
      .map(async descriptor => {
        const target = await descriptor.getTarget();
        if (!target) {
          console.error(
            "Wasn't able to retrieve the target for",
            descriptor.actorID
          );
          return;
        }
        await this.onTargetAvailable(target);
      });

    await Promise.all(promises);
  }

  unlisten() {}
}

module.exports = { LegacyFramesWatcher };
PK