Add before-input-event event for webContents (fixes #7586)
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Tue, 6 Dec 2016 22:41:18 +0000 (14:41 -0800)
committerKevin Sawicki <kevinsawicki@gmail.com>
Tue, 13 Dec 2016 23:54:13 +0000 (15:54 -0800)
commita3b65ad48157e5f50f056de1fc05e9c1a507e3c3
treeb35690cd120f6517c5791684903d370ae9457f71
parent3290c6b335a4a98a6a6c17319eb0f065d50e9e8a
Add before-input-event event for webContents (fixes #7586)

Embedding arbitrary web content is problematic when it comes to keyboard
shortcuts because:

* Web content can steal app shortcuts (see e.g. brave/browser-laptop#4408)

* Blocked web content (e.g. a focused <webview> performing expensive
computation) will also prevent app shortcuts from firing immediately

The new before-input-event event can be used to overcome these issues by
always handle certain keyboard events in the main process.

Note that this requires electron/brightray#261 to compile.
atom/browser/api/atom_api_web_contents.cc
atom/browser/api/atom_api_web_contents.h
docs/api/web-contents.md
spec/api-web-contents-spec.js