summaryrefslogtreecommitdiff
path: root/ext/js/comm/frame-offset-forwarder.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/comm/frame-offset-forwarder.js')
-rw-r--r--ext/js/comm/frame-offset-forwarder.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/js/comm/frame-offset-forwarder.js b/ext/js/comm/frame-offset-forwarder.js
index fe1ff98a..59659606 100644
--- a/ext/js/comm/frame-offset-forwarder.js
+++ b/ext/js/comm/frame-offset-forwarder.js
@@ -21,15 +21,12 @@ import {FrameAncestryHandler} from './frame-ancestry-handler.js';
export class FrameOffsetForwarder {
/**
* @param {import('../comm/cross-frame-api.js').CrossFrameAPI} crossFrameApi
- * @param {number} frameId
*/
- constructor(crossFrameApi, frameId) {
+ constructor(crossFrameApi) {
/** @type {import('../comm/cross-frame-api.js').CrossFrameAPI} */
this._crossFrameApi = crossFrameApi;
- /** @type {number} */
- this._frameId = frameId;
/** @type {FrameAncestryHandler} */
- this._frameAncestryHandler = new FrameAncestryHandler(crossFrameApi, frameId);
+ this._frameAncestryHandler = new FrameAncestryHandler(crossFrameApi);
}
/**
@@ -50,15 +47,18 @@ export class FrameOffsetForwarder {
return [0, 0];
}
+ const {frameId} = this._crossFrameApi;
+ if (frameId === null) { return null; }
+
try {
const ancestorFrameIds = await this._frameAncestryHandler.getFrameAncestryInfo();
- let childFrameId = this._frameId;
+ let childFrameId = frameId;
/** @type {Promise<?import('frame-offset-forwarder').ChildFrameRect>[]} */
const promises = [];
- for (const frameId of ancestorFrameIds) {
- promises.push(this._crossFrameApi.invoke(frameId, 'frameOffsetForwarderGetChildFrameRect', {frameId: childFrameId}));
- childFrameId = frameId;
+ for (const ancestorFrameId of ancestorFrameIds) {
+ promises.push(this._crossFrameApi.invoke(ancestorFrameId, 'frameOffsetForwarderGetChildFrameRect', {frameId: childFrameId}));
+ childFrameId = ancestorFrameId;
}
const results = await Promise.all(promises);