WebKit Bugzilla
Attachment 339845 Details for
Bug 185433
: Resign Strong Password appearance when text field value changes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch with tests
bug-185433-20180508112729.patch (text/plain), 10.87 KB, created by
Daniel Bates
on 2018-05-08 11:28:41 PDT
(
hide
)
Description:
Patch with tests
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2018-05-08 11:28:41 PDT
Size:
10.87 KB
patch
obsolete
>Subversion Revision: 231488 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index f76c1879f22c89fa6423521e6dd5026c0d14f0b8..6d1019b9fd883a8ff5cd288c671ab8eed35d0257 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2018-05-08 Daniel Bates <dabates@apple.com> >+ >+ Resign Strong Password appearance when text field value changes >+ https://bugs.webkit.org/show_bug.cgi?id=185433 >+ <rdar://problem/39958508> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove the Strong Password decoration when the text field's value changes to avoid interfering >+ with web sites that allow a person to clear the password field. >+ >+ Test: fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html >+ >+ * html/HTMLInputElement.cpp: >+ (WebCore::HTMLInputElement::resignStrongPasswordAppearance): Extracted from HTMLInputElement::updateType(). >+ (WebCore::HTMLInputElement::updateType): Extract out logic to resign the Strong Password appearance >+ into a function that can be shared by this function and HTMLInputElement::setValue(). >+ (WebCore::HTMLInputElement::setValue): Resign the Strong Password appearance if this field was >+ changed programmatically (i.e. no DOM change event was dispatched). >+ * html/HTMLInputElement.h: >+ > 2018-05-08 Sam Weinig <sam@webkit.org> > > More cleanup of XMLHttpRequestUpload >diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp >index b8e644d4661bc9f9f213193b78b1bbb244e2ccf9..397879697ac359f0ac657edc811cbc298108d025 100644 >--- a/Source/WebCore/html/HTMLInputElement.cpp >+++ b/Source/WebCore/html/HTMLInputElement.cpp >@@ -488,6 +488,16 @@ void HTMLInputElement::setType(const AtomicString& type) > setAttributeWithoutSynchronization(typeAttr, type); > } > >+void HTMLInputElement::resignStrongPasswordAppearance() >+{ >+ if (!hasAutoFillStrongPasswordButton()) >+ return; >+ setAutoFilled(false); >+ setShowAutoFillButton(AutoFillButtonType::None); >+ if (auto* page = document().page()) >+ page->chrome().client().inputElementDidResignStrongPasswordAppearance(*this); >+} >+ > void HTMLInputElement::updateType() > { > ASSERT(m_inputType); >@@ -497,13 +507,7 @@ void HTMLInputElement::updateType() > return; > > removeFromRadioButtonGroup(); >- >- if (hasAutoFillStrongPasswordButton()) { >- setAutoFilled(false); >- setShowAutoFillButton(AutoFillButtonType::None); >- if (auto* page = document().page()) >- page->chrome().client().inputElementDidResignStrongPasswordAppearance(*this); >- } >+ resignStrongPasswordAppearance(); > > bool didStoreValue = m_inputType->storesValueSeparateFromAttribute(); > bool willStoreValue = newType->storesValueSeparateFromAttribute(); >@@ -1064,6 +1068,10 @@ ExceptionOr<void> HTMLInputElement::setValue(const String& value, TextFieldEvent > setLastChangeWasNotUserEdit(); > setFormControlValueMatchesRenderer(false); > m_inputType->setValue(sanitizedValue, valueChanged, eventBehavior); >+ >+ bool wasModifiedProgrammatically = eventBehavior == DispatchNoEvent; >+ if (wasModifiedProgrammatically) >+ resignStrongPasswordAppearance(); > return { }; > } > >diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h >index 138433241fa549453f69055f1675b476a69c9465..ac1c81c7844cd3c846a6297ce3b628f02ad260c3 100644 >--- a/Source/WebCore/html/HTMLInputElement.h >+++ b/Source/WebCore/html/HTMLInputElement.h >@@ -377,6 +377,8 @@ private: > FormControlState saveFormControlState() const final; > void restoreFormControlState(const FormControlState&) final; > >+ void resignStrongPasswordAppearance(); >+ > bool canStartSelection() const final; > > void accessKeyAction(bool sendMouseEvents) final; >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 38db5e26202eec409bf197d297f81766074254be..a1dc03a143872fa1c31e3b528ce586faa1fe4abc 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,18 @@ >+2018-05-08 Daniel Bates <dabates@apple.com> >+ >+ Resign Strong Password appearance when text field value changes >+ https://bugs.webkit.org/show_bug.cgi?id=185433 >+ <rdar://problem/39958508> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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 value changes. >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm: >+ (testDidResignInputElementStrongPasswordAppearanceAfterEvaluatingJavaScript): >+ (TEST): >+ > 2018-05-08 Chris Dumez <cdumez@apple.com> > > Unreviewed, fix issue with running Speedometer PerfTest after r231450. >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm >index 386e727b981370a289ae07679b7e40755796a9dc..046ea74187b02d64ab3d6b9ddbfb60adcd970b0c 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm >@@ -574,7 +574,7 @@ - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSStrin > > @end > >-TEST(WebKit, DidResignInputElementStrongPasswordAppearance) >+static void testDidResignInputElementStrongPasswordAppearanceAfterEvaluatingJavaScript(NSString *script) > { > done = false; > WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"DidResignInputElementStrongPasswordAppearance"]; >@@ -583,10 +583,20 @@ TEST(WebKit, DidResignInputElementStrongPasswordAppearance) > auto delegate = adoptNS([[DidResignInputElementStrongPasswordAppearanceDelegate alloc] init]); > [webView setUIDelegate:delegate.get()]; > TestWebKitAPI::Util::run(&readytoResign); >- [webView evaluateJavaScript:@"document.querySelector('input').type = 'text'" completionHandler:nil]; >+ [webView evaluateJavaScript:script completionHandler:nil]; > TestWebKitAPI::Util::run(&done); > } > >+TEST(WebKit, DidResignInputElementStrongPasswordAppearanceWhenTypeDidChange) >+{ >+ testDidResignInputElementStrongPasswordAppearanceAfterEvaluatingJavaScript(@"document.querySelector('input').type = 'text'"); >+} >+ >+TEST(WebKit, DidResignInputElementStrongPasswordAppearanceWhenValueDidChange) >+{ >+ testDidResignInputElementStrongPasswordAppearanceAfterEvaluatingJavaScript(@"document.querySelector('input').value = ''"); >+} >+ > @interface AutoFillAvailableDelegate : NSObject <WKUIDelegatePrivate> > @end > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 10dc71a4d26a4f48b4e5b1e303aa52c676160b6d..8bc345ac8e5a378435295b650ec2e1f2b6d3dac2 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,19 @@ >+2018-05-08 Daniel Bates <dabates@apple.com> >+ >+ Resign Strong Password appearance when text field value changes >+ https://bugs.webkit.org/show_bug.cgi?id=185433 >+ <rdar://problem/39958508> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a test to ensure we remove the Strong Password appearance when the value of the text field value changes. >+ >+ * fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes-expected.html: Added. >+ * fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html: Added. >+ * fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js: Add support for >+ setting the autofilled state of a field. >+ (window.onload): >+ > 2018-05-08 Said Abou-Hallawa <sabouhallawa@apple.com> > > feTurbulence is not rendered correctly on Retina display >diff --git a/LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes-expected.html b/LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1657231d8ae7465e6d05539f594c8b2e786dbc31 >--- /dev/null >+++ b/LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes-expected.html >@@ -0,0 +1,8 @@ >+<!DOCTYPE html> >+<html> >+<body> >+<p>This tests that that an autofilled Strong Password or Strong Confirmation Password decorated text field reverts to its original appearance when its value changes. It can only be tested in the test tool.</p> >+<input type="password" value=""> >+<input type="password" value=""> >+</body> >+</html> >diff --git a/LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html b/LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html >new file mode 100644 >index 0000000000000000000000000000000000000000..90fb13dd05107b2687c0a247ce67da743136cec0 >--- /dev/null >+++ b/LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html >@@ -0,0 +1,28 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="resources/process-auto-fill-button-type-and-invoke-runTest.js"></script> >+<script> >+window.markFieldsAsAutoFilled = true; >+ >+if (window.testRunner) >+ testRunner.waitUntilDone(); >+ >+function runTest() >+{ >+ let inputElements = document.getElementsByTagName("input"); >+ for (let inputElement of inputElements) >+ inputElement.value = ""; >+ if (window.internals) >+ internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(); >+ if (window.testRunner) >+ testRunner.notifyDone(); >+} >+</script> >+</head> >+<body> >+<p>This tests that that an autofilled Strong Password or Strong Confirmation Password decorated text field reverts to its original appearance when its value changes. It can only be tested in the test tool.</p> >+<input type="password" value="Cupertino" data-auto-fill-button-type="StrongPassword" data-autofilled="true"> >+<input type="password" value="Cupertino" data-auto-fill-button-type="StrongConfirmationPassword" data-autofilled="true"> >+</body> >+</html> >diff --git a/LayoutTests/fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js b/LayoutTests/fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js >index 5c2ede34fb9652893b8daaaad1a8544616df1cf8..628a8570e1d5b66d00de37df820f6cd7772fd676 100644 >--- a/LayoutTests/fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js >+++ b/LayoutTests/fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js >@@ -5,8 +5,10 @@ window.onload = function () > return; > } > let inputElements = document.getElementsByTagName("input"); >- for (let inputElement of inputElements) >+ for (let inputElement of inputElements) { >+ internals.setAutofilled(inputElement, inputElement.dataset.autofilled == "true"); > internals.setShowAutoFillButton(inputElement, inputElement.dataset.autoFillButtonType); >+ } > if (window.runTest) > window.runTest(); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185433
:
339845
|
339852