Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for WebHID #31095

merged 1 commit into from Sep 29, 2021

feat: add support for WebHID #31095

merged 1 commit into from Sep 29, 2021


Copy link

@jkleinsc jkleinsc commented Sep 23, 2021

Backport of #30213

See that PR for details.

Notes: Added WebHID support

* feat: add support for WebHID

* Apply suggestions from code review

Co-authored-by: Jeremy Rose <>

* 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/

Co-authored-by: Jeremy Rose <>

* apply review feedback from @zcbenz

* Match upstream ObjectMap

This change matches what ObjectPermissionContextBase uses to cache object permissions:;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
        gin::WrappableBase::SecondWeakCallback [0x00007FF6F2AFA005+133] (o:\gin\
        v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacks [0x00007FF6F028F9AB+171] (o:\v8\src\handles\
        v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacksFromTask [0x00007FF6F028F867+391] (o:\v8\src\handles\
        node::PerIsolatePlatformData::RunForegroundTask [0x00007FF6F3B4D065+317] (o:\third_party\electron_node\src\
        node::PerIsolatePlatformData::FlushForegroundTasksInternal [0x00007FF6F3B4C424+776] (o:\third_party\electron_node\src\
        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\
        base::TaskAnnotator::RunTask [0x00007FF6F2318A19+457] (o:\base\task\common\
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl [0x00007FF6F2E6F553+963] (o:\base\task\sequence_manager\
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork [0x00007FF6F2E6EC69+137] (o:\base\task\sequence_manager\
        base::MessagePumpForUI::DoRunLoop [0x00007FF6F235AA58+216] (o:\base\message_loop\
        base::MessagePumpWin::Run [0x00007FF6F235A01A+106] (o:\base\message_loop\
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run [0x00007FF6F2E702DA+682] (o:\base\task\sequence_manager\
        base::RunLoop::Run [0x00007FF6F22F95BA+842] (o:\base\
        content::BrowserMainLoop::RunMainMessageLoop [0x00007FF6F14423CC+208] (o:\content\browser\
        content::BrowserMainRunnerImpl::Run [0x00007FF6F144402F+143] (o:\content\browser\
        content::BrowserMain [0x00007FF6F143F911+257] (o:\content\browser\
        content::RunBrowserProcessMain [0x00007FF6EFFA7D18+112] (o:\content\app\
        content::ContentMainRunnerImpl::RunBrowser [0x00007FF6EFFA8CF4+1220] (o:\content\app\
        content::ContentMainRunnerImpl::Run [0x00007FF6EFFA87C9+393] (o:\content\app\
        content::RunContentProcess [0x00007FF6EFFA73BD+733] (o:\content\app\
        content::ContentMain [0x00007FF6EFFA79E1+54] (o:\content\app\
        wWinMain [0x00007FF6EECA1535+889] (o:\electron\shell\app\
        __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 <>
(cherry picked from commit 6aece4a)
@trop trop bot mentioned this pull request Sep 23, 2021
5 tasks
@jkleinsc jkleinsc changed the title feat: add support for WebHID (#30213) feat: add support for WebHID Sep 23, 2021
@trop trop bot added semver/minor and removed semver/minor labels Sep 23, 2021
Copy link

@codebytere codebytere left a comment

Approved on behalf of @electron/wg-releases on 9/29/2021


@jkleinsc jkleinsc merged commit 62b88b2 into 15-x-y Sep 29, 2021
16 checks passed
@jkleinsc jkleinsc deleted the web-hid-15 branch Sep 29, 2021
Copy link

@release-clerk release-clerk bot commented Sep 29, 2021

Release Notes Persisted

Added WebHID support


Copy link

@trop trop bot commented Sep 29, 2021

I have automatically backported this PR to "14-x-y", please check out #31192


Copy link

@Abdallarabie1 Abdallarabie1 commented Oct 3, 2021

Backport of #30213

See that PR for details.

Notes: Added WebHID support


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants