Title: [230851] trunk
Revision
230851
Author
dba...@webkit.org
Date
2018-04-20 13:45:55 -0700 (Fri, 20 Apr 2018)

Log Message

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):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (230850 => 230851)


--- trunk/LayoutTests/ChangeLog	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/LayoutTests/ChangeLog	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,3 +1,24 @@
+2018-04-20  Daniel Bates  <daba...@apple.com>
+
+        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.
+
+        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):
+
 2018-04-20  Chris Nardi  <cna...@chromium.org>
 
         Omit default value when serializing font-feature-settings

Added: trunk/LayoutTests/fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes-expected.html (0 => 230851)


--- trunk/LayoutTests/fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes-expected.html	2018-04-20 20:45:55 UTC (rev 230851)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests that a text field decorated as a Strong Password or Strong Confirmation Password field revert to a normal text field when the type of the text field changes. It can only be tested in the test tool.</p>
+<input type="text" value="Cupertino">
+<input type="text" value="Cupertino">
+</body>
+</html>

Added: trunk/LayoutTests/fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes.html (0 => 230851)


--- trunk/LayoutTests/fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes.html	2018-04-20 20:45:55 UTC (rev 230851)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+function runTest()
+{
+    let inputElements = document.getElementsByTagName("input");
+    for (let inputElement of inputElements)
+        inputElement.type = "text";
+    if (window.internals)
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+</script>
+</head>
+<body>
+<p>This tests that a text field decorated as a Strong Password or Strong Confirmation Password field revert to a normal text field when the type of the text field changes. It can only be tested in the test tool.</p>
+<input type="password" value="Cupertino" data-auto-fill-button-type="StrongPassword">
+<input type="password" value="Cupertino" data-auto-fill-button-type="StrongConfirmationPassword">
+</body>
+</html>

Modified: trunk/LayoutTests/fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html (230850 => 230851)


--- trunk/LayoutTests/fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,15 +1,11 @@
 <!DOCTYPE html>
 <html>
+<head>
+<script src=""
+</head>
 <body>
 <p>This tests that the Strong Password and Strong Confirmation Password AutoFill buttons do not render in a disabled field. It can only be tested in the test tool.</p>
 <input type="password" placeholder="disabled" disabled data-auto-fill-button-type="StrongPassword">
 <input type="password" placeholder="disabled" disabled data-auto-fill-button-type="StrongConfirmationPassword">
-<script>
-if (window.internals) {
-    var inputElements = document.getElementsByTagName("input");
-    for (let inputElement of inputElements)
-        internals.setShowAutoFillButton(inputElement, inputElement.dataset.autoFillButtonType);
-}
-</script>
 </body>
 </html>

Modified: trunk/LayoutTests/fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html (230850 => 230851)


--- trunk/LayoutTests/fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,15 +1,11 @@
 <!DOCTYPE html>
 <html>
+<head>
+<script src=""
+</head>
 <body>
 <p>This tests that the Strong Password and Strong Confirmation Password AutoFill buttons do not render read only field. It can only be tested in the test tool.</p>
 <input type="password" placeholder="read only" readonly data-auto-fill-button-type="StrongPassword">
 <input type="password" placeholder="read only" readonly data-auto-fill-button-type="StrongConfirmationPassword">
-<script>
-if (window.internals) {
-    var inputElements = document.getElementsByTagName("input");
-    for (let inputElement of inputElements)
-        internals.setShowAutoFillButton(inputElement, inputElement.dataset.autoFillButtonType);
-}
-</script>
 </body>
 </html>

Added: trunk/LayoutTests/fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js (0 => 230851)


--- trunk/LayoutTests/fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/resources/process-auto-fill-button-type-and-invoke-runTest.js	2018-04-20 20:45:55 UTC (rev 230851)
@@ -0,0 +1,12 @@
+window._onload_ = function ()
+{
+    if (!window.internals) {
+        console.log("This test must be run in DumpRenderTree or WebKitTestRunner.");
+        return;
+    }
+    let inputElements = document.getElementsByTagName("input");
+    for (let inputElement of inputElements)
+        internals.setShowAutoFillButton(inputElement, inputElement.dataset.autoFillButtonType);
+    if (window.runTest)
+        window.runTest();
+}

Modified: trunk/Source/WebCore/ChangeLog (230850 => 230851)


--- trunk/Source/WebCore/ChangeLog	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebCore/ChangeLog	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,3 +1,19 @@
+2018-04-20  Daniel Bates  <daba...@apple.com>
+
+        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.
+
+        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):
+
 2018-04-20  Javier Fernandez  <jfernan...@igalia.com>
 
         Update Alignment shorthands to the spec now that they are not ambiguous

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (230850 => 230851)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2018-04-20 20:45:55 UTC (rev 230851)
@@ -2,7 +2,7 @@
  * Copyright (C) 1999 Lars Knoll (kn...@kde.org)
  *           (C) 1999 Antti Koivisto (koivi...@kde.org)
  *           (C) 2001 Dirk Mueller (muel...@kde.org)
- * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved.
  *           (C) 2006 Alexey Proskuryakov (a...@nypop.com)
  * Copyright (C) 2007 Samuel Weinig (s...@webkit.org)
  * Copyright (C) 2010 Google Inc. All rights reserved.
@@ -34,6 +34,8 @@
 #include "CSSGradientValue.h"
 #include "CSSPropertyNames.h"
 #include "CSSValuePool.h"
+#include "Chrome.h"
+#include "ChromeClient.h"
 #include "DateTimeChooser.h"
 #include "Document.h"
 #include "Editor.h"
@@ -53,6 +55,7 @@
 #include "KeyboardEvent.h"
 #include "LocalizedStrings.h"
 #include "MouseEvent.h"
+#include "Page.h"
 #include "PlatformMouseEvent.h"
 #include "RenderTextControlSingleLine.h"
 #include "RenderTheme.h"
@@ -493,6 +496,13 @@
 
     removeFromRadioButtonGroup();
 
+    if (hasAutoFillStrongPasswordButton()) {
+        setAutoFilled(false);
+        setShowAutoFillButton(AutoFillButtonType::None);
+        if (auto* page = document().page())
+            page->chrome().client().inputElementDidResignStrongPasswordAppearance(*this);
+    }
+
     bool didStoreValue = m_inputType->storesValueSeparateFromAttribute();
     bool willStoreValue = newType->storesValueSeparateFromAttribute();
     bool neededSuspensionCallback = needsSuspensionCallback();

Modified: trunk/Source/WebCore/page/ChromeClient.h (230850 => 230851)


--- trunk/Source/WebCore/page/ChromeClient.h	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebCore/page/ChromeClient.h	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2017 Apple, Inc. All rights reserved.
+ * Copyright (C) 2006-2018 Apple, Inc. All rights reserved.
  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  * Copyright (C) 2012 Samsung Electronics. All rights reserved.
  *
@@ -447,6 +447,8 @@
 
     virtual void handleAutoFillButtonClick(HTMLInputElement&) { }
 
+    virtual void inputElementDidResignStrongPasswordAppearance(HTMLInputElement&) { };
+
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     virtual void addPlaybackTargetPickerClient(uint64_t /*contextId*/) { }
     virtual void removePlaybackTargetPickerClient(uint64_t /*contextId*/) { }

Modified: trunk/Source/WebKit/ChangeLog (230850 => 230851)


--- trunk/Source/WebKit/ChangeLog	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/ChangeLog	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,3 +1,40 @@
+2018-04-20  Daniel Bates  <daba...@apple.com>
+
+        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.
+
+        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:
+
 2018-04-20  Megan Gardner  <megan_gard...@apple.com>
 
         Fixes for failing tests associated with switching Text Selection Assistants

Modified: trunk/Source/WebKit/UIProcess/API/APIUIClient.h (230850 => 230851)


--- trunk/Source/WebKit/UIProcess/API/APIUIClient.h	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/UIProcess/API/APIUIClient.h	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -170,6 +170,8 @@
 
     virtual void didClickAutoFillButton(WebKit::WebPageProxy&, Object*) { }
 
+    virtual void didResignInputElementStrongPasswordAppearance(WebKit::WebPageProxy&, Object*) { }
+
     virtual void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&) { }
 
     virtual void didExceedBackgroundResourceLimitWhileInForeground(WebKit::WebPageProxy&, WKResourceLimit) { }

Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (230850 => 230851)


--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2015-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -110,7 +110,7 @@
 };
 
 template<> struct ClientTraits<WKPageUIClientBase> {
-    typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5, WKPageUIClientV6, WKPageUIClientV7, WKPageUIClientV8, WKPageUIClientV9, WKPageUIClientV10> Versions;
+    typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5, WKPageUIClientV6, WKPageUIClientV7, WKPageUIClientV8, WKPageUIClientV9, WKPageUIClientV10, WKPageUIClientV11> Versions;
 };
 
 #if ENABLE(CONTEXT_MENUS)
@@ -2067,6 +2067,14 @@
             m_client.didClickAutoFillButton(toAPI(&page), toAPI(userInfo), m_client.base.clientInfo);
         }
 
+        void didResignInputElementStrongPasswordAppearance(WebPageProxy& page, API::Object* userInfo) final
+        {
+            if (!m_client.didResignInputElementStrongPasswordAppearance)
+                return;
+
+            m_client.didResignInputElementStrongPasswordAppearance(toAPI(&page), toAPI(userInfo), m_client.base.clientInfo);
+        }
+
 #if ENABLE(MEDIA_SESSION)
         void mediaSessionMetadataDidChange(WebPageProxy& page, WebMediaSessionMetadata* metadata) final
         {

Modified: trunk/Source/WebKit/UIProcess/API/C/WKPageUIClient.h (230850 => 230851)


--- trunk/Source/WebKit/UIProcess/API/C/WKPageUIClient.h	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPageUIClient.h	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -127,6 +127,7 @@
 typedef void (*WKDidLosePointerLockCallback)(WKPageRef page, const void* clientInfo);
 typedef void (*WKHasVideoInPictureInPictureDidChangeCallback)(WKPageRef page, bool hasVideoInPictureInPicture, const void* clientInfo);
 typedef void (*WKDidExceedBackgroundResourceLimitWhileInForegroundCallback)(WKPageRef page, WKResourceLimit limit, const void* clientInfo);
+typedef void (*WKPageDidResignInputElementStrongPasswordAppearanceCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo);
 
 // Deprecated
 typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV0)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
@@ -934,6 +935,104 @@
     WKDidExceedBackgroundResourceLimitWhileInForegroundCallback         didExceedBackgroundResourceLimitWhileInForeground;
 } WKPageUIClientV10;
 
+typedef struct WKPageUIClientV11 {
+    WKPageUIClientBase                                                  base;
+
+    // Version 0.
+    WKPageCreateNewPageCallback_deprecatedForUseWithV0                  createNewPage_deprecatedForUseWithV0;
+    WKPageUIClientCallback                                              showPage;
+    WKPageUIClientCallback                                              close;
+    WKPageTakeFocusCallback                                             takeFocus;
+    WKPageFocusCallback                                                 focus;
+    WKPageUnfocusCallback                                               unfocus;
+    WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0             runJavaScriptAlert_deprecatedForUseWithV0;
+    WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0           runJavaScriptConfirm_deprecatedForUseWithV0;
+    WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0            runJavaScriptPrompt_deprecatedForUseWithV0;
+    WKPageSetStatusTextCallback                                         setStatusText;
+    WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0        mouseDidMoveOverElement_deprecatedForUseWithV0;
+    WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0     missingPluginButtonClicked_deprecatedForUseWithV0;
+    WKPageDidNotHandleKeyEventCallback                                  didNotHandleKeyEvent;
+    WKPageDidNotHandleWheelEventCallback                                didNotHandleWheelEvent;
+    WKPageGetToolbarsAreVisibleCallback                                 toolbarsAreVisible;
+    WKPageSetToolbarsAreVisibleCallback                                 setToolbarsAreVisible;
+    WKPageGetMenuBarIsVisibleCallback                                   menuBarIsVisible;
+    WKPageSetMenuBarIsVisibleCallback                                   setMenuBarIsVisible;
+    WKPageGetStatusBarIsVisibleCallback                                 statusBarIsVisible;
+    WKPageSetStatusBarIsVisibleCallback                                 setStatusBarIsVisible;
+    WKPageGetIsResizableCallback                                        isResizable;
+    WKPageSetIsResizableCallback                                        setIsResizable;
+    WKPageGetWindowFrameCallback                                        getWindowFrame;
+    WKPageSetWindowFrameCallback                                        setWindowFrame;
+    WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6    runBeforeUnloadConfirmPanel_deprecatedForUseWithV6;
+    WKPageUIClientCallback                                              didDraw;
+    WKPageUIClientCallback                                              pageDidScroll;
+    WKPageExceededDatabaseQuotaCallback                                 exceededDatabaseQuota;
+    WKPageRunOpenPanelCallback                                          runOpenPanel;
+    WKPageDecidePolicyForGeolocationPermissionRequestCallback           decidePolicyForGeolocationPermissionRequest;
+    WKPageHeaderHeightCallback                                          headerHeight;
+    WKPageFooterHeightCallback                                          footerHeight;
+    WKPageDrawHeaderCallback                                            drawHeader;
+    WKPageDrawFooterCallback                                            drawFooter;
+    WKPagePrintFrameCallback                                            printFrame;
+    WKPageUIClientCallback                                              runModal;
+    void*                                                               unused1; // Used to be didCompleteRubberBandForMainFrame
+    WKPageSaveDataToFileInDownloadsFolderCallback                       saveDataToFileInDownloadsFolder;
+    void*                                                               shouldInterruptJavaScript_unavailable;
+
+    // Version 1.
+    WKPageCreateNewPageCallback_deprecatedForUseWithV1                  createNewPage_deprecatedForUseWithV1;
+    WKPageMouseDidMoveOverElementCallback                               mouseDidMoveOverElement;
+    WKPageDecidePolicyForNotificationPermissionRequestCallback          decidePolicyForNotificationPermissionRequest;
+    WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1;
+
+    // Version 2.
+    WKPageShowColorPickerCallback                                       showColorPicker;
+    WKPageHideColorPickerCallback                                       hideColorPicker;
+    WKPageUnavailablePluginButtonClickedCallback                        unavailablePluginButtonClicked;
+
+    // Version 3.
+    WKPagePinnedStateDidChangeCallback                                  pinnedStateDidChange;
+
+    // Version 4.
+    void*                                                               unused2; // Used to be didBeginTrackingPotentialLongMousePress.
+    void*                                                               unused3; // Used to be didRecognizeLongMousePress.
+    void*                                                               unused4; // Used to be didCancelTrackingPotentialLongMousePress.
+    WKPageIsPlayingAudioDidChangeCallback                               isPlayingAudioDidChange;
+
+    // Version 5.
+    WKPageDecidePolicyForUserMediaPermissionRequestCallback             decidePolicyForUserMediaPermissionRequest;
+    WKPageDidClickAutoFillButtonCallback                                didClickAutoFillButton;
+    WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV5             runJavaScriptAlert_deprecatedForUseWithV5;
+    WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV5           runJavaScriptConfirm_deprecatedForUseWithV5;
+    WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV5            runJavaScriptPrompt_deprecatedForUseWithV5;
+    WKPageMediaSessionMetadataDidChangeCallback                         mediaSessionMetadataDidChange;
+
+    // Version 6.
+    WKPageCreateNewPageCallback                                         createNewPage;
+    WKPageRunJavaScriptAlertCallback                                    runJavaScriptAlert;
+    WKPageRunJavaScriptConfirmCallback                                  runJavaScriptConfirm;
+    WKPageRunJavaScriptPromptCallback                                   runJavaScriptPrompt;
+    WKCheckUserMediaPermissionCallback                                  checkUserMediaPermissionForOrigin;
+
+    // Version 7.
+    WKPageRunBeforeUnloadConfirmPanelCallback                           runBeforeUnloadConfirmPanel;
+    WKFullscreenMayReturnToInlineCallback                               fullscreenMayReturnToInline;
+
+    // Version 8.
+    WKRequestPointerLockCallback                                        requestPointerLock;
+    WKDidLosePointerLockCallback                                        didLosePointerLock;
+
+    // Version 9.
+    WKHandleAutoplayEventCallback                                       handleAutoplayEvent;
+
+    // Version 10.
+    WKHasVideoInPictureInPictureDidChangeCallback                       hasVideoInPictureInPictureDidChange;
+    WKDidExceedBackgroundResourceLimitWhileInForegroundCallback         didExceedBackgroundResourceLimitWhileInForeground;
+
+    // Version 11.
+    WKPageDidResignInputElementStrongPasswordAppearanceCallback         didResignInputElementStrongPasswordAppearance;
+} WKPageUIClientV11;
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (230850 => 230851)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -114,6 +114,8 @@
 - (void)_webView:(WKWebView *)webView didInsertAttachment:(_WKAttachment *)attachment WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
 - (void)_webView:(WKWebView *)webView didInsertAttachment:(_WKAttachment *)attachment withSource:(NSString *)source WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
+- (void)_webView:(WKWebView *)webView didResignInputElementStrongPasswordAppearanceWithUserInfo:(id <NSSecureCoding>)userInfo WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 #if TARGET_OS_IPHONE
 - (BOOL)_webView:(WKWebView *)webView shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element WK_API_AVAILABLE(ios(9.0));
 - (NSArray *)_webView:(WKWebView *)webView actionsForElement:(_WKActivatedElementInfo *)element defaultActions:(NSArray<_WKElementAction *> *)defaultActions;

Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h (230850 => 230851)


--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -114,6 +114,7 @@
         void unavailablePluginButtonClicked(WebPageProxy&, WKPluginUnavailabilityReason, API::Dictionary&) final;
         void mouseDidMoveOverElement(WebPageProxy&, const WebHitTestResultData&, WebEvent::Modifiers, API::Object*);
         void didClickAutoFillButton(WebPageProxy&, API::Object*) final;
+        void didResignInputElementStrongPasswordAppearance(WebPageProxy&, API::Object*) final;
         void toolbarsAreVisible(WebPageProxy&, Function<void(bool)>&&) final;
         bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebCore::SecurityOriginData&, API::OpenPanelParameters*, WebOpenPanelResultListenerProxy*) final;
         void didExceedBackgroundResourceLimitWhileInForeground(WebPageProxy&, WKResourceLimit) final;
@@ -172,6 +173,7 @@
         bool webViewHandleAutoplayEventWithFlags : 1;
         bool webViewUnavailablePlugInButtonClicked : 1;
         bool webViewDidClickAutoFillButtonWithUserInfo : 1;
+        bool webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo : 1;
         bool webViewDrawHeaderInRectForPageWithTitleURL : 1;
         bool webViewDrawFooterInRectForPageWithTitleURL : 1;
         bool webViewGetWindowFrameWithCompletionHandler : 1;

Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (230850 => 230851)


--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -120,6 +120,7 @@
     m_delegateMethods.webViewUnavailablePlugInButtonClicked = [delegate respondsToSelector:@selector(_webView:unavailablePlugInButtonClickedWithReason:plugInInfo:)];
     m_delegateMethods.webViewHandleAutoplayEventWithFlags = [delegate respondsToSelector:@selector(_webView:handleAutoplayEvent:withFlags:)];
     m_delegateMethods.webViewDidClickAutoFillButtonWithUserInfo = [delegate respondsToSelector:@selector(_webView:didClickAutoFillButtonWithUserInfo:)];
+    m_delegateMethods.webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo = [delegate respondsToSelector:@selector(_webView:didResignInputElementStrongPasswordAppearanceWithUserInfo:)];
     m_delegateMethods.webViewDrawHeaderInRectForPageWithTitleURL = [delegate respondsToSelector:@selector(_webView:drawHeaderInRect:forPageWithTitle:URL:)];
     m_delegateMethods.webViewDrawFooterInRectForPageWithTitleURL = [delegate respondsToSelector:@selector(_webView:drawFooterInRect:forPageWithTitle:URL:)];
     m_delegateMethods.webViewHeaderHeight = [delegate respondsToSelector:@selector(_webViewHeaderHeight:)];
@@ -697,6 +698,18 @@
     [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView didClickAutoFillButtonWithUserInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil];
 }
 
+void UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance(WebPageProxy&, API::Object* userInfo)
+{
+    if (!m_uiDelegate.m_delegateMethods.webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo)
+        return;
+
+    auto delegate = m_uiDelegate.m_delegate.get();
+    if (!delegate)
+        return;
+
+    [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView didResignInputElementStrongPasswordAppearanceWithUserInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil];
+}
+
 void UIDelegate::UIClient::handleAutoplayEvent(WebPageProxy&, WebCore::AutoplayEvent event, OptionSet<WebCore::AutoplayEventFlags> flags)
 {
     if (!m_uiDelegate.m_delegateMethods.webViewHandleAutoplayEventWithFlags)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (230850 => 230851)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-04-20 20:45:55 UTC (rev 230851)
@@ -7189,6 +7189,11 @@
     m_uiClient->didClickAutoFillButton(*this, m_process->transformHandlesToObjects(userData.object()).get());
 }
 
+void WebPageProxy::didResignInputElementStrongPasswordAppearance(const UserData& userData)
+{
+    m_uiClient->didResignInputElementStrongPasswordAppearance(*this, m_process->transformHandlesToObjects(userData.object()).get());
+}
+
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
 void WebPageProxy::addPlaybackTargetPickerClient(uint64_t contextId)
 {

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (230850 => 230851)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1728,6 +1728,8 @@
 
     void handleAutoFillButtonClick(const UserData&);
 
+    void didResignInputElementStrongPasswordAppearance(const UserData&);
+
     void finishInitializingWebPageAfterProcessLaunch();
 
     void handleMessage(IPC::Connection&, const String& messageName, const UserData& messageBody);

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (230850 => 230851)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2018-04-20 20:45:55 UTC (rev 230851)
@@ -466,7 +466,10 @@
     HandleMessage(String messageName, WebKit::UserData messageBody) WantsConnection
     HandleSynchronousMessage(String messageName, WebKit::UserData messageBody) -> (WebKit::UserData returnData) WantsConnection
 
-    HandleAutoFillButtonClick(WebKit::UserData userData);
+    HandleAutoFillButtonClick(WebKit::UserData userData)
+
+    DidResignInputElementStrongPasswordAppearance(WebKit::UserData userData)
+
     ContentRuleListNotification(WebCore::URL url, Vector<String> identifiers, Vector<String> notifications)
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h (230850 => 230851)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h	2018-04-20 20:45:55 UTC (rev 230851)
@@ -88,6 +88,8 @@
     virtual WTF::String plugInExtraScript() const { return emptyString(); }
 
     virtual void didClickAutoFillButton(WebKit::WebPage&, WebKit::InjectedBundleNodeHandle&, RefPtr<API::Object>&) { }
+
+    virtual void didResignInputElementStrongPasswordAppearance(WebKit::WebPage&, WebKit::InjectedBundleNodeHandle&, RefPtr<API::Object>&) { };
 };
 
 } // namespace InjectedBundle

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h (230850 => 230851)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -54,6 +54,7 @@
 typedef WKStringRef (*WKBundlePagePlugInCreateExtraStyleSheetCallback)(const void *clientInfo);
 typedef WKStringRef (*WKBundlePagePlugInCreateExtraScriptCallback)(const void *clientInfo);
 typedef void (*WKBundlePageDidClickAutoFillButtonCallback)(WKBundlePageRef page, WKBundleNodeHandleRef inputElement, WKTypeRef* userData, const void *clientInfo);
+typedef void (*WKBundlePageDidResignInputElementStrongPasswordAppearance)(WKBundlePageRef page, WKBundleNodeHandleRef inputElement, WKTypeRef* userData, const void *clientInfo);
 
 typedef struct WKBundlePageUIClientBase {
     int                                                                 version;
@@ -170,3 +171,42 @@
     WKBundlePageDidClickAutoFillButtonCallback                          didClickAutoFillButton;
 } WKBundlePageUIClientV3;
 
+typedef struct WKBundlePageUIClientV4 {
+    WKBundlePageUIClientBase                                            base;
+
+    // Version 0.
+    WKBundlePageWillAddMessageToConsoleCallback                         willAddMessageToConsole;
+    WKBundlePageWillSetStatusbarTextCallback                            willSetStatusbarText;
+    WKBundlePageWillRunJavaScriptAlertCallback                          willRunJavaScriptAlert;
+    WKBundlePageWillRunJavaScriptConfirmCallback                        willRunJavaScriptConfirm;
+    WKBundlePageWillRunJavaScriptPromptCallback                         willRunJavaScriptPrompt;
+    WKBundlePageMouseDidMoveOverElementCallback                         mouseDidMoveOverElement;
+    WKBundlePageDidScrollCallback                                       pageDidScroll;
+    void*                                                               unused1;
+    WKBundlePageGenerateFileForUploadCallback                           shouldGenerateFileForUpload;
+    WKBundlePageGenerateFileForUploadCallback                           generateFileForUpload;
+    void*                                                               unused2;
+    WKBundlePageStatusBarIsVisibleCallback                              statusBarIsVisible;
+    WKBundlePageMenuBarIsVisibleCallback                                menuBarIsVisible;
+    WKBundlePageToolbarsAreVisibleCallback                              toolbarsAreVisible;
+
+    // Version 1.
+    WKBundlePageReachedAppCacheOriginQuotaCallback                      didReachApplicationCacheOriginQuota;
+
+    // Version 2.
+    WKBundlePageExceededDatabaseQuotaCallback                           didExceedDatabaseQuota;
+    WKBundlePagePlugInCreateStartLabelTitleCallback                     createPlugInStartLabelTitle;
+    WKBundlePagePlugInCreateStartLabelSubtitleCallback                  createPlugInStartLabelSubtitle;
+    WKBundlePagePlugInCreateExtraStyleSheetCallback                     createPlugInExtraStyleSheet;
+    WKBundlePagePlugInCreateExtraScriptCallback                         createPlugInExtraScript;
+
+    // Version 3.
+    void*                                                               unused3;
+    void*                                                               unused4;
+    void*                                                               unused5;
+
+    WKBundlePageDidClickAutoFillButtonCallback                          didClickAutoFillButton;
+
+    // Version 4.
+    WKBundlePageDidResignInputElementStrongPasswordAppearance           didResignInputElementStrongPasswordAppearance;
+} WKBundlePageUIClientV4;

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp (230850 => 230851)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp	2018-04-20 20:45:55 UTC (rev 230851)
@@ -212,4 +212,14 @@
     userData = adoptRef(toImpl(userDataToPass));
 }
 
+void InjectedBundlePageUIClient::didResignInputElementStrongPasswordAppearance(WebPage& page, InjectedBundleNodeHandle& nodeHandle, RefPtr<API::Object>& userData)
+{
+    if (!m_client.didResignInputElementStrongPasswordAppearance)
+        return;
+
+    WKTypeRef userDataToPass = nullptr;
+    m_client.didResignInputElementStrongPasswordAppearance(toAPI(&page), toAPI(&nodeHandle), &userDataToPass, m_client.base.clientInfo);
+    userData = adoptRef(toImpl(userDataToPass));
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h (230850 => 230851)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h	2018-04-20 20:45:55 UTC (rev 230851)
@@ -36,7 +36,7 @@
 class Object;
 
 template<> struct ClientTraits<WKBundlePageUIClientBase> {
-    typedef std::tuple<WKBundlePageUIClientV0, WKBundlePageUIClientV1, WKBundlePageUIClientV2, WKBundlePageUIClientV3> Versions;
+    typedef std::tuple<WKBundlePageUIClientV0, WKBundlePageUIClientV1, WKBundlePageUIClientV2, WKBundlePageUIClientV3, WKBundlePageUIClientV4> Versions;
 };
 }
 
@@ -70,6 +70,8 @@
     String plugInExtraScript() const override;
 
     void didClickAutoFillButton(WebPage&, InjectedBundleNodeHandle&, RefPtr<API::Object>& userData) override;
+
+    void didResignInputElementStrongPasswordAppearance(WebPage&, InjectedBundleNodeHandle&, RefPtr<API::Object>& userData) override;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (230850 => 230851)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1211,6 +1211,18 @@
     m_page.send(Messages::WebPageProxy::HandleAutoFillButtonClick(UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
 }
 
+void WebChromeClient::inputElementDidResignStrongPasswordAppearance(HTMLInputElement& inputElement)
+{
+    RefPtr<API::Object> userData;
+
+    // Notify the bundle client.
+    auto nodeHandle = InjectedBundleNodeHandle::getOrCreate(inputElement);
+    m_page.injectedBundleUIClient().didResignInputElementStrongPasswordAppearance(m_page, nodeHandle.get(), userData);
+
+    // Notify the UIProcess.
+    m_page.send(Messages::WebPageProxy::DidResignInputElementStrongPasswordAppearance { UserData { WebProcess::singleton().transformObjectsToHandles(userData.get()).get() } });
+}
+
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
 
 void WebChromeClient::addPlaybackTargetPickerClient(uint64_t contextId)

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (230850 => 230851)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2018-04-20 20:45:55 UTC (rev 230851)
@@ -332,6 +332,8 @@
 
     void handleAutoFillButtonClick(WebCore::HTMLInputElement&) final;
 
+    void inputElementDidResignStrongPasswordAppearance(WebCore::HTMLInputElement&) final;
+
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
     void addPlaybackTargetPickerClient(uint64_t /*contextId*/) final;
     void removePlaybackTargetPickerClient(uint64_t /*contextId*/) final;

Modified: trunk/Tools/ChangeLog (230850 => 230851)


--- trunk/Tools/ChangeLog	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Tools/ChangeLog	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,3 +1,23 @@
+2018-04-20  Daniel Bates  <daba...@apple.com>
+
+        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.
+
+        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):
+
 2018-04-20  Brady Eidson  <beid...@apple.com>
 
         Add a test to verify load/unload/pageshow/pagehide all work with process swapping.

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (230850 => 230851)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2018-04-20 20:45:55 UTC (rev 230851)
@@ -722,6 +722,7 @@
 		CE3524FA1B1443890028A7C5 /* input-focus-blur.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CE3524F51B142BBB0028A7C5 /* input-focus-blur.html */; };
 		CE4D5DE71F6743BA0072CFC6 /* StringWithDirection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE4D5DE51F6743BA0072CFC6 /* StringWithDirection.cpp */; };
 		CEA6CF2819CCF69D0064F5A7 /* open-and-close-window.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */; };
+		CEA7F57D2089624B0078EF6E /* DidResignInputElementStrongPasswordAppearance.mm in Sources */ = {isa = PBXBuildFile; fileRef = CEA7F57B20895F5B0078EF6E /* DidResignInputElementStrongPasswordAppearance.mm */; };
 		CEBABD491B71687C0051210A /* should-open-external-schemes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEBABD481B71687C0051210A /* should-open-external-schemes.html */; };
 		CEBCA12F1E3A660100C73293 /* OverrideContentSecurityPolicy.mm in Sources */ = {isa = PBXBuildFile; fileRef = CEBCA12E1E3A660100C73293 /* OverrideContentSecurityPolicy.mm */; };
 		CEBCA1381E3A807A00C73293 /* page-with-csp.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEBCA1351E3A803400C73293 /* page-with-csp.html */; };
@@ -1867,6 +1868,7 @@
 		CE50D8C81C8665CE0072EA5A /* OptionSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OptionSet.cpp; sourceTree = "<group>"; };
 		CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenAndCloseWindow.mm; sourceTree = "<group>"; };
 		CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "open-and-close-window.html"; sourceTree = "<group>"; };
+		CEA7F57B20895F5B0078EF6E /* DidResignInputElementStrongPasswordAppearance.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DidResignInputElementStrongPasswordAppearance.mm; sourceTree = "<group>"; };
 		CEBABD481B71687C0051210A /* should-open-external-schemes.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "should-open-external-schemes.html"; sourceTree = "<group>"; };
 		CEBCA12E1E3A660100C73293 /* OverrideContentSecurityPolicy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OverrideContentSecurityPolicy.mm; sourceTree = "<group>"; };
 		CEBCA1341E3A803400C73293 /* page-with-csp-iframe.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "page-with-csp-iframe.html"; sourceTree = "<group>"; };
@@ -2158,6 +2160,7 @@
 				9B7A37C21F8AEBA5004AA228 /* CopyURL.mm */,
 				2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */,
 				CEC16EA41EE863BF00DE479A /* DecidePolicyForNavigationAction.mm */,
+				CEA7F57B20895F5B0078EF6E /* DidResignInputElementStrongPasswordAppearance.mm */,
 				2DC60E221E79F88C00FA6C7D /* DoAfterNextPresentationUpdateAfterCrash.mm */,
 				A1A4FE5D18DD3DB700B5EA8A /* Download.mm */,
 				A15502281E05020B00A24C57 /* DuplicateCompletionHandlerCalls.mm */,
@@ -3845,6 +3848,7 @@
 				1C2B81831C891F0900A5529F /* CancelFontSubresourcePlugIn.mm in Sources */,
 				5CB18BA81F5645E300EE23C4 /* ClickAutoFillButton.mm in Sources */,
 				A14FC58B1B89927100D107EB /* ContentFilteringPlugIn.mm in Sources */,
+				CEA7F57D2089624B0078EF6E /* DidResignInputElementStrongPasswordAppearance.mm in Sources */,
 				5CB5B3C21FFC55CF00C27BB0 /* FrameHandleSerialization.mm in Sources */,
 				A13EBBAB1B87434600097110 /* PlatformUtilitiesCocoa.mm in Sources */,
 				1A4F81CF1BDFFD53004E672E /* RemoteObjectRegistryPlugIn.mm in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DidResignInputElementStrongPasswordAppearance.mm (0 => 230851)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DidResignInputElementStrongPasswordAppearance.mm	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DidResignInputElementStrongPasswordAppearance.mm	2018-04-20 20:45:55 UTC (rev 230851)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#import "config.h"
+
+#if WK_API_ENABLED
+
+#import <WebKit/WKBundlePage.h>
+#import <WebKit/WKBundlePageUIClient.h>
+#import <WebKit/WKDOMDocument.h>
+#import <WebKit/WKDOMElement.h>
+#import <WebKit/WKDOMNodePrivate.h>
+#import <WebKit/WKDOMText.h>
+#import <WebKit/WKString.h>
+#import <WebKit/WKWebProcessPlugIn.h>
+#import <WebKit/WKWebProcessPlugInBrowserContextControllerPrivate.h>
+#import <WebKit/WKWebProcessPlugInFrame.h>
+#import <WebKit/WKWebProcessPlugInNodeHandlePrivate.h>
+#import <WebKit/WKWebProcessPlugInScriptWorld.h>
+
+void didResignInputElementStrongPasswordAppearance(WKBundlePageRef, WKBundleNodeHandleRef, WKTypeRef* userData, const void *)
+{
+    *userData = WKStringCreateWithUTF8CString("user data string");
+}
+
+@interface DidResignInputElementStrongPasswordAppearance : NSObject <WKWebProcessPlugIn>
+@end
+
+@implementation DidResignInputElementStrongPasswordAppearance
+
+- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController
+{
+    WKBundlePageUIClientV4 client;
+    memset(&client, 0, sizeof(client));
+    client.base.version = 4;
+    client.didResignInputElementStrongPasswordAppearance = didResignInputElementStrongPasswordAppearance;
+    WKBundlePageSetUIClient([browserContextController _bundlePageRef], &client.base);
+
+    WKDOMDocument *document = [browserContextController mainFrameDocument];
+    WKDOMElement *inputElement = [document createElement:@"input"];
+    [inputElement setAttribute:@"type" value:@"password"];
+    [[document body] appendChild:inputElement];
+
+    auto *jsContext = [[browserContextController mainFrame] jsContextForWorld:[WKWebProcessPlugInScriptWorld normalWorld]];
+    auto *jsValue = [jsContext evaluateScript:@"document.querySelector('input')"];
+    auto* nodeHandle = [WKWebProcessPlugInNodeHandle nodeHandleWithJSValue:jsValue inContext:jsContext];
+    [nodeHandle setHTMLInputElementIsAutoFilled:YES];
+    [nodeHandle setHTMLInputElementAutoFillButtonEnabledWithButtonType:_WKAutoFillButtonTypeStrongPassword];
+    [[[browserContextController mainFrame] jsContextForWorld:[WKWebProcessPlugInScriptWorld normalWorld]] evaluateScript:@"alert('ready to resign!')"];
+}
+
+@end
+
+#endif // WK_API_ENABLED
+

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm (230850 => 230851)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm	2018-04-20 20:40:51 UTC (rev 230850)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm	2018-04-20 20:45:55 UTC (rev 230851)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -551,6 +551,42 @@
     TestWebKitAPI::Util::run(&done);
 }
 
+static bool readytoResign;
+
+@interface DidResignInputElementStrongPasswordAppearanceDelegate : NSObject <WKUIDelegatePrivate>
+@end
+
+@implementation DidResignInputElementStrongPasswordAppearanceDelegate
+
+- (void)_webView:(WKWebView *)webView didResignInputElementStrongPasswordAppearanceWithUserInfo:(id <NSSecureCoding>)userInfo
+{
+    ASSERT_TRUE([(id<NSObject>)userInfo isKindOfClass:[NSString class]]);
+    ASSERT_STREQ([(NSString*)userInfo UTF8String], "user data string");
+    done = true;
+}
+
+- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler
+{
+    completionHandler();
+    ASSERT_STREQ(message.UTF8String, "ready to resign!");
+    readytoResign = true;
+}
+
+@end
+
+TEST(WebKit, DidResignInputElementStrongPasswordAppearance)
+{
+    done = false;
+    WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"DidResignInputElementStrongPasswordAppearance"];
+
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration]);
+    auto delegate = adoptNS([[DidResignInputElementStrongPasswordAppearanceDelegate alloc] init]);
+    [webView setUIDelegate:delegate.get()];
+    TestWebKitAPI::Util::run(&readytoResign);
+    [webView evaluateJavaScript:@"document.querySelector('input').type = 'text'" completionHandler:nil];
+    TestWebKitAPI::Util::run(&done);
+}
+
 @interface AutoFillAvailableDelegate : NSObject <WKUIDelegatePrivate>
 @end
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to