fix: emit focus/blur events for webview (backport: 3-0-x) (#14359)

* fix: emit focus/blur events for webview

* test: webview can emit focus event
This commit is contained in:
trop[bot] 2018-08-28 13:38:11 -05:00 committed by Charles Kerr
parent 873f39b159
commit b1c22ba531
5 changed files with 53 additions and 21 deletions

View file

@ -24,6 +24,7 @@ const WEB_VIEW_EVENTS = {
'did-navigate': ['url', 'httpResponseCode', 'httpStatusText'],
'did-frame-navigate': ['url', 'httpResponseCode', 'httpStatusText', 'isMainFrame', 'frameProcessId', 'frameRoutingId'],
'did-navigate-in-page': ['url', 'isMainFrame', 'frameProcessId', 'frameRoutingId'],
'focus-change': ['focus', 'guestInstanceId'],
'close': [],
'crashed': [],
'gpu-crashed': [],
@ -55,6 +56,8 @@ const dispatchEvent = function (webView, eventName, eventKey, ...args) {
webView.dispatchEvent(domEvent)
if (eventName === 'load-commit') {
webView.onLoadCommit(domEvent)
} else if (eventName === 'focus-change') {
webView.onFocusChange(domEvent)
}
}