Skip to content

Commit

Permalink
chore: tweak HidChooserContext::IsFidoAllowedForOrigin
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Oct 16, 2023
1 parent 107e71a commit dd28916
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shell/browser/hid/electron_hid_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ bool ElectronHidDelegate::IsFidoAllowedForOrigin(
content::BrowserContext* browser_context,
const url::Origin& origin) {
auto* chooser_context = GetChooserContext(browser_context);
return chooser_context->IsFidoAllowedForOrigin(origin);
return chooser_context && chooser_context->IsFidoAllowedForOrigin(origin);
}

bool ElectronHidDelegate::IsServiceWorkerAllowedForOrigin(
Expand Down
5 changes: 4 additions & 1 deletion shell/browser/hid/hid_chooser_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ bool HidChooserContext::IsFidoAllowedForOrigin(const url::Origin& origin) {
}
#endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)

return false;
// This differs from upstream - we want to allow users greater
// ability to communicate with FIDO devices in Electron.
return base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableHidBlocklist);
}

void HidChooserContext::AddDeviceObserver(DeviceObserver* observer) {
Expand Down

0 comments on commit dd28916

Please sign in to comment.