electron/spec-main
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
..
fixtures fix: BrowserWindow backgroundColor (#30778) 2021-09-06 16:59:09 +09:00
.eslintrc
.gitignore
ambient.d.ts fix: type internal APIs that can return null properly (#29852) 2021-07-27 14:48:12 +09:00
api-app-spec.ts refactor: Convert ProcessSingleton changes to patch (#30594) 2021-09-03 14:16:33 -07:00
api-auto-updater-spec.ts ci: enable arm64 macOS tests (#24832) 2021-01-21 18:36:52 -05:00
api-autoupdater-darwin-spec.ts chore: update to latest TypeScript, which has built-in WeakRef declarations (#27425) 2021-01-22 11:25:47 -08:00
api-browser-view-spec.ts feat: add win.setTopBrowserView() so that BrowserViews can be raised (#27007) 2021-02-10 16:23:35 +09:00
api-browser-window-spec.ts fix: maximized state calculation for non-resizable windows (#30989) 2021-09-21 12:04:32 +02:00
api-content-tracing-spec.ts ci: enable arm64 macOS tests (#24832) 2021-01-21 18:36:52 -05:00
api-context-bridge-spec.ts feat: add support for Blob's going over the ctx bridge (#29247) 2021-05-26 10:34:29 -07:00
api-crash-reporter-spec.ts feat: switch to crashpad on linux (#30278) 2021-08-03 14:01:12 -07:00
api-debugger-spec.ts feat: expose sessionId in debugger module (#24170) 2020-07-02 13:04:20 -07:00
api-deprecate-spec.ts refactor: replace a few any-s with proper types (#25681) 2020-10-08 03:01:23 +02:00
api-desktop-capturer-spec.ts fix: disable kWindowCaptureMacV2 for desktopCapturer (#30507) 2021-08-13 13:23:56 -07:00
api-dialog-spec.ts feat: add signal option to dialog.showMessageBox (#26102) 2021-07-15 07:59:27 +09:00
api-global-shortcut-spec.ts fix: media key globalShortcuts on macOS (#30552) 2021-08-17 13:44:17 -04:00
api-in-app-purchase-spec.ts
api-ipc-main-spec.ts feat: enable context isolation by default (#26890) 2021-03-01 16:52:29 -05:00
api-ipc-renderer-spec.ts feat: enable context isolation by default (#26890) 2021-03-01 16:52:29 -05:00
api-ipc-spec.ts fix: ensure the typescript definitions only export correct value types (#28712) 2021-06-15 13:50:31 -07:00
api-menu-item-spec.ts fix: keep shifted character in menu accelerator (#29202) 2021-06-02 16:32:48 +09:00
api-menu-spec.ts chore: update to latest TypeScript, which has built-in WeakRef declarations (#27425) 2021-01-22 11:25:47 -08:00
api-native-theme-spec.ts spec: attempt to fix flaky nativeTheme spec (#29022) 2021-05-05 18:04:38 -07:00
api-net-log-spec.ts chore: update to latest TypeScript, which has built-in WeakRef declarations (#27425) 2021-01-22 11:25:47 -08:00
api-net-spec.ts ci: enable arm64 macOS tests (#24832) 2021-01-21 18:36:52 -05:00
api-notification-dbus-spec.ts
api-notification-spec.ts feat: custom toast xml and failure reporting for notifications (#25401) 2020-09-29 12:20:10 -07:00
api-power-monitor-spec.ts feat: add powerMonitor.onBatteryPower (#26494) 2020-11-16 16:31:46 -08:00
api-power-save-blocker-spec.ts
api-protocol-spec.ts fix: handle redirects within registered protocols (#29796) 2021-07-15 20:14:46 +09:00
api-safe-storage-spec.ts feat: add electron.safeStorage encryption API (#30020) 2021-08-05 15:12:54 -07:00
api-screen-spec.ts fix: add a "set" trap to the "screen" module proxy (#26818) 2020-12-07 09:20:50 -08:00
api-service-workers-spec.ts test: use new uuid for each ServiceWorker test (#27444) 2021-01-23 10:37:51 +09:00
api-session-spec.ts ci: fix setCertificateVerifyProc tests (#30799) 2021-09-01 18:58:29 -04:00
api-shell-spec.ts test: disable shell.trashItem in renderer test on win-ia32 (#28868) 2021-04-27 14:35:31 -07:00
api-subframe-spec.ts feat: enable context isolation by default (#26890) 2021-03-01 16:52:29 -05:00
api-system-preferences-spec.ts chore: remove deprecated systemPreferences methods (#26849) 2020-12-16 08:34:24 +09:00
api-touch-bar-spec.ts
api-tray-spec.ts refactor: remove path from nativeImage converter (#26546) 2021-01-04 12:58:31 -08:00
api-view-spec.ts refactor: rename TopLevelWindow to BaseWindow (#24305) 2020-06-29 16:06:20 +09:00
api-web-contents-spec.ts feat: add frame to context-menu event params (#30831) 2021-09-22 08:52:49 +09:00
api-web-contents-view-spec.ts test: disable some tests under ASan which might receive SIGKILL because of OOM (#28156) 2021-03-16 17:02:47 -04:00
api-web-frame-main-spec.ts feat: add 'dom-ready' event to WebFrameMain (#29290) 2021-09-01 15:21:15 -07:00
api-web-frame-spec.ts chore: remove deprecated worldSafeExecuteJavaScript option (#28456) 2021-04-08 12:03:57 -04:00
api-web-request-spec.ts fix: handle redirects within registered protocols (#29796) 2021-07-15 20:14:46 +09:00
asar-spec.ts test: worker should be able to load asar files (#28858) 2021-04-27 12:07:05 -04:00
autofill-spec.ts
chromium-spec.ts feat: add support for WebHID (#30213) 2021-09-23 20:00:11 +09:00
crash-spec.ts build: give ASAN tests more memory to avoid SIGKILL or disabling tests (#28567) 2021-04-09 16:09:17 +09:00
events-helpers.ts chore: deprecate remote (#25293) 2020-09-10 09:17:17 -07:00
extensions-spec.ts feat: add support for the U2F Web API (#30438) 2021-08-30 11:22:46 -07:00
guest-window-manager-spec.ts feat: enable sandbox by default in limited circumstances (#30197) 2021-08-03 15:07:03 -07:00
index.js fix: suppress insecure resource warning for more local hostnames (#30885) 2021-09-21 15:47:54 +09:00
internal-spec.ts feat: remove deprecated additionalFeatures (#28548) 2021-04-19 15:46:54 -07:00
logging-spec.ts spec: fix check for electron_common_testing binding in logging-spec.ts (#30086) 2021-07-12 22:11:19 -07:00
modules-spec.ts feat: enable context isolation by default (#26890) 2021-03-01 16:52:29 -05:00
node-spec.ts feat: add support for validating asar archives on macOS (#30667) 2021-09-09 14:49:01 -07:00
package.json build(deps-dev): bump ws from 7.2.1 to 7.4.6 in /spec-main (#29421) 2021-06-18 14:20:29 -07:00
pipe-transport.ts
release-notes-spec.ts chore: graceful handling of notes with sub-lists (#25279) 2020-09-03 14:42:48 -05:00
security-warnings-spec.ts fix: suppress insecure resource warning for more local hostnames (#30885) 2021-09-21 15:47:54 +09:00
spec-helpers.ts test: deflake crashReporter.getLastCrashReport test (#30276) 2021-07-28 08:56:15 -07:00
spellchecker-spec.ts fix: webFrame spell checker APIs crashing in sandboxed renderers (#29053) 2021-05-10 14:19:23 +02:00
types-spec.ts chore: bump Node.js to v16.2.0 (#29244) 2021-06-17 08:50:56 +02:00
version-bump-spec.ts build: update version-bumper to support alpha (#30165) 2021-07-19 17:58:15 -07:00
video-helpers.js chore: fix minor script warnings (#25575) 2020-09-23 13:21:34 -07:00
visibility-state-spec.ts feat: enable context isolation by default (#26890) 2021-03-01 16:52:29 -05:00
webview-spec.ts chore: bump chromium to 95.0.4612.5 (main) (#30503) 2021-08-23 20:52:17 -04:00
window-helpers.ts
yarn.lock build(deps-dev): bump ws from 7.2.1 to 7.4.6 in /spec-main (#29421) 2021-06-18 14:20:29 -07:00