default to [0, 0] when sourceFrame is not found
This commit is contained in:
parent
c171503d77
commit
559033f0a6
@ -80,7 +80,10 @@ class FrameOffsetForwarder {
|
|||||||
sourceFrame = frame;
|
sourceFrame = frame;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (sourceFrame === null) { return; }
|
if (sourceFrame === null) {
|
||||||
|
this._forwardFrameOffsetOrigin(null, uniqueId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const [forwardedX, forwardedY] = offset;
|
const [forwardedX, forwardedY] = offset;
|
||||||
const {x, y} = sourceFrame.getBoundingClientRect();
|
const {x, y} = sourceFrame.getBoundingClientRect();
|
||||||
|
@ -138,7 +138,8 @@ class PopupProxy {
|
|||||||
this._frameOffsetPromise = this._getFrameOffset();
|
this._frameOffsetPromise = this._getFrameOffset();
|
||||||
if (firstRun) {
|
if (firstRun) {
|
||||||
try {
|
try {
|
||||||
this._frameOffset = await this._frameOffsetPromise;
|
const offset = await this._frameOffsetPromise;
|
||||||
|
this._frameOffset = offset !== null ? offset : [0, 0];
|
||||||
this._frameOffsetUpdatedAt = Date.now();
|
this._frameOffsetUpdatedAt = Date.now();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
@ -146,7 +147,7 @@ class PopupProxy {
|
|||||||
this._frameOffsetPromise = null;
|
this._frameOffsetPromise = null;
|
||||||
} else {
|
} else {
|
||||||
this._frameOffsetPromise.then((offset) => {
|
this._frameOffsetPromise.then((offset) => {
|
||||||
this._frameOffset = offset;
|
this._frameOffset = offset !== null ? offset : [0, 0];
|
||||||
this._frameOffsetUpdatedAt = Date.now();
|
this._frameOffsetUpdatedAt = Date.now();
|
||||||
this._frameOffsetPromise = null;
|
this._frameOffsetPromise = null;
|
||||||
}, (e) => {
|
}, (e) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user