Address autofill API [chromium/src : main]

0 views
Skip to first unread message

Yoav Weiss (@Shopify) (Gerrit)

unread,
Sep 18, 2025, 9:24:55 AM (2 days ago) Sep 18
to Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, core-timi...@chromium.org, gcasto+w...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, milicau+watchlis...@google.com, rouslan+au...@chromium.org, speed-metrics...@chromium.org, vasilii+watchlis...@chromium.org
Attention needed from Christoph Schwering

Yoav Weiss (@Shopify) voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Christoph Schwering
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
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: I9a06ff81466fca7d97d06699a31fec750d15eddb
Gerrit-Change-Number: 6965138
Gerrit-PatchSet: 2
Gerrit-Owner: Yoav Weiss (@Shopify) <yoav...@chromium.org>
Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
Gerrit-Reviewer: Yoav Weiss (@Shopify) <yoav...@chromium.org>
Gerrit-CC: Kentaro Hara <har...@chromium.org>
Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
Gerrit-Attention: Christoph Schwering <schw...@google.com>
Gerrit-Comment-Date: Thu, 18 Sep 2025 13:24:37 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Yoav Weiss (@Shopify) (Gerrit)

unread,
Sep 18, 2025, 9:33:07 AM (2 days ago) Sep 18
to Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, core-timi...@chromium.org, gcasto+w...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, milicau+watchlis...@google.com, rouslan+au...@chromium.org, speed-metrics...@chromium.org, vasilii+watchlis...@chromium.org
Attention needed from Christoph Schwering

Yoav Weiss (@Shopify) added 1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Yoav Weiss (@Shopify) . resolved

This is identical to https://chromium-review.googlesource.com/c/chromium/src/+/6200613, with the following differences:

  • The AutofillEvent now has a browser test
  • Removed the extra `Lift` from ContentAutofillDriver
  • Brought back `WebString key = control_element.NameForAutofill();` in form_autofill_util and removed the TODO (which was incorrect)
  • Bring back the direct call to `RetriggerAutofillImpl` from BrowserAutofillManager (instead of `ScheduleRefill`), as we don't need to schedule a refill in the future, but to trigger it immediately (as a response to the promise resolving).
  • Add a null check to web_form_element.

I'll add comments in the code itself to make the above clearer and easier to review.

Open in Gerrit

Related details

Attention is currently required from:
  • Christoph Schwering
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
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: I9a06ff81466fca7d97d06699a31fec750d15eddb
Gerrit-Change-Number: 6965138
Gerrit-PatchSet: 2
Gerrit-Owner: Yoav Weiss (@Shopify) <yoav...@chromium.org>
Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
Gerrit-Reviewer: Yoav Weiss (@Shopify) <yoav...@chromium.org>
Gerrit-CC: Kentaro Hara <har...@chromium.org>
Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
Gerrit-Attention: Christoph Schwering <schw...@google.com>
Gerrit-Comment-Date: Thu, 18 Sep 2025 13:32:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Yoav Weiss (@Shopify) (Gerrit)

unread,
Sep 18, 2025, 9:37:49 AM (2 days ago) Sep 18
to Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, core-timi...@chromium.org, gcasto+w...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, milicau+watchlis...@google.com, rouslan+au...@chromium.org, speed-metrics...@chromium.org, vasilii+watchlis...@chromium.org
Attention needed from Christoph Schwering

Yoav Weiss (@Shopify) voted and added 3 comments

Votes added by Yoav Weiss (@Shopify)

Commit-Queue+1

3 comments

File components/autofill/content/renderer/form_autofill_util.cc
Line 2728, Patchset 3 (Latest): WebString key = control_element.NameForAutofill();
Yoav Weiss (@Shopify) . unresolved

@schw...@google.com - I brought back the name here, as this is the fields that are web-exposed to developers, and they should have meaningful names.

File components/autofill/core/browser/foundations/browser_autofill_manager.cc
Line 2425, Patchset 3 (Latest): form_filler_->RetriggerAutofillImpl(
Yoav Weiss (@Shopify) . unresolved

@schw...@google.com - This calls RetriggerAutofillImpl rather than ScheduleRefill as I believe we need to trigger it immediately, not in some point in the future.

File third_party/blink/renderer/core/exported/web_form_element.cc
Line 89, Patchset 3 (Latest): if (!element) {
Yoav Weiss (@Shopify) . unresolved

@schw...@google.com - Added this null check, as some tests arrive here without an HTMLFormElement.

Open in Gerrit

Related details

Attention is currently required from:
  • Christoph Schwering
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I9a06ff81466fca7d97d06699a31fec750d15eddb
    Gerrit-Change-Number: 6965138
    Gerrit-PatchSet: 3
    Gerrit-Owner: Yoav Weiss (@Shopify) <yoav...@chromium.org>
    Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
    Gerrit-Reviewer: Yoav Weiss (@Shopify) <yoav...@chromium.org>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    Gerrit-Attention: Christoph Schwering <schw...@google.com>
    Gerrit-Comment-Date: Thu, 18 Sep 2025 13:37:34 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Christoph Schwering (Gerrit)

    unread,
    Sep 18, 2025, 1:27:24 PM (2 days ago) Sep 18
    to Yoav Weiss (@Shopify), Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, core-timi...@chromium.org, gcasto+w...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, milicau+watchlis...@google.com, rouslan+au...@chromium.org, speed-metrics...@chromium.org, vasilii+watchlis...@chromium.org
    Attention needed from Yoav Weiss (@Shopify)

    Christoph Schwering added 10 comments

    File components/autofill/content/common/mojom/autofill_driver.mojom
    Line 65, Patchset 3 (Latest): // Retrigger an autofill after the onautofill event fired and the Promise it
    // passed to `waitForIt` was resolved.
    Christoph Schwering . unresolved

    I suspect most readers won't know what this is referring to, especially what `waitForIt` is. (At least I don't 😊.)

    File components/autofill/content/renderer/autofill_agent.h
    Line 572, Patchset 3 (Latest): bool waiting_for_autofill_retrigger_ = false;
    Christoph Schwering . unresolved

    How many times may JS delay the autofill? Once, right?

    File components/autofill/content/renderer/form_autofill_util.h
    Line 180, Patchset 3 (Latest):bool DispatchAutofillEvent(const blink::WebDocument& document,
    Christoph Schwering . unresolved

    Please document what this does.

    File components/autofill/content/renderer/form_autofill_util.cc
    Line 2728, Patchset 3 (Latest): WebString key = control_element.NameForAutofill();
    Yoav Weiss (@Shopify) . unresolved

    @schw...@google.com - I brought back the name here, as this is the fields that are web-exposed to developers, and they should have meaningful names.

    Christoph Schwering

    I see! There will a specification for what the keys should be, right? I think we don't guarantee stability of `NameForAutofill()` so perhaps we should implement our own fallback from `name` to `id` or vice versa, if we want such a fallback at all.

    Line 2737, Patchset 3 (Latest): .TriggerAutofillEvent(is_undo, field_values);
    Christoph Schwering . unresolved

    std::move() or make the parameter a const ref?

    File components/autofill/core/browser/filling/form_filler.h
    Line 187, Patchset 3 (Latest): void RetriggerAutofillImpl(const FormData& form,
    Christoph Schwering . unresolved

    Keep `TriggerRefill()`?

    File third_party/blink/renderer/core/exported/web_form_element.cc
    Yoav Weiss (@Shopify) . unresolved

    @schw...@google.com - Added this null check, as some tests arrive here without an HTMLFormElement.

    Christoph Schwering

    It seems odd to me to have a meaningful operation on null `WebFormElement`s. Analogous with [this](https://source.chromium.org/chromium/chromium/src/+/main:components/autofill/content/renderer/form_autofill_util.cc;l=1882-1891;drc=48d6f7175422b2c969c14258f9f8d5b196c28d18), I think the null case should be handled by `WebDocument`.

    File third_party/blink/renderer/core/html/forms/autofill_event.h
    Line 35, Patchset 3 (Latest): void waitForIt(ScriptState*, ScriptPromise<IDLUndefined>);
    Christoph Schwering . unresolved

    What is "it"?

    Line 20, Patchset 3 (Latest):class AutofillEvent : public Event {
    Christoph Schwering . unresolved

    Should this be documented?

    File third_party/blink/renderer/core/html/forms/html_form_element.cc
    Line 1230, Patchset 3 (Latest): std::unordered_map<String, String> converted_form_values;
    Christoph Schwering . unresolved

    Do we really want `std::unordered_map` here? base/containers/README.md suggests it for no scenario. And we already take the `std::map` by value here; couldn't we just pass it on?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Yoav Weiss (@Shopify)
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I9a06ff81466fca7d97d06699a31fec750d15eddb
    Gerrit-Change-Number: 6965138
    Gerrit-PatchSet: 3
    Gerrit-Owner: Yoav Weiss (@Shopify) <yoav...@chromium.org>
    Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
    Gerrit-Reviewer: Yoav Weiss (@Shopify) <yoav...@chromium.org>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    Gerrit-Attention: Yoav Weiss (@Shopify) <yoav...@chromium.org>
    Gerrit-Comment-Date: Thu, 18 Sep 2025 17:27:09 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Yoav Weiss (@Shopify) <yoav...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Yoav Weiss (@Shopify) (Gerrit)

    unread,
    Sep 19, 2025, 9:01:07 AM (yesterday) Sep 19
    to Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, core-timi...@chromium.org, gcasto+w...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, milicau+watchlis...@google.com, rouslan+au...@chromium.org, speed-metrics...@chromium.org, vasilii+watchlis...@chromium.org
    Attention needed from Christoph Schwering

    Yoav Weiss (@Shopify) added 4 comments

    File components/autofill/content/common/mojom/autofill_driver.mojom
    Line 65, Patchset 3: // Retrigger an autofill after the onautofill event fired and the Promise it

    // passed to `waitForIt` was resolved.
    Christoph Schwering . unresolved

    I suspect most readers won't know what this is referring to, especially what `waitForIt` is. (At least I don't 😊.)

    Yoav Weiss (@Shopify)

    It's the function you can call inside the event, to pass a promise that tells the browser autofill can refill. I need to rename it (both here and in the proposal). This was a placeholder..

    File components/autofill/content/renderer/autofill_agent.h
    Line 572, Patchset 3: bool waiting_for_autofill_retrigger_ = false;
    Christoph Schwering . unresolved

    How many times may JS delay the autofill? Once, right?

    Yoav Weiss (@Shopify)

    Indeed

    File components/autofill/content/renderer/form_autofill_util.cc
    Line 2728, Patchset 3: WebString key = control_element.NameForAutofill();
    Yoav Weiss (@Shopify) . unresolved

    @schw...@google.com - I brought back the name here, as this is the fields that are web-exposed to developers, and they should have meaningful names.

    Christoph Schwering

    I see! There will a specification for what the keys should be, right? I think we don't guarantee stability of `NameForAutofill()` so perhaps we should implement our own fallback from `name` to `id` or vice versa, if we want such a fallback at all.

    Yoav Weiss (@Shopify)

    Yeah, we probably want to create a more thought-through mapping..

    File third_party/blink/renderer/core/html/forms/autofill_event.h
    Line 35, Patchset 3: void waitForIt(ScriptState*, ScriptPromise<IDLUndefined>);
    Christoph Schwering . unresolved

    What is "it"?

    Yoav Weiss (@Shopify)

    I'll rename this (in the proposal and code..)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Christoph Schwering
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I9a06ff81466fca7d97d06699a31fec750d15eddb
    Gerrit-Change-Number: 6965138
    Gerrit-PatchSet: 4
    Gerrit-Owner: Yoav Weiss (@Shopify) <yoav...@chromium.org>
    Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
    Gerrit-Reviewer: Yoav Weiss (@Shopify) <yoav...@chromium.org>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    Gerrit-Attention: Christoph Schwering <schw...@google.com>
    Gerrit-Comment-Date: Fri, 19 Sep 2025 13:00:52 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Yoav Weiss (@Shopify) <yoav...@chromium.org>
    Comment-In-Reply-To: Christoph Schwering <schw...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Christoph Schwering (Gerrit)

    unread,
    Sep 19, 2025, 9:42:44 AM (yesterday) Sep 19
    to Yoav Weiss (@Shopify), Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-re...@chromium.org, blink-revie...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, browser-comp...@chromium.org, core-timi...@chromium.org, gcasto+w...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, milicau+watchlis...@google.com, rouslan+au...@chromium.org, speed-metrics...@chromium.org, vasilii+watchlis...@chromium.org
    Attention needed from Yoav Weiss (@Shopify)

    Christoph Schwering added 2 comments

    File components/android_autofill/browser/android_autofill_manager.cc
    Line 304, Patchset 4 (Latest): const FormFieldData& trigger_field = form.fields()[0];
    Christoph Schwering . unresolved

    That's a security issue because the triggering field's origin matters when there are multiple frames involved.

    In `BrowserAutofillManager`, that issue is handled by the refill logic, which remembers the origin in the `RefillContex`.

    In `AndroidAutofillManager` the closest to that I know is [`current_field_`](https://source.chromium.org/chromium/chromium/src/+/main:components/android_autofill/browser/android_autofill_provider.h;l=327-333;drc=524850a07d7849a97763c3b848063d3dfdbd653d), but I guess just using `current_field_` isn't sufficent.

    File components/autofill/content/common/mojom/autofill_driver.mojom
    Line 65, Patchset 3: // Retrigger an autofill after the onautofill event fired and the Promise it
    // passed to `waitForIt` was resolved.
    Christoph Schwering . unresolved

    I suspect most readers won't know what this is referring to, especially what `waitForIt` is. (At least I don't 😊.)

    Yoav Weiss (@Shopify)

    It's the function you can call inside the event, to pass a promise that tells the browser autofill can refill. I need to rename it (both here and in the proposal). This was a placeholder..

    Christoph Schwering

    I see. I guess we should abstract from this here in the mojo documentation.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Yoav Weiss (@Shopify)
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I9a06ff81466fca7d97d06699a31fec750d15eddb
    Gerrit-Change-Number: 6965138
    Gerrit-PatchSet: 4
    Gerrit-Owner: Yoav Weiss (@Shopify) <yoav...@chromium.org>
    Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
    Gerrit-Reviewer: Yoav Weiss (@Shopify) <yoav...@chromium.org>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    Gerrit-Attention: Yoav Weiss (@Shopify) <yoav...@chromium.org>
    Gerrit-Comment-Date: Fri, 19 Sep 2025 13:42:31 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages