aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/popup-proxy.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-08-18 20:51:19 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-02 19:33:28 -0400
commit53aad0bef68bf6930b684fda4a25e1a045cd800e (patch)
tree4e91dd4f3e6bac8ceefd7ecb321d15c024459f3f /ext/fg/js/popup-proxy.js
parent42ec3e2a43dfd9ac0748ca7c364cef2b44f625a2 (diff)
Fix messaging issues when iframes are present in the document
Diffstat (limited to 'ext/fg/js/popup-proxy.js')
-rw-r--r--ext/fg/js/popup-proxy.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js
index 3a15be7d..bbf6a2cf 100644
--- a/ext/fg/js/popup-proxy.js
+++ b/ext/fg/js/popup-proxy.js
@@ -18,12 +18,14 @@
class PopupProxy {
- constructor(parentId) {
+ constructor(parentId, parentFrameId) {
this.parentId = parentId;
+ this.parentFrameId = parentFrameId;
this.id = null;
this.idPromise = null;
this.parent = null;
this.children = [];
+ this.depth = 0;
this.container = null;
@@ -102,7 +104,10 @@ class PopupProxy {
}
invokeHostApi(action, params={}) {
- return this.apiSender.invoke(action, params, 'popup-proxy-host');
+ if (typeof this.parentFrameId !== 'number') {
+ return Promise.reject('Invalid frame');
+ }
+ return this.apiSender.invoke(action, params, `popup-proxy-host#${this.parentFrameId}`);
}
static DOMRectToJson(domRect) {