DevTools: Add Smart Card Emulation Handler Skeleton. [chromium/src : main]

0 views
Skip to first unread message

Paulina Gacek (Gerrit)

unread,
Dec 22, 2025, 5:09:09 AM (9 days ago) Dec 22
to Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko and Zgroza (Luke) Klimek

Paulina Gacek added 1 comment

File content/browser/devtools/render_frame_devtools_agent_host.cc
Line 374, Patchset 4: session->CreateAndAddHandler<protocol::SmartCardEmulationHandler>();
Alex Rudenko . unresolved

My understanding was that the emulation is meant to be global and not related to a specific render frame? has that changed? if it is still global, I think this should be in content/browser/devtools/browser_devtools_agent_host.cc

Paulina Gacek

Thank you for the comment! While Smart Card devices are physically global, the API implementation (`navigator.smartCard`) and the Mojo interface are bound to the specific RenderFrame.

Alex Rudenko

Is the emulation also global or would it be per render frame?

Paulina Gacek

Per frame.

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Rudenko
  • Zgroza (Luke) Klimek
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 11
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Mon, 22 Dec 2025 10:08:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Paulina Gacek <paulin...@google.com>
Comment-In-Reply-To: Alex Rudenko <alexr...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrey Kosyakov (Gerrit)

unread,
Dec 22, 2025, 6:41:39 PM (8 days ago) Dec 22
to Paulina Gacek, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Patryk Chodur, Paulina Gacek and Zgroza (Luke) Klimek

Andrey Kosyakov added 6 comments

File content/browser/devtools/protocol/smart_card_emulation_handler.h
Line 84, Patchset 12 (Latest): base::WeakPtrFactory<SmartCardEmulationHandler> weak_factory_{this};
Andrey Kosyakov . unresolved

unused?

Line 79, Patchset 12 (Latest): base::WeakPtr<RenderFrameHostImpl> host_;
Andrey Kosyakov . unresolved

raw_ptr<>, please! We're managing this explicitly in all handlers (as in, there would be SetRenderer calls before the host goes away).

File content/browser/devtools/protocol/smart_card_emulation_handler.cc
Line 39, Patchset 12 (Latest): .SwapImplForTesting(original_broker_impl_);
Andrey Kosyakov . unresolved

No ForTesting calls in prod code, please!

Line 64, Patchset 12 (Latest): if (!enabled_) {
Andrey Kosyakov . unresolved

So... it's the same whether enabled_ or not?

Line 105, Patchset 12 (Latest): auto& receiver = rfh_impl->browser_interface_broker_receiver_for_testing();
Andrey Kosyakov . unresolved

ditto.

Line 179, Patchset 12 (Latest): return DispatchResponse::ServerError(
Andrey Kosyakov . unresolved

Just skip these in protocol_config.json instead, the backend will report an error just as well.

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Rudenko
  • Patryk Chodur
  • Paulina Gacek
  • Zgroza (Luke) Klimek
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 12
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-CC: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Paulina Gacek <paulin...@google.com>
Gerrit-Attention: Patryk Chodur <pch...@google.com>
Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Mon, 22 Dec 2025 23:41:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrey Kosyakov (Gerrit)

unread,
Dec 22, 2025, 6:48:51 PM (8 days ago) Dec 22
to Paulina Gacek, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Patryk Chodur, Paulina Gacek and Zgroza (Luke) Klimek

Andrey Kosyakov added 1 comment

File chrome/browser/devtools/protocol/smart_card_emulation_handler_browsertest.cc
File-level comment, Patchset 12 (Latest):
Andrey Kosyakov . unresolved

It's usually way more practical so write CDP tests in JavaScript. Also, all your implementation is in content/ layer, so I assume it may be possible to test it in the content layer as well? Please see //third_party/blink/web_tests/http/tests/inspector-protocol for examples of content-side CDP tests. It may be possible to run these in chrome as well, the JS-side framework would be the same, but there's a tiny bit of boilerplate required on the C++ side, see chrome/browser/headless/headless_mode_protocol_browsertest.cc.

Gerrit-Comment-Date: Mon, 22 Dec 2025 23:48:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Paulina Gacek (Gerrit)

unread,
Dec 29, 2025, 4:24:22 AM (yesterday) Dec 29
to Andrey Kosyakov, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Andrey Kosyakov, Patryk Chodur and Zgroza (Luke) Klimek

Paulina Gacek added 3 comments

File content/browser/devtools/protocol/smart_card_emulation_handler.h
Line 84, Patchset 12: base::WeakPtrFactory<SmartCardEmulationHandler> weak_factory_{this};
Andrey Kosyakov . resolved

unused?

Paulina Gacek

Done

Line 79, Patchset 12: base::WeakPtr<RenderFrameHostImpl> host_;
Andrey Kosyakov . resolved

raw_ptr<>, please! We're managing this explicitly in all handlers (as in, there would be SetRenderer calls before the host goes away).

Paulina Gacek

Done

File content/browser/devtools/protocol/smart_card_emulation_handler.cc
Line 64, Patchset 12: if (!enabled_) {
Andrey Kosyakov . resolved

So... it's the same whether enabled_ or not?

Paulina Gacek

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Rudenko
  • Andrey Kosyakov
  • Patryk Chodur
  • Zgroza (Luke) Klimek
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 13
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-CC: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Patryk Chodur <pch...@google.com>
Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Mon, 29 Dec 2025 09:24:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andrey Kosyakov <ca...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Paulina Gacek (Gerrit)

unread,
Dec 29, 2025, 7:53:47 AM (yesterday) Dec 29
to Andrey Kosyakov, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Andrey Kosyakov, Patryk Chodur and Zgroza (Luke) Klimek

Paulina Gacek added 7 comments

File chrome/browser/devtools/protocol/smart_card_emulation_handler_browsertest.cc
Andrey Kosyakov . unresolved

It's usually way more practical so write CDP tests in JavaScript. Also, all your implementation is in content/ layer, so I assume it may be possible to test it in the content layer as well? Please see //third_party/blink/web_tests/http/tests/inspector-protocol for examples of content-side CDP tests. It may be possible to run these in chrome as well, the JS-side framework would be the same, but there's a tiny bit of boilerplate required on the C++ side, see chrome/browser/headless/headless_mode_protocol_browsertest.cc.

Paulina Gacek

Thanks for the suggestion! The Smart Card API must be run within an Isolated Web App (IWA) context. I used IsolatedWebAppBrowserTestHarness (from chrome/) because it handles the complex IWA setup and permissions automatically. Porting this to the content/ layer or web_tests would require significant mocking of the IWA infrastructure.

File content/browser/devtools/protocol/smart_card_emulation_handler.h
Line 84, Patchset 12: base::WeakPtrFactory<SmartCardEmulationHandler> weak_factory_{this};
Andrey Kosyakov . resolved

unused?

Paulina Gacek

Done

Paulina Gacek

I started being used in this CL: https://chromium-review.googlesource.com/c/chromium/src/+/7264773. I moved the declaration there, thanks!

File content/browser/devtools/protocol/smart_card_emulation_handler.cc
Line 39, Patchset 12: .SwapImplForTesting(original_broker_impl_);
Andrey Kosyakov . resolved

No ForTesting calls in prod code, please!

Paulina Gacek

Done

Line 39, Patchset 12: .SwapImplForTesting(original_broker_impl_);
Andrey Kosyakov . resolved

No ForTesting calls in prod code, please!

Paulina Gacek

Done

Line 105, Patchset 12: auto& receiver = rfh_impl->browser_interface_broker_receiver_for_testing();
Andrey Kosyakov . resolved

ditto.

Paulina Gacek

Done

Line 105, Patchset 12: auto& receiver = rfh_impl->browser_interface_broker_receiver_for_testing();
Andrey Kosyakov . resolved

ditto.

Paulina Gacek

Done

Line 179, Patchset 12: return DispatchResponse::ServerError(
Andrey Kosyakov . resolved

Just skip these in protocol_config.json instead, the backend will report an error just as well.

Paulina Gacek

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Rudenko
  • Andrey Kosyakov
  • Patryk Chodur
  • Zgroza (Luke) Klimek
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 16
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-CC: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Patryk Chodur <pch...@google.com>
Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Mon, 29 Dec 2025 12:53:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andrey Kosyakov <ca...@chromium.org>
Comment-In-Reply-To: Paulina Gacek <paulin...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Paulina Gacek (Gerrit)

unread,
Dec 29, 2025, 8:10:52 AM (yesterday) Dec 29
to Andrey Kosyakov, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Andrey Kosyakov, Patryk Chodur and Zgroza (Luke) Klimek

Paulina Gacek added 1 comment

File content/browser/devtools/protocol/smart_card_emulation_handler.cc
Gerrit-Comment-Date: Mon, 29 Dec 2025 13:10:34 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrey Kosyakov (Gerrit)

unread,
Dec 29, 2025, 2:36:59 PM (yesterday) Dec 29
to Paulina Gacek, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Patryk Chodur, Paulina Gacek and Zgroza (Luke) Klimek

Andrey Kosyakov added 1 comment

File chrome/browser/devtools/protocol/smart_card_emulation_handler_browsertest.cc
Andrey Kosyakov . unresolved

It's usually way more practical so write CDP tests in JavaScript. Also, all your implementation is in content/ layer, so I assume it may be possible to test it in the content layer as well? Please see //third_party/blink/web_tests/http/tests/inspector-protocol for examples of content-side CDP tests. It may be possible to run these in chrome as well, the JS-side framework would be the same, but there's a tiny bit of boilerplate required on the C++ side, see chrome/browser/headless/headless_mode_protocol_browsertest.cc.

Paulina Gacek

Thanks for the suggestion! The Smart Card API must be run within an Isolated Web App (IWA) context. I used IsolatedWebAppBrowserTestHarness (from chrome/) because it handles the complex IWA setup and permissions automatically. Porting this to the content/ layer or web_tests would require significant mocking of the IWA infrastructure.

Attention is currently required from:
  • Alex Rudenko
  • Patryk Chodur
  • Paulina Gacek
  • Zgroza (Luke) Klimek
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 17
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-CC: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Paulina Gacek <paulin...@google.com>
Gerrit-Attention: Patryk Chodur <pch...@google.com>
Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Mon, 29 Dec 2025 19:36:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andrey Kosyakov <ca...@chromium.org>
Comment-In-Reply-To: Paulina Gacek <paulin...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages