diff options
author | Alex Yatskov <FooSoft@users.noreply.github.com> | 2019-09-14 17:31:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-14 17:31:23 -0700 |
commit | 88a6128e39150133af1ba0cea5ea712b9657fa28 (patch) | |
tree | 24377282cd575b5b2816f808cabdf7a4649596a2 /ext/fg/js | |
parent | 2add068ff24f679f3a2ddabc90ed57b6e0b815aa (diff) | |
parent | 964de775df5b573b8ae96e4096815e1649401eb9 (diff) |
Merge pull request #211 from toasted-nutbread/validate-content-window
Validate contentWindow before focus
Diffstat (limited to 'ext/fg/js')
-rw-r--r-- | ext/fg/js/popup.js | 7 |
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. |