electron/docs/api/structures
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
..
bluetooth-device.md Fix bd object name 2016-10-18 15:47:18 +11:00
certificate-principal.md docs: Improved documentation (#13403) 2018-07-20 10:58:19 -07:00
certificate.md fix relative link to CertificatePrincipal doc 2016-12-19 13:49:02 -08:00
cookie.md feat: expose the sameSite value for cookies (#22789) 2020-04-02 11:28:43 -07:00
cpu-usage.md docs: fix spelling and grammar errors (#18910) 2019-06-21 16:19:21 -05:00
crash-report.md CrashReport structure does not match API output 2018-01-27 12:21:09 +01:00
custom-scheme.md feat: add {stream} opt to custom protocol registry to configure media player (#22955) 2020-06-08 09:49:36 -07:00
desktop-capturer-source.md docs: correct meaning of DesktopCapturerSource.id (#27255) 2021-01-11 12:20:00 +09:00
display.md docs: coordinate system of Display.bounds and Display.workArea (#27157) 2021-01-07 19:49:45 +09:00
event.md refactor: Split 'Event' docs/types into more specific Event types (#17038) 2019-02-19 09:24:19 +00:00
extension-info.md docs: remove implicit 'any' and 'Object' types from the docs (#19585) 2019-08-05 10:45:58 -07:00
extension.md feat(extensions): add more properties to extension object (#22244) 2020-02-24 12:30:32 +09:00
file-filter.md More docs updates 2016-11-11 09:22:55 -08:00
file-path-with-headers.md test: move protocol specs to main process (#18923) 2019-06-27 14:20:29 -07:00
gpu-feature-status.md docs: Improved documentation (#13403) 2018-07-20 10:58:19 -07:00
hid-device.md feat: add support for WebHID (#30213) 2021-09-23 20:00:11 +09:00
input-event.md test: tsify more web contents specs (#19969) 2019-08-29 19:45:41 -05:00
io-counters.md Adding CPU and I/O metrics to process module 2017-05-04 14:33:59 -07:00
ipc-main-event.md feat: add event.senderFrame property returning the originating webFrameMain (#26764) 2020-12-09 15:34:06 -08:00
ipc-main-invoke-event.md feat: add event.senderFrame property returning the originating webFrameMain (#26764) 2020-12-09 15:34:06 -08:00
ipc-renderer-event.md docs: improve relative link linting and fix broken (#26020) 2020-10-20 10:46:27 +09:00
jump-list-category.md fix: reject task append to JumpList when description exceeds 260 characters (#28485) 2021-04-06 08:50:39 +09:00
jump-list-item.md fix: reject task append to JumpList when description exceeds 260 characters (#28485) 2021-04-06 08:50:39 +09:00
keyboard-event.md refactor: ginify WebContents (#24651) 2020-07-30 09:17:57 -07:00
keyboard-input-event.md docs: fix type information for contents.sendInputEvent (#19479) 2019-07-26 16:11:50 -07:00
memory-info.md feat: add memory to app.getAppMetrics() (#18831) 2019-07-23 13:41:58 -07:00
memory-usage-details.md purgedSize and purgeableSize are removed by Chrome 2017-02-06 10:34:29 -08:00
mime-typed-buffer.md Update mime-typed-buffer.md (#23384) 2020-05-11 19:00:38 +09:00
mouse-input-event.md docs: fix type information for contents.sendInputEvent (#19479) 2019-07-26 16:11:50 -07:00
mouse-wheel-input-event.md docs: fix type information for contents.sendInputEvent (#19479) 2019-07-26 16:11:50 -07:00
new-window-web-contents-event.md chore: cleanup whitespace in docs (#26356) 2020-11-05 14:12:43 -08:00
notification-action.md Remove more words (#12852) 2018-05-08 00:16:09 -05:00
notification-response.md feat: add support for UNNotificationResponse in app 'ready' event (#25950) 2020-10-28 04:25:10 +03:00
point.md feat: automatically round numbers that are converted to points (#14604) 2018-09-13 08:28:56 -05:00
post-body.md feat: add more info in setWindowOpenHandler details (#28518) 2021-04-13 15:35:27 -04:00
printer-info.md docs: fix typos (#24982) 2020-08-18 16:55:16 +09:00
process-memory-info.md docs: fix platform location for params (#18987) 2019-06-27 14:51:18 -07:00
process-metric.md feat: add serviceName to 'child-process-gone' / app.getAppMetrics() (#25975) 2020-10-19 14:55:47 +03:00
product.md feat: expose currencyCode on Product struct in IAP module (#25058) 2020-08-21 10:41:40 -07:00
protocol-request.md docs: move protocol-ns to protocol.md (#23883) 2020-06-02 09:46:18 -07:00
protocol-response-upload-data.md chore: upgrade ts generator for better type safety (#20975) 2019-11-05 13:34:04 -08:00
protocol-response.md docs: link ProtocolResponseUploadData (#26294) 2020-11-02 19:01:46 +09:00
rectangle.md docs: Improved documentation (#13403) 2018-07-20 10:58:19 -07:00
referrer.md fix: update docs for the ts parser (#12902) 2018-05-12 18:12:28 +10:00
scrubber-item.md docs: Improved documentation (#13403) 2018-07-20 10:58:19 -07:00
segmented-control-segment.md docs: Improved documentation (#13403) 2018-07-20 10:58:19 -07:00
serial-port.md chore: bump chromium to 6b9fa6b352d824d052222e1abe541 (master) (#25558) 2020-10-15 18:30:41 -07:00
service-worker-info.md feat: add API for receiving logs from service workers (#20624) 2020-02-20 15:19:06 -08:00
shared-worker-info.md feat: allow inspection of specific shared workers (#20389) 2019-10-02 14:38:27 +02:00
sharing-item.md feat: add support for share menu on macOS (#25629) 2020-10-19 18:33:06 -07:00
shortcut-details.md feat: read/write Toast Activator CLSID in shortcuts (#25493) 2020-09-17 15:17:44 -07:00
size.md Use point / size / rectangle structures consistently in API docs 2017-04-04 08:31:09 +02:00
task.md feat: allow setting working directory in app.setUserTasks() / app.setJumpList() (#18148) 2019-05-13 19:17:12 +03:00
thumbar-button.md Put optional label before dash 2016-12-29 14:11:26 -08:00
trace-categories-and-options.md build: move to the new docs parser (#18103) 2019-05-06 08:29:01 -07:00
trace-config.md build: update to standard 14 (#24479) 2020-07-09 10:18:49 -07:00
transaction.md fix: update docs for the ts parser (#12902) 2018-05-12 18:12:28 +10:00
upload-data.md docs: UploadData does not have contentType (#19026) 2019-06-28 11:19:01 -07:00
upload-file.md fix: pass postData to new-window event (#28513) 2021-04-06 09:54:05 -07:00
upload-raw-data.md fix: pass postData to new-window event (#28513) 2021-04-06 09:54:05 -07:00
user-default-types.md chore: update ts parser for description comment fixes and generic types (#28709) 2021-04-19 11:44:58 -07:00
web-request-filter.md docs: move webRequest filters definition to structures/web-request-filter.md (#29900) 2021-07-08 00:20:08 -07:00
web-source.md build: auto-fix whitespace in docs in pre-commit hook (#17490) 2019-03-21 12:15:55 -07:00