aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/popup.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2019-09-23 17:35:36 -0700
committerAlex Yatskov <alex@foosoft.net>2019-09-23 17:35:36 -0700
commitf4b6527ed6ed1f0f4f5a63b94766b20f3b90e6ec (patch)
tree0d2f733c13597dd4067d3dc01e6da27f96bfe81b /ext/fg/js/popup.js
parentcfc6363a01ee00e89866c54709006d6f55d093de (diff)
parentf5afe590ad0730a695614b32032b7ea70b46c7b0 (diff)
Merge branch 'master' into testing
Diffstat (limited to 'ext/fg/js/popup.js')
-rw-r--r--ext/fg/js/popup.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 1b15977b..08965084 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -59,7 +59,8 @@ class Popup {
this.invokeApi('popupNestedInitialize', {
id: this.id,
depth: this.depth,
- parentFrameId
+ parentFrameId,
+ url: this.url
});
this.invokeApi('setOptions', {
general: {
@@ -239,9 +240,12 @@ class Popup {
}
focusParent() {
- if (this.parent && this.parent.container) {
+ if (this.parent !== null) {
// Chrome doesn't like focusing iframe without contentWindow.
- this.parent.container.contentWindow.focus();
+ const contentWindow = this.parent.container.contentWindow;
+ if (contentWindow !== null) {
+ contentWindow.focus();
+ }
} else {
// Firefox doesn't like focusing window without first blurring the iframe.
// this.container.contentWindow.blur() doesn't work on Firefox for some reason.
@@ -251,7 +255,7 @@ class Popup {
}
}
- async containsPoint({x, y}) {
+ async containsPoint(x, y) {
for (let popup = this; popup !== null && popup.isVisible(); popup = popup.child) {
const rect = popup.container.getBoundingClientRect();
if (x >= rect.left && y >= rect.top && x < rect.right && y < rect.bottom) {
@@ -308,4 +312,8 @@ class Popup {
parent.appendChild(this.container);
}
}
+
+ get url() {
+ return window.location.href;
+ }
}