|
|
Created:
6 years, 3 months ago by Deepak Modified:
6 years, 3 months ago CC:
chromium-reviews, benquan, browser-components-watch_chromium.org, jam, darin-cc_chromium.org, Dane Wallinga, dyu1, rouslan+autofillwatch_chromium.org, estade+watch_chromium.org, gcasto+watchlist_chromium.org, Ilya Sherman, mkwst+watchlist_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@master Project:
chromium Visibility:
Public. |
DescriptionRefactoring PasswordAutofillAgent::FillUserNameAndPassword for early return if password_element is not autocompleteable.
PasswordAutofillAgent::FillUserNameAndPassword function refactor done for early return as we chould check this at start only.
BUG=398436
Committed: https://crrev.com/2e88712e567b53efd941e87ef2b04fc60a8bce03
Cr-Commit-Position: refs/heads/master@{#295653}
Patch Set 1 #
Total comments: 5
Patch Set 2 : Changes as per reviewers comments and discussion. #Messages
Total messages: 29 (5 generated)
deepak.m1@samsung.com changed reviewers: + gcasto@chromium.org, isherman@chromium.org, vabr@chromium.org
Refactoring changes done. @PTAL
On 2014/09/09 08:39:06, deepak.m1 wrote: > Refactoring changes done. > @PTAL @vabr PTAL of my changes.
Hi deepak.m1, First, sorry for the delay, I was on holiday last week. Second, there seems to be a misunderstanding. There is no problem in calling IsElementsAutocompletable each time for each input field (it is, in fact, better than having yet another function to do the job). What I meant on the bug was to eliminate situations when IsElementsAutocompletable is called, then the data is passed to somewhere else, and IsElementsAutocompletable is called on that data at the destination again. I'm no longer sure where I saw that, but it did happen somewhere. Cheers, Vaclav
On 2014/09/15 14:39:54, vabr (Chromium) wrote: > Hi deepak.m1, > > First, sorry for the delay, I was on holiday last week. > > Second, there seems to be a misunderstanding. There is no problem in calling > IsElementsAutocompletable each time for each input field (it is, in fact, better > than having yet another function to do the job). > > What I meant on the bug was to eliminate situations when > IsElementsAutocompletable is called, then the data is passed to somewhere else, > and IsElementsAutocompletable is called on that data at the destination again. > > I'm no longer sure where I saw that, but it did happen somewhere. > > Cheers, > Vaclav so apart from IsElementsAutocompletable(), changes in PasswordAutofillAgent::FillUserNameAndPassword() is ok. I found 2 times check in PasswordAutofillAgent::FillFormOnPasswordRecieved() we are checking // If we can't modify the password, don't try to set the username if (!IsElementAutocompletable(password_element)) return; and then we are checking password_element again in bool PasswordAutofillAgent::FillUserNameAndPassword(). So we can remove the check from PasswordAutofillAgent::FillFormOnPasswordRecieved(). I have not found duplication of IsElementsAutocompletable() at any other place. Please let me know your opinion, so that I will remove IsElementsAutocompletable() changes from earlier patch and remove check from PasswordAutofillAgent::FillFormOnPasswordRecieved() function. Thanks
On 2014/09/15 15:00:32, deepak.m1 wrote: > On 2014/09/15 14:39:54, vabr (Chromium) wrote: > > Hi deepak.m1, > > > > First, sorry for the delay, I was on holiday last week. > > > > Second, there seems to be a misunderstanding. There is no problem in calling > > IsElementsAutocompletable each time for each input field (it is, in fact, > better > > than having yet another function to do the job). > > > > What I meant on the bug was to eliminate situations when > > IsElementsAutocompletable is called, then the data is passed to somewhere > else, > > and IsElementsAutocompletable is called on that data at the destination again. > > > > I'm no longer sure where I saw that, but it did happen somewhere. > > > > Cheers, > > Vaclav > > so apart from IsElementsAutocompletable(), changes in > PasswordAutofillAgent::FillUserNameAndPassword() is ok. > I found 2 times check in > PasswordAutofillAgent::FillFormOnPasswordRecieved() > we are checking > > // If we can't modify the password, don't try to set the username > if (!IsElementAutocompletable(password_element)) > return; > > and then we are checking password_element again in bool > PasswordAutofillAgent::FillUserNameAndPassword(). > So we can remove the check from > PasswordAutofillAgent::FillFormOnPasswordRecieved(). > I have not found duplication of IsElementsAutocompletable() at any other place. > > Please let me know your opinion, so that I will remove > IsElementsAutocompletable() changes from earlier patch and remove check from > PasswordAutofillAgent::FillFormOnPasswordRecieved() function. > > Thanks One more thing I feel we should shift : // Don't fill username if password can't be set. if (!IsElementAutocompletable(*password_element)) { return false; } code in bool PasswordAutofillAgent::FillUserNameAndPassword() to start of the function that will help in early return.
On 2014/09/15 15:09:23, deepak.m1 wrote: > On 2014/09/15 15:00:32, deepak.m1 wrote: > > On 2014/09/15 14:39:54, vabr (Chromium) wrote: > > > Hi deepak.m1, > > > > > > First, sorry for the delay, I was on holiday last week. > > > > > > Second, there seems to be a misunderstanding. There is no problem in calling > > > IsElementsAutocompletable each time for each input field (it is, in fact, > > better > > > than having yet another function to do the job). > > > > > > What I meant on the bug was to eliminate situations when > > > IsElementsAutocompletable is called, then the data is passed to somewhere > > else, > > > and IsElementsAutocompletable is called on that data at the destination > again. > > > > > > I'm no longer sure where I saw that, but it did happen somewhere. > > > > > > Cheers, > > > Vaclav > > > > so apart from IsElementsAutocompletable(), changes in > > PasswordAutofillAgent::FillUserNameAndPassword() is ok. > > I found 2 times check in > > PasswordAutofillAgent::FillFormOnPasswordRecieved() > > we are checking > > > > // If we can't modify the password, don't try to set the username > > if (!IsElementAutocompletable(password_element)) > > return; > > > > and then we are checking password_element again in bool > > PasswordAutofillAgent::FillUserNameAndPassword(). > > So we can remove the check from > > PasswordAutofillAgent::FillFormOnPasswordRecieved(). > > I have not found duplication of IsElementsAutocompletable() at any other > place. > > > > Please let me know your opinion, so that I will remove > > IsElementsAutocompletable() changes from earlier patch and remove check from > > PasswordAutofillAgent::FillFormOnPasswordRecieved() function. > > > > Thanks > One more thing I feel we should shift : // Don't fill username if password can't be set. if (!IsElementAutocompletable(*password_element)) { return false; } code in bool PasswordAutofillAgent::FillUserNameAndPassword() to start of the function that will help in early return. @vabr PTAL
Checking IsElementAutocompletable(password_element) in FillFormOnPasswordRecieved is necessary to avoid username element value just below, so don't remove that. Also, don't remove IsElementAutocompletable(*password_element) from FillUserNameAndPassword, because FillUserNameAndPassword has more callsites than just FillFormOnPasswordRecieved. Cheers, Vaclav https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... File components/autofill/content/renderer/password_autofill_agent.cc (right): https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... components/autofill/content/renderer/password_autofill_agent.cc:975: if (!IsElementAutocompletable(*password_element)) Since you asked explicitly: yes, moving this check up seems OK. https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... components/autofill/content/renderer/password_autofill_agent.cc:1028: void PasswordAutofillAgent::CheckLoginCollectionForMatch( Why separating the code into the two functions here, when it is only called at one place? I suggest reverting back to inlining in this case.
On 2014/09/18 09:14:24, vabr (Chromium) wrote: > Checking IsElementAutocompletable(password_element) in > FillFormOnPasswordRecieved is necessary to avoid username element value just > below, so don't remove that. > Also, don't remove IsElementAutocompletable(*password_element) from > FillUserNameAndPassword, because FillUserNameAndPassword has more callsites than > just FillFormOnPasswordRecieved. > > Cheers, > Vaclav > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > File components/autofill/content/renderer/password_autofill_agent.cc (right): > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > components/autofill/content/renderer/password_autofill_agent.cc:975: if > (!IsElementAutocompletable(*password_element)) > Since you asked explicitly: yes, moving this check up seems OK. > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > components/autofill/content/renderer/password_autofill_agent.cc:1028: void > PasswordAutofillAgent::CheckLoginCollectionForMatch( > Why separating the code into the two functions here, when it is only called at > one place? I suggest reverting back to inlining in this case. I understood. Just one more query , is it ok that we reduce 2 time calling of the same function i.e IsElementAutocompletable() to IsElementsAutocompletable() as I am achieving same behavior ~A+~B equals ~(AB). and is less cluttered.
https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... File components/autofill/content/renderer/password_autofill_agent.cc (right): https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... components/autofill/content/renderer/password_autofill_agent.cc:975: if (!IsElementAutocompletable(*password_element)) On 2014/09/18 09:14:24, vabr (Chromium) wrote: > Since you asked explicitly: yes, moving this check up seems OK. Thanks. https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... components/autofill/content/renderer/password_autofill_agent.cc:1028: void PasswordAutofillAgent::CheckLoginCollectionForMatch( On 2014/09/18 09:14:24, vabr (Chromium) wrote: > Why separating the code into the two functions here, when it is only called at > one place? I suggest reverting back to inlining in this case. ok, I will make this again inline as earlier.
On 2014/09/18 09:35:13, deepak.m1 wrote: > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > File components/autofill/content/renderer/password_autofill_agent.cc (right): > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > components/autofill/content/renderer/password_autofill_agent.cc:975: if > (!IsElementAutocompletable(*password_element)) > On 2014/09/18 09:14:24, vabr (Chromium) wrote: > > Since you asked explicitly: yes, moving this check up seems OK. > > Thanks. > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > components/autofill/content/renderer/password_autofill_agent.cc:1028: void > PasswordAutofillAgent::CheckLoginCollectionForMatch( > On 2014/09/18 09:14:24, vabr (Chromium) wrote: > > Why separating the code into the two functions here, when it is only called at > > one place? I suggest reverting back to inlining in this case. > > ok, I will make this again inline as earlier. I understood. Just one more query , is it ok that we reduce 2 time calling of the same function i.e IsElementAutocompletable() to IsElementsAutocompletable() as I am achieving same behavior ~A+~B equals ~(AB). and is less cluttered.
On 2014/09/18 09:35:42, deepak.m1 wrote: > On 2014/09/18 09:35:13, deepak.m1 wrote: > > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > > File components/autofill/content/renderer/password_autofill_agent.cc (right): > > > > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > > components/autofill/content/renderer/password_autofill_agent.cc:975: if > > (!IsElementAutocompletable(*password_element)) > > On 2014/09/18 09:14:24, vabr (Chromium) wrote: > > > Since you asked explicitly: yes, moving this check up seems OK. > > > > Thanks. > > > > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > > components/autofill/content/renderer/password_autofill_agent.cc:1028: void > > PasswordAutofillAgent::CheckLoginCollectionForMatch( > > On 2014/09/18 09:14:24, vabr (Chromium) wrote: > > > Why separating the code into the two functions here, when it is only called > at > > > one place? I suggest reverting back to inlining in this case. > > > > ok, I will make this again inline as earlier. > > I understood. Just one more query , is it ok that we reduce 2 time calling of > the same function i.e IsElementAutocompletable() to IsElementsAutocompletable() > as I am achieving same behavior ~A+~B equals ~(AB). and is less cluttered. Hi deepak.m1, Actually, I prefer not to create the new IsElementAutocompletable: You need the one-argument version of IsElementAutocompletable anyway, see, e.g., line 1004 in password_autofill_agent.cc of patch set 1, so having a version for two arguments means adding a new function, as you do in patch set 1. Now, currently a human reader of the code only has to read the single definition of IsElementAutocompletable, and understands all the code. With your patch set, there are two functions to read, so in my opinion there is actually more clutter. I don't understand what you mean by "~A+~B equals ~(AB)". Thank you. Vaclav
On 2014/09/18 10:04:17, vabr (Chromium) wrote: > On 2014/09/18 09:35:42, deepak.m1 wrote: > > On 2014/09/18 09:35:13, deepak.m1 wrote: > > > > > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > > > File components/autofill/content/renderer/password_autofill_agent.cc > (right): > > > > > > > > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > > > components/autofill/content/renderer/password_autofill_agent.cc:975: if > > > (!IsElementAutocompletable(*password_element)) > > > On 2014/09/18 09:14:24, vabr (Chromium) wrote: > > > > Since you asked explicitly: yes, moving this check up seems OK. > > > > > > Thanks. > > > > > > > > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > > > components/autofill/content/renderer/password_autofill_agent.cc:1028: void > > > PasswordAutofillAgent::CheckLoginCollectionForMatch( > > > On 2014/09/18 09:14:24, vabr (Chromium) wrote: > > > > Why separating the code into the two functions here, when it is only > called > > at > > > > one place? I suggest reverting back to inlining in this case. > > > > > > ok, I will make this again inline as earlier. > > > > I understood. Just one more query , is it ok that we reduce 2 time calling of > > the same function i.e IsElementAutocompletable() to > IsElementsAutocompletable() > > as I am achieving same behavior ~A+~B equals ~(AB). and is less cluttered. > > Hi deepak.m1, > > Actually, I prefer not to create the new IsElementAutocompletable: > You need the one-argument version of IsElementAutocompletable anyway, see, e.g., > line 1004 in password_autofill_agent.cc of patch set 1, so having a version for > two arguments means adding a new function, as you do in patch set 1. > Now, currently a human reader of the code only has to read the single definition > of IsElementAutocompletable, and understands all the code. > With your patch set, there are two functions to read, so in my opinion there is > actually more clutter. > I don't understand what you mean by "~A+~B equals ~(AB)". > > Thank you. > Vaclav ok. I agree. IsElementAutocompletable() is for a single element. IsElementsAutocompletable() is for 2 elements. ~A+~B equals ~(AB) means !fun(X) || !fun(Y) == !(fun(X) && fun(Y)).
mkwst@chromium.org changed reviewers: + mkwst@chromium.org
One grammar nit, having read none of the code. :) https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... File components/autofill/content/renderer/password_autofill_agent.cc (right): https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... components/autofill/content/renderer/password_autofill_agent.cc:197: bool IsElementsAutocompletable(const blink::WebInputElement& element1, Nit: _Are_ElementsAutocompletable.
On 2014/09/18 10:25:15, Mike West wrote: > One grammar nit, having read none of the code. :) > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > File components/autofill/content/renderer/password_autofill_agent.cc (right): > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > components/autofill/content/renderer/password_autofill_agent.cc:197: bool > IsElementsAutocompletable(const blink::WebInputElement& element1, > Nit: _Are_ElementsAutocompletable. Correct, although I hope that that function will be removed. :)
On 2014/09/18 10:24:04, deepak.m1 wrote: > On 2014/09/18 10:04:17, vabr (Chromium) wrote: > > On 2014/09/18 09:35:42, deepak.m1 wrote: > > > On 2014/09/18 09:35:13, deepak.m1 wrote: > > > > > > > > > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > > > > File components/autofill/content/renderer/password_autofill_agent.cc > > (right): > > > > > > > > > > > > > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > > > > components/autofill/content/renderer/password_autofill_agent.cc:975: if > > > > (!IsElementAutocompletable(*password_element)) > > > > On 2014/09/18 09:14:24, vabr (Chromium) wrote: > > > > > Since you asked explicitly: yes, moving this check up seems OK. > > > > > > > > Thanks. > > > > > > > > > > > > > > https://codereview.chromium.org/557703002/diff/1/components/autofill/content/... > > > > components/autofill/content/renderer/password_autofill_agent.cc:1028: void > > > > PasswordAutofillAgent::CheckLoginCollectionForMatch( > > > > On 2014/09/18 09:14:24, vabr (Chromium) wrote: > > > > > Why separating the code into the two functions here, when it is only > > called > > > at > > > > > one place? I suggest reverting back to inlining in this case. > > > > > > > > ok, I will make this again inline as earlier. > > > > > > I understood. Just one more query , is it ok that we reduce 2 time calling > of > > > the same function i.e IsElementAutocompletable() to > > IsElementsAutocompletable() > > > as I am achieving same behavior ~A+~B equals ~(AB). and is less cluttered. > > > > Hi deepak.m1, > > > > Actually, I prefer not to create the new IsElementAutocompletable: > > You need the one-argument version of IsElementAutocompletable anyway, see, > e.g., > > line 1004 in password_autofill_agent.cc of patch set 1, so having a version > for > > two arguments means adding a new function, as you do in patch set 1. > > Now, currently a human reader of the code only has to read the single > definition > > of IsElementAutocompletable, and understands all the code. > > With your patch set, there are two functions to read, so in my opinion there > is > > actually more clutter. > > I don't understand what you mean by "~A+~B equals ~(AB)". > > > > Thank you. > > Vaclav > > ok. I agree. > IsElementAutocompletable() is for a single element. > IsElementsAutocompletable() is for 2 elements. > > ~A+~B equals ~(AB) means > > !fun(X) || !fun(Y) == !(fun(X) && fun(Y)). Ah, thanks. Now I understand. But I still prefer having just IsElementAutocompletable and calling it for every element separately, as explained above. Thanks you for your work on this! Vaclav
I understand that we will get more flexiblity by checking username and password's seprately. Thanks a lot for your time & guidance, Done changes as discussd with vabr. PTAL.
Thank you, LGTM! But please before landing this CL, update the title and description. Thank you, Vaclav
The CQ bit was checked by gcasto@chromium.org
lgtm
On 2014/09/18 12:15:02, vabr (Chromium) wrote: > Thank you, LGTM! > > But please before landing this CL, update the title and description. > > Thank you, > Vaclav Thanks, Title and Desscription updated.
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/557703002/20001
The CQ bit was unchecked by commit-bot@chromium.org
Exceeded time limit waiting for builds to trigger.
The CQ bit was checked by deepak.m1@samsung.com
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/557703002/20001
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as c210da5441fab3b87cd01dc138057f8d860f506e
Message was sent while issue was closed.
Patchset 2 (id:??) landed as https://crrev.com/2e88712e567b53efd941e87ef2b04fc60a8bce03 Cr-Commit-Position: refs/heads/master@{#295653} |