Bug 185433 - Resign Strong Password appearance when text field value changes
Summary: Resign Strong Password appearance when text field value changes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
Depends on:
Blocks: 185440
  Show dependency treegraph
 
Reported: 2018-05-08 11:13 PDT by Daniel Bates
Modified: 2018-05-08 16:16 PDT (History)
6 users (show)

See Also:


Attachments
Patch with tests (10.87 KB, patch)
2018-05-08 11:28 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch and tests (10.94 KB, patch)
2018-05-08 11:59 PDT, Daniel Bates
rniwa: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2018-05-08 11:13:39 PDT
Similar to bug #184795, we should resign the Strong Password appearance when the value of the text field changes.
Comment 1 Daniel Bates 2018-05-08 11:14:18 PDT
<rdar://problem/39958508>
Comment 2 Daniel Bates 2018-05-08 11:28:41 PDT
Created attachment 339845 [details]
Patch with tests
Comment 3 Daniel Bates 2018-05-08 11:59:42 PDT
Created attachment 339852 [details]
Patch and tests

Updated testDidResignInputElementStrongPasswordAppearanceAfterEvaluatingJavaScript() in Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm to reset the readytoResign flag each time it is invoked so that we one test run does not interfere with another.
Comment 4 Ryosuke Niwa 2018-05-08 14:21:27 PDT
Comment on attachment 339852 [details]
Patch and tests

View in context: https://bugs.webkit.org/attachment.cgi?id=339852&action=review

r=me if test cases for calling reset() and setting a smaller maxlength are added.

> LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html:6
> +window.markFieldsAsAutoFilled = true;

I'm not saying we have to change the test harness in this patch but it's not great that the helper script relies on a global variable like this.

> LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html:14
> +    for (let inputElement of inputElements)

Use const?

> LayoutTests/fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js:8
> +    for (let inputElement of inputElements) {

Use const?
Comment 5 Daniel Bates 2018-05-08 16:07:09 PDT
(In reply to Ryosuke Niwa from comment #4)
> Comment on attachment 339852 [details]
> Patch and tests
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=339852&action=review
> 
> r=me if test cases for calling reset() and setting a smaller maxlength are
> added.
> 

Will add tests for setting a smaller maxlength as well as a larger minlength. Note that in either case we do not modify the value of a text field.

Bug #185440 will add tests for Form.reset().

> > LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html:6
> > +window.markFieldsAsAutoFilled = true;
> 
> I'm not saying we have to change the test harness in this patch but it's not
> great that the helper script relies on a global variable like this.
> 

This line is unnecessary and we do not make use of window.markFieldsAsAutoFilled in this patch.

For completeness, an earlier iteration of this patch used this global to mark all text fields as autofilled.

> > LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html:14
> > +    for (let inputElement of inputElements)
> 
> Use const?
> 

I am not going to make this change because we are modifying inputElement's state below.  Making inputElement const and mutating its state would be equivalent in C++ to calling setter on a const object. And we typically do not have such const setters in C++. I do not see the benefit of doing something different for JavaScript.

> > LayoutTests/fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js:8
> > +    for (let inputElement of inputElements) {
> 
> Use const?

Ditto.
Comment 6 Daniel Bates 2018-05-08 16:16:46 PDT
Committed r231517: <https://trac.webkit.org/changeset/231517>