electron/shell/common
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
..
api feat: add support for validating asar archives on macOS (#30667) 2021-09-09 14:49:01 -07:00
asar chore: fix compile errors (#30903) 2021-09-09 19:52:23 -07:00
extensions feat: add support for the U2F Web API (#30438) 2021-08-30 11:22:46 -07:00
gin_converters feat: add support for WebHID (#30213) 2021-09-23 20:00:11 +09:00
gin_helper feat: add 'dom-ready' event to WebFrameMain (#29290) 2021-09-01 15:21:15 -07:00
mac fix: build when some buildflags are disabled (#23307) 2020-04-28 23:16:10 -07:00
resources/mac revert: disable rosetta as Electron does not run under rosetta 2020-11-18 09:04:16 -08:00
application_info.cc fix: use correct userData path when unbundled (#30113) 2021-07-14 13:10:37 -07:00
application_info.h fix: use correct userData path when unbundled (#30113) 2021-07-14 13:10:37 -07:00
application_info_linux.cc fix: use correct userData path when unbundled (#30113) 2021-07-14 13:10:37 -07:00
application_info_mac.mm
application_info_win.cc chore: bump chromium to 94.0.4584.0 (main) (#30030) 2021-07-26 09:02:16 -07:00
color_util.cc Merge branch 'master' into roller/chromium/master 2021-03-15 18:43:25 -04:00
color_util.h Merge branch 'master' into roller/chromium/master 2021-03-15 18:43:25 -04:00
crash_keys.cc feat: warn when crash key name is longer than 39 bytes (#30742) 2021-09-07 11:09:48 -07:00
crash_keys.h fix: change gin_wrappable to scoped crash key (#30578) 2021-08-18 13:51:40 -07:00
electron_command_line.cc style: use build/include_directory for NOLINT (#23266) 2020-04-24 12:57:41 -07:00
electron_command_line.h chore: trim unused STL includes (#29414) 2021-06-01 10:34:44 +09:00
electron_constants.cc fix: crashReporter incompatible with sandbox on Linux (#23265) 2020-05-07 13:31:26 -07:00
electron_constants.h fix: crashReporter incompatible with sandbox on Linux (#23265) 2020-05-07 13:31:26 -07:00
electron_paths.h refactor: use PathProvider for user-data-dir and others (#29649) 2021-06-15 09:32:56 +09:00
heap_snapshot.cc chore: clean up forward declarations (#29904) 2021-07-02 09:51:37 +09:00
heap_snapshot.h chore: clean up forward declarations (#29904) 2021-07-02 09:51:37 +09:00
key_weak_map.h
keyboard_util.cc chore: bump chromium to 93.0.4530.0 (master) (#29256) 2021-06-03 01:05:04 -07:00
keyboard_util.h chore: bump chromium to 93.0.4530.0 (master) (#29256) 2021-06-03 01:05:04 -07:00
language_util.h 2757472: Reland "Reland "[LSC] Remove base::string16 alias"" 2021-03-18 15:55:51 -04:00
language_util_linux.cc fix: respect system language preferences on Win/macOS (#23247) 2020-05-04 10:49:29 -07:00
language_util_mac.mm fix: respect system language preferences on Win/macOS (#23247) 2020-05-04 10:49:29 -07:00
language_util_win.cc 2757472: Reland "Reland "[LSC] Remove base::string16 alias"" 2021-03-18 15:55:51 -04:00
logging.cc feat: bring --enable-logging functionality in line with Chromium (#25089) 2021-06-17 14:17:25 -07:00
logging.h feat: bring --enable-logging functionality in line with Chromium (#25089) 2021-06-17 14:17:25 -07:00
mouse_util.cc chore: bump chromium to 580fe983e138952553cd6af11ee8b (master) (#23379) 2020-05-26 13:06:26 -07:00
mouse_util.h chore: bump chromium to bc8f70ed4cfe2262ea833750eaddb (master) (#22649) 2020-03-14 16:54:14 -04:00
node_bindings.cc feat: add support for validating asar archives on macOS (#30667) 2021-09-09 14:49:01 -07:00
node_bindings.h chore: clean up forward declarations (#29904) 2021-07-02 09:51:37 +09:00
node_bindings_linux.cc refactor: run clang-tidy (#20231) 2019-09-16 18:12:00 -04:00
node_bindings_linux.h
node_bindings_mac.cc chore: use =default for default constructors/destructors (#29511) 2021-06-04 13:16:13 +09:00
node_bindings_mac.h
node_bindings_win.cc chore: use =default for default constructors/destructors (#29511) 2021-06-04 13:16:13 +09:00
node_bindings_win.h
node_includes.h refactor: dynamically search defines from node (#30563) 2021-08-18 13:34:15 -07:00
node_util.cc refactor: dynamically search defines from node (#30563) 2021-08-18 13:34:15 -07:00
node_util.h chore: clean up forward declarations (#29904) 2021-07-02 09:51:37 +09:00
options_switches.cc feat: enable windows control overlay on Windows (#29600) 2021-08-11 14:07:36 -04:00
options_switches.h feat: enable windows control overlay on Windows (#29600) 2021-08-11 14:07:36 -04:00
platform_util.cc fix: shell.trashItem crash when called in renderer (#28748) 2021-04-22 13:46:41 -07:00
platform_util.h 2757472: Reland "Reland "[LSC] Remove base::string16 alias"" 2021-03-16 13:58:27 -04:00
platform_util_internal.h feat: add shell.trashItem() to replace shell.moveItemToTrash() (#25114) 2020-09-02 10:32:33 -07:00
platform_util_linux.cc fix(linux): OpenURI portal support for shell.showItemInFolder() (#30716) 2021-09-01 10:04:28 +09:00
platform_util_mac.mm fix: Building on macOS with is_debug true (#30913) 2021-09-15 09:40:36 +09:00
platform_util_win.cc fix a messed up merge 2021-03-24 11:48:15 -07:00
process_util.cc chore: clean up forward declarations (#29904) 2021-07-02 09:51:37 +09:00
process_util.h chore: clean up forward declarations (#29904) 2021-07-02 09:51:37 +09:00
skia_util.cc chore: clean up forward declarations (#29904) 2021-07-02 09:51:37 +09:00
skia_util.h chore: clean up forward declarations (#29904) 2021-07-02 09:51:37 +09:00
v8_value_converter.cc chore: use std::make_unique/base::MakeRefCounted when possible (#29510) 2021-06-08 11:00:05 +09:00
v8_value_converter.h chore: remove native_mate (Part 12) (#20869) 2019-10-31 16:56:00 +09:00
v8_value_serializer.cc feat: serialize NativeImage over ipc (#30729) 2021-09-07 10:37:45 -07:00
v8_value_serializer.h feat: MessagePorts in the main process (#22404) 2020-03-11 18:07:54 -07:00
world_ids.h chore: bump chromium to 7264889ce3aad1568ff3d211c81fe (master) (#27003) 2020-12-22 14:14:44 -08:00