electron/docs/api
John Kleinschmidt 6aece4a83d
feat: add support for WebHID (#30213)
* feat: add support for WebHID

* Apply suggestions from code review

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

* Address review feedback

* Address review feedback

* chore: clear granted_devices on navigation

Also added test to verify devices get cleared

* fixup testing for device clear

* make sure navigator.hid.getDevices is run on correct frame

* clear granted devices on RenderFrameHost deletion/change

* manage device permissions per RenderFrameHost

This change makes sure we don't clear device permission prematurely due to child frame navigation

* Update shell/browser/api/electron_api_web_contents.cc

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

* apply review feedback from @zcbenz

* Match upstream ObjectMap

This change matches what ObjectPermissionContextBase uses to cache object permissions: https://source.chromium.org/chromium/chromium/src/+/main:components/permissions/object_permission_context_base.h;l=52;drc=8f95b5eab2797a3e26bba299f3b0df85bfc98bf5;bpv=1;bpt=0

The main reason for this was to resolve this crash on Win x64:
ok 2 WebContentsView doesn't crash when GCed during allocation
Received fatal exception EXCEPTION_ACCESS_VIOLATION
Backtrace:
        gin::WrappableBase::SecondWeakCallback [0x00007FF6F2AFA005+133] (o:\gin\wrappable.cc:53)
        v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacks [0x00007FF6F028F9AB+171] (o:\v8\src\handles\global-handles.cc:1400)
        v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacksFromTask [0x00007FF6F028F867+391] (o:\v8\src\handles\global-handles.cc:1387)
        node::PerIsolatePlatformData::RunForegroundTask [0x00007FF6F3B4D065+317] (o:\third_party\electron_node\src\node_platform.cc:415)
        node::PerIsolatePlatformData::FlushForegroundTasksInternal [0x00007FF6F3B4C424+776] (o:\third_party\electron_node\src\node_platform.cc:479)
        uv_run [0x00007FF6F2DDD07C+492] (o:\third_party\electron_node\deps\uv\src\win\core.c:609)
        electron::NodeBindings::UvRunOnce [0x00007FF6EEE1E036+294] (o:\electron\shell\common\node_bindings.cc:631)
        base::TaskAnnotator::RunTask [0x00007FF6F2318A19+457] (o:\base\task\common\task_annotator.cc:178)
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl [0x00007FF6F2E6F553+963] (o:\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:361)
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork [0x00007FF6F2E6EC69+137] (o:\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:266)
        base::MessagePumpForUI::DoRunLoop [0x00007FF6F235AA58+216] (o:\base\message_loop\message_pump_win.cc:221)
        base::MessagePumpWin::Run [0x00007FF6F235A01A+106] (o:\base\message_loop\message_pump_win.cc:79)
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run [0x00007FF6F2E702DA+682] (o:\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:470)
        base::RunLoop::Run [0x00007FF6F22F95BA+842] (o:\base\run_loop.cc:136)
        content::BrowserMainLoop::RunMainMessageLoop [0x00007FF6F14423CC+208] (o:\content\browser\browser_main_loop.cc:990)
        content::BrowserMainRunnerImpl::Run [0x00007FF6F144402F+143] (o:\content\browser\browser_main_runner_impl.cc:153)
        content::BrowserMain [0x00007FF6F143F911+257] (o:\content\browser\browser_main.cc:49)
        content::RunBrowserProcessMain [0x00007FF6EFFA7D18+112] (o:\content\app\content_main_runner_impl.cc:608)
        content::ContentMainRunnerImpl::RunBrowser [0x00007FF6EFFA8CF4+1220] (o:\content\app\content_main_runner_impl.cc:1104)
        content::ContentMainRunnerImpl::Run [0x00007FF6EFFA87C9+393] (o:\content\app\content_main_runner_impl.cc:971)
        content::RunContentProcess [0x00007FF6EFFA73BD+733] (o:\content\app\content_main.cc:394)
        content::ContentMain [0x00007FF6EFFA79E1+54] (o:\content\app\content_main.cc:422)
        wWinMain [0x00007FF6EECA1535+889] (o:\electron\shell\app\electron_main.cc:291)
        __scrt_common_main_seh [0x00007FF6F6F88482+262] (d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
        BaseThreadInitThunk [0x00007FFEC0087034+20]
        RtlUserThreadStart [0x00007FFEC1F02651+33]
✗ Electron tests failed with code 0xc0000005.

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-09-23 20:00:11 +09:00
..
structures feat: add support for WebHID (#30213) 2021-09-23 20:00:11 +09:00
accelerator.md Update accelerator.md (#29193) 2021-05-19 09:52:06 +09:00
app.md feat: add isMainFrame argument to 'certificate-error' event (#30879) 2021-09-21 15:49:15 +09:00
auto-updater.md docs: Update windows info for auto-updater (#30538) 2021-09-07 17:03:56 +02:00
browser-view.md docs: uniformize module API doc format (#28920) 2021-04-29 09:56:31 +02:00
browser-window-proxy.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
browser-window.md fix: maximized state calculation for non-resizable windows (#30989) 2021-09-21 12:04:32 +02:00
client-request.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
clipboard.md chore: bump chromium to 95.0.4629.0 (main) (#30676) 2021-09-01 15:55:07 -04:00
command-line-switches.md feat: bring --enable-logging functionality in line with Chromium (#25089) 2021-06-17 14:17:25 -07:00
command-line.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
content-tracing.md docs: fix contentTracing code sample (#26737) 2020-12-01 15:45:45 -08:00
context-bridge.md docs: remove Experimental from contextBridge.exposeInMainWorld (#29985) 2021-07-05 08:46:47 +09:00
cookies.md chore: bump chromium to 95.0.4612.5 (main) (#30503) 2021-08-23 20:52:17 -04:00
crash-reporter.md feat: switch to crashpad on linux (#30278) 2021-08-03 14:01:12 -07:00
debugger.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
desktop-capturer.md docs: improve relative link linting and fix broken (#26020) 2020-10-20 10:46:27 +09:00
dialog.md feat: add width option to dialog.showMessageBox() (#30474) 2021-09-23 19:56:14 +09:00
dock.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
download-item.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
environment-variables.md feat: bring --enable-logging functionality in line with Chromium (#25089) 2021-06-17 14:17:25 -07:00
extensions.md feat: partially support chrome.tabs.update (#30069) 2021-07-27 13:36:22 -07:00
file-object.md
frameless-window.md feat: enable windows control overlay on Windows (#29600) 2021-08-11 14:07:36 -04:00
global-shortcut.md fix: throw when using globalShortcut before ready (#27002) 2020-12-15 11:13:56 -08:00
in-app-purchase.md
incoming-message.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
ipc-main.md docs: mention contextIsolation in ipc-main example (#29918) 2021-07-06 10:27:35 -07:00
ipc-renderer.md docs: update verb tenses for structured clone notes (#27483) 2021-01-26 14:14:44 -08:00
menu-item.md fix: Add missing items to menuItem.role documentation (#30217) 2021-07-28 08:45:06 +02:00
menu.md docs: fix camelcase in menu example (#30341) 2021-08-10 10:01:39 +09:00
message-channel-main.md docs: uniformize module API doc format (#28920) 2021-04-29 09:56:31 +02:00
message-port-main.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
native-image.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
native-theme.md chore: cleanup whitespace in docs (#26356) 2020-11-05 14:12:43 -08:00
net-log.md
net.md feat: add net.online / net.isOnline() (#21004) 2020-10-20 19:55:06 -07:00
notification.md feat: custom toast xml and failure reporting for notifications (#25401) 2020-09-29 12:20:10 -07:00
power-monitor.md docs: suspend and resume are available on Linux (#27958) 2021-03-05 10:11:36 +09:00
power-save-blocker.md
process.md docs: update Node global symbols example to use contextBridge (#28245) 2021-03-22 11:01:12 +09:00
protocol.md docs: link ProtocolRequest doc (#25761) 2020-10-05 11:18:18 -04:00
safe-storage.md feat: add electron.safeStorage encryption API (#30020) 2021-08-05 15:12:54 -07:00
screen.md docs: coordinate system of badly named method getCursorScreenPoint (#27156) 2021-01-11 12:19:48 +09:00
service-workers.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
session.md feat: add support for WebHID (#30213) 2021-09-23 20:00:11 +09:00
share-menu.md docs: uniformize module API doc format (#28920) 2021-04-29 09:56:31 +02:00
shell.md chore: remove deprecated shell.moveItemToTrash() (#26723) 2020-11-30 23:25:03 +03:00
synopsis.md docs: rework introduction docs (#29062) 2021-05-24 11:32:36 +09:00
system-preferences.md chore: update ts parser for description comment fixes and generic types (#28709) 2021-04-19 11:44:58 -07:00
touch-bar-button.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
touch-bar-color-picker.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
touch-bar-group.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
touch-bar-label.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
touch-bar-other-items-proxy.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
touch-bar-popover.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
touch-bar-scrubber.md fix: crash when using TouchBarScrubber arrow button (#30661) 2021-08-24 18:28:57 +02:00
touch-bar-segmented-control.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
touch-bar-slider.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
touch-bar-spacer.md fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
touch-bar.md docs: uniformize module API doc format (#28920) 2021-04-29 09:56:31 +02:00
tray.md docs: uniformize module API doc format (#28920) 2021-04-29 09:56:31 +02:00
web-contents.md fix: startDrag params type incorrect (#31034) 2021-09-23 17:07:39 +09:00
web-frame-main.md feat: add 'dom-ready' event to WebFrameMain (#29290) 2021-09-01 15:21:15 -07:00
web-frame.md docs: Add clarification for Visual Zoom behavior (#28860) 2021-04-28 17:20:47 -04:00
web-request.md docs: move webRequest filters definition to structures/web-request-filter.md (#29900) 2021-07-08 00:20:08 -07:00
webview-tag.md docs: updated webview tag documentation to accurately reflect preload behavior with asar archives (#30768) 2021-09-06 17:00:17 +09:00
window-open.md fix setWindowOpenHandler call syntax (#29551) 2021-06-16 16:16:18 +09:00