summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-14 12:02:31 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-14 12:02:31 -0400
commit964de775df5b573b8ae96e4096815e1649401eb9 (patch)
tree01b59e52ca5def9e3c80b0010b536f3e34934ac3
parentec816e676771b53f6eb2c9c68e1742830c9fd194 (diff)
Validate contentWindow before focus
-rw-r--r--ext/fg/js/popup.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 1b15977b..08c4bfcb 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -239,9 +239,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.