Remove Strong Password decoration when text field type changes
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Apr 2018 20:45:55 +0000 (20:45 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Apr 2018 20:45:55 +0000 (20:45 +0000)
commitb9d25af0950f5493c6b7606a2d9a1a11e55abe8a
treed19bc90ee88569a7b70c15997b3388e1710b76e8
parent4838ad300ee58fb126a02cf234d3c247d62130bd
Remove Strong Password decoration when text field type changes
https://bugs.webkit.org/show_bug.cgi?id=184795
<rdar://problem/38325108>

Reviewed by Antti Koivisto.

Source/WebCore:

Remove the Strong Password decoration when the text field's type changes to avoid interfering
with web sites that allow a person to show/hide their password.

Test: fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes.html

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::updateType):

Source/WebKit:

Add injected bundle API and WebKit UI delegate SPI to notify the embedding client when the
Strong Password appearance of an HTML input element is resigned.

We add C SPI for Safari on Mac.

* UIProcess/API/APIUIClient.h:
(API::UIClient::didResignInputElementStrongPasswordAppearance):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/API/C/WKPageUIClient.h:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didResignInputElementStrongPasswordAppearance):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
(API::InjectedBundle::PageUIClient::didResignInputElementStrongPasswordAppearance):
* WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h:
* WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
(WebKit::InjectedBundlePageUIClient::didResignInputElementStrongPasswordAppearance):
* WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::inputElementDidResignStrongPasswordAppearance):
* WebProcess/WebCoreSupport/WebChromeClient.h:

Tools:

Add a unit test to ensure the injected bundle API and WebKit UI delegate SPI is invoked
when the field has the Strong Password button and its type changes.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/DidResignInputElementStrongPasswordAppearance.mm: Added.
(didResignInputElementStrongPasswordAppearance):
(-[DidResignInputElementStrongPasswordAppearance webProcessPlugIn:didCreateBrowserContextController:]):
* TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
(-[DidResignInputElementStrongPasswordAppearanceDelegate _webView:didResignInputElementStrongPasswordAppearanceWithUserInfo:]):
(-[DidResignInputElementStrongPasswordAppearanceDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
(TEST):

LayoutTests:

Add tests to ensure that we remove the Strong Password decoration when the text field's type changes.

Extract code to toggle showing the AutoFill button from fast/forms/auto-fill-button/input-{disabled, readonly}-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
into a new file fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js
that can be shared.

* fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes-expected.html: Added.
* fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes.html: Added.
* fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html:
* fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html:
* fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js: Added.
(window.onload):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
LayoutTests/fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
LayoutTests/fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/page/ChromeClient.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APIUIClient.h
Source/WebKit/UIProcess/API/C/WKPage.cpp
Source/WebKit/UIProcess/API/C/WKPageUIClient.h
Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
Source/WebKit/UIProcess/Cocoa/UIDelegate.h
Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h
Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp
Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKitCocoa/DidResignInputElementStrongPasswordAppearance.mm [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm