No server query for forms created after PageLoaded event. |
||
Issue descriptionI spent some time to investigate why some websites work on desktop and not on iOS. The two websites I checked were apple.com (and the "null" CVC field) llbean.com (and the form with multiple hdden input fields). It appears that these two websites create the forms after the PageLoaded event is sent. On desktop, on this kind of mutation of the page, a OnFormSeen event is sent. This event does not exist at the moment on iOS. Result is that on iOS, when we focus the field of one of these forms, there is a cache miss on the autofill data and an "emergency" local heuristic is used to propose autofill. But there is no server query for this form. I did some experiments on how to solve this issue and found 3 solutions: - delay the processing of the page after X milliseconds (this X will be necessarily flaky). It appears that on these two websites, the time needed is relatively short (less than half .a second) and does not affect the user experience as the page is building in this delay. But it will affect the UX on other web sites that don't need the delay if the user decides to use autofill directly. - query the server when focusing a new field, even if there is no time to use the result immediately. Advantage is that when the user moves to the next field (of if the user reselect a field), autofill will be available. (having tested that, I feel this behavior really unpredictable). - poll the page every N milliseconds and reprocess the page if something changed (draft CL in https://chromium-review.googlesource.com/c/chromium/src/+/846880). - a similar solution would be to use a DOM mutation observer to track new forms. I think this is equivalent in functionality (except that the dom mutation would be more reactive) and the choice should be done regarding the performance. My preference goes to solution 3 (or 3bis) as it is the most robust solution , and it would even solve the pages that go from billing to shipping to payment without navigation.
,
Jan 3 2018
Yes, I think that MutationObserver are supported. I can do a test to confirm that. I remember when I work on Touch to search that there were some concerns about performance of mutation observers. We will have to check this.
,
Jan 3 2018
I remember MutationObserver working in WKWebView. On Desktop, is the page reevaluated after any modification to the DOM? I think to be able to reliably detect new forms we need to observer document.body for "subtree" mutations which seems costly:
observer.observe(document.body, {subtree: true });
,
Jan 4 2018
Yes, MutationObserver work on WKWebView. But using it raise multiple issues - observing document or document.body can be costly - it will not be necessarily more reactive as we will need to add a delay to batch the update (and not rescan the whole page on each form mutation) - the only event available is addedChild. This mean that if the form is created outside of the dom, like element = <div><input/><div/> // This is not valid javascript document.body.appendChild(element); there will be no event for the input creation. This mean that we will have to scan inside all added nodes, which is even more costly. I will try to make it work for prototype.
,
Mar 20 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/faebdb6d4f0f5e6458c9092e223e53d40de12e28 commit faebdb6d4f0f5e6458c9092e223e53d40de12e28 Author: Olivier Robin <olivierrobin@chromium.org> Date: Tue Mar 20 11:41:17 2018 Track form changes on the web page. Some web sites (like apple.com or llbean.com) build forms after the page loading. This prevent using the server side type resolution. Add a tracker to update the autofill forms regularly. Bug: 798675 Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs Change-Id: Ieaaf502a7bff38756d90bd96e94c058977dcab7b Reviewed-on: https://chromium-review.googlesource.com/943321 Commit-Queue: Olivier Robin <olivierrobin@chromium.org> Reviewed-by: Dirk Pranke <dpranke@chromium.org> Reviewed-by: Sylvain Defresne <sdefresne@chromium.org> Reviewed-by: Eugene But <eugenebut@chromium.org> Reviewed-by: Moe Ahmadi <mahmadi@chromium.org> Reviewed-by: Sebastien Seguin-Gagnon <sebsg@chromium.org> Cr-Commit-Position: refs/heads/master@{#544331} [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/build/util/java_action.gni [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/components/BUILD.gn [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/components/autofill/ios/browser/autofill_agent.mm [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/components/autofill/ios/browser/js_autofill_manager.h [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/components/autofill/ios/browser/js_autofill_manager.mm [add] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/components/autofill/ios/fill/BUILD.gn [add] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/components/autofill/ios/fill/DEPS [add] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/components/autofill/ios/fill/form_unittest.mm [rename] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/components/autofill/ios/fill/resources/form.js [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/chrome/browser/passwords/BUILD.gn [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/chrome/browser/passwords/password_controller_js_unittest.mm [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/chrome/browser/web/BUILD.gn [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/chrome/browser/web/chrome_web_client.h [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/chrome/browser/web/chrome_web_client.mm [copy] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/chrome/browser/web/resources/chrome_bundle_all_frames.js [rename] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/chrome/browser/web/resources/chrome_bundle_main_frame.js [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web/BUILD.gn [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web/js_compile.gni [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web/public/test/BUILD.gn [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web/public/test/fakes/BUILD.gn [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web/public/test/web_test_with_web_state.mm [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web/public/web_client.h [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web/public/web_state/web_state_observer.h [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web/web_client.mm [delete] https://crrev.com/0e9f578b26baecd99f3a84066db6d44cd12c233f/ios/web/web_state/js/form_inttest.mm [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web/web_state/js/page_script_util.mm [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web/web_state/js/resources/all_frames_web_bundle.js [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web/web_state/ui/crw_web_controller.mm [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web_view/BUILD.gn [modify] https://crrev.com/faebdb6d4f0f5e6458c9092e223e53d40de12e28/ios/web_view/resources/web_view_bundle.js
,
Mar 21 2018
,
Apr 5 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/b245d69b638b18b829172f50a00875bcb381b80b commit b245d69b638b18b829172f50a00875bcb381b80b Author: Vadym Doroshenko <dvadym@chromium.org> Date: Thu Apr 05 16:37:12 2018 Ignore form_changed message in FormInputAccessoryViewController. On CL https://chromium-review.googlesource.com/c/chromium/src/+/943321 it was implemented JS message of type "form_changed", which is called when dynamically added form is found. This message shouldn't initiate showing autofill input accessories, because input accessories has to be shown only on user action. Bug: 708597 , 798675 Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs Change-Id: Ib4d687ab2c7b344ec8f448ebef5025e7b68c3883 Reviewed-on: https://chromium-review.googlesource.com/997840 Reviewed-by: Olivier Robin <olivierrobin@chromium.org> Reviewed-by: Moe Ahmadi <mahmadi@chromium.org> Commit-Queue: Vadym Doroshenko <dvadym@chromium.org> Cr-Commit-Position: refs/heads/master@{#548449} [modify] https://crrev.com/b245d69b638b18b829172f50a00875bcb381b80b/ios/chrome/browser/autofill/form_input_accessory_view_controller.mm |
||
►
Sign in to add a comment |
||
Comment 1 by ma...@chromium.org
, Jan 3 2018