Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use upstream AutofillDriverFactory diffs #31676

Merged
merged 4 commits into from Nov 3, 2021

Conversation

ckerr
Copy link
Member

@ckerr ckerr commented Nov 2, 2021

Update our AutofillDriver and AutofillDriverFactory code to match upstream.

This was prompted by an upstream change that removes API that we were using. Specifically, #31555 includes https://chromium-review.googlesource.com/c/chromium/src/+/3241451 removes the getAllFrames() API that our AutofillDriverFactory uses.

Our code appears to be derived from components/autofill/content/browser/content_autfill_driver*[cc,h], whose identical use of getAllFrames() removed in 2019 by https://chromium-review.googlesource.com/c/chromium/src/+/1826885. In that change, the upstream factory was changed to create and bind the autofill drivers on command. This PR tries to follow that approach in our derived factory, copying the relevant upstream code from our current roll (97.0.4689.0).

This is a medium-sized refactor, so I've split it out into its own PR (a) to make CI / manual testing possible (since this isn't the only break in the Chromium roll) and (b) for easier code review.

Looks like these files haven't been changed in a substantial way in awhile, so CC'ing @brenca who did the last major work on them, but review welcome from anyone including @electron/wg-upgrades

Notes: none.

Experimental PR related to upgrades.

Specifically, #31555 includes
https://chromium-review.googlesource.com/c/chromium/src/+/3241451 which
removes the getAllFrames() API that our AutofillDriverFactory uses.

Upstream had similar getAllFrames() calls and removed them in 2019 with
https://chromium-review.googlesource.com/c/chromium/src/+/1826885 which
lazy-creates the autofill drivers instead of doing it (indirectly) in
the factory's constructor.

This PR tries to do the same. This also changes the AutofillDriver class
to remove its `receiver_` param; however, it was private and unused so
it's possibly OK to remove.

The changes here are wrapped in #ifdefs & have // TESTING markers since
this is experimental to see if this plays nicely with CI autofill tests.
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Nov 2, 2021
@ckerr ckerr marked this pull request as draft November 2, 2021 17:12
@ckerr ckerr requested a review from a team November 2, 2021 21:29
@ckerr ckerr marked this pull request as ready for review November 2, 2021 22:14
Copy link
Member Author

@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only changes from upstream are naming / namespaces to match Electron.

For example the edge case described & addressed in DriverForFrame() is copied from upstream

@ckerr ckerr added the semver/minor backwards-compatible functionality label Nov 2, 2021
@ckerr ckerr added semver/patch backwards-compatible bug fixes and removed semver/minor backwards-compatible functionality labels Nov 2, 2021
Copy link
Member

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reuse //components/autofill rather than maintaining a copy as follow-up ?

@ckerr
Copy link
Member Author

ckerr commented Nov 3, 2021

Can we reuse //components/autofill rather than maintaining a copy as follow-up?

...maybe? Looking through the two codebases with that goal in mind, it's not clear to me how much work that would take. I will take that task on as a follow-up and merge this in the interim, since right now my main goal is to move the roll forward.

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Nov 3, 2021
@ckerr ckerr merged commit 190dd31 into main Nov 3, 2021
@ckerr ckerr deleted the refactor/sync-autofill-driver-creation-with-upstream branch November 3, 2021 17:17
@release-clerk
Copy link

release-clerk bot commented Nov 3, 2021

No Release Notes

ckerr added a commit that referenced this pull request Nov 3, 2021
* refactor: use upstream AutofillDriverFactory diffs

Update our copy of AutofillDriver and AutofillDriverFactory to match chromium.
t57ser pushed a commit to t57ser/electron that referenced this pull request Jan 25, 2022
* refactor: use upstream AutofillDriverFactory diffs

Update our copy of AutofillDriver and AutofillDriverFactory to match chromium.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants