Skip to content
This repository was archived by the owner on Dec 11, 2019. It is now read-only.

Commit 1364969

Browse files
darkdhbridiver
authored andcommitted
Temporary solution to post emitted webview event
Auditors: @bbondy, @bridiver
1 parent b2ad4a8 commit 1364969

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

js/components/frame.js

+15-5
Original file line numberDiff line numberDiff line change
@@ -706,14 +706,20 @@ class Frame extends ImmutableComponent {
706706
this.props.onCloseFrame(this.frame)
707707
})
708708
this.webview.addEventListener('page-favicon-updated', (e) => {
709-
if (e.favicons && e.favicons.length > 0) {
709+
// TODO(Anthony): more general solution on muon to prevent weview event
710+
// from emitting after tab closed
711+
if (e.favicons && e.favicons.length > 0 && this.frame) {
710712
imageUtil.getWorkingImageUrl(e.favicons[0], (imageFound) => {
711713
windowActions.setFavicon(this.frame, imageFound ? e.favicons[0] : null)
712714
})
713715
}
714716
})
715717
this.webview.addEventListener('page-title-updated', ({title}) => {
716-
windowActions.setFrameTitle(this.frame, title)
718+
// TODO(Anthony): more general solution on muon to prevent weview event
719+
// from emitting after tab closed
720+
if (this.frame) {
721+
windowActions.setFrameTitle(this.frame, title)
722+
}
717723
})
718724
this.webview.addEventListener('show-autofill-settings', (e) => {
719725
windowActions.newFrame({ location: 'about:autofill' }, true)
@@ -722,9 +728,13 @@ class Frame extends ImmutableComponent {
722728
contextMenus.onShowAutofillMenu(e.suggestions, e.rect, this.frame)
723729
})
724730
this.webview.addEventListener('hide-autofill-popup', (e) => {
725-
let webContents = this.webview.getWebContents()
726-
if (webContents && webContents.isFocused()) {
727-
windowActions.autofillPopupHidden(this.props.tabId)
731+
// TODO(Anthony): more general solution on muon to prevent weview event
732+
// from emitting after tab closed
733+
if (this.frame) {
734+
let webContents = this.webview.getWebContents()
735+
if (webContents && webContents.isFocused()) {
736+
windowActions.autofillPopupHidden(this.props.tabId)
737+
}
728738
}
729739
})
730740
this.webview.addEventListener('ipc-message', (e) => {

0 commit comments

Comments
 (0)