Title: [262283] trunk
Revision
262283
Author
[email protected]
Date
2020-05-29 00:27:03 -0700 (Fri, 29 May 2020)

Log Message

REGRESSION (r261812): editing/async-clipboard/clipboard-item-get-type-basic.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=212281
<rdar://problem/63554912>

Reviewed by Tim Horton.

Source/WebKit:

Declare `-delegateSupportsImagePaste` on UIKeyboardImpl.

* Platform/spi/ios/UIKitSPI.h:

Source/WTF:

Add a new `HAVE()` define.

* wtf/PlatformHave.h:

Tools:

On some shipping versions of iOS, returning `NO` from `-supportsImagePaste` still results in UIKit keyboard
code pinning temporary items to the general pasteboard, which increments the change count of the pasteboard.
If this happens in the middle of an attempt to read from the pasteboard, we end up falsely denying access to the
contents of the pasteboard, since we believe that the contents of the pasteboard have changed.

This has the potential to affect any test that attempts to read from the pasteboard on iOS, though the titular
layout test seems to trigger the bug more frequently than other tests.

This item pinning was added in support of being able to insert Memojis from the software keyboard, and works by
pretending to copy a temporary PNG image, asking the delegate whether it `-canPerformAction:withSender:`, and
then restoring the items previously on the pasteboard. To work around this in the test runner, we can simply
swizzle out `-[UIKeyboardImpl delegateSupportsImagePaste]` to always return `NO`, which has the same effect as
disabling the Memoji keyboard.

* WebKitTestRunner/TestController.h:
* WebKitTestRunner/ios/TestControllerIOS.mm:
(overrideKeyboardDelegateSupportsImagePaste):
(WTR::TestController::platformResetStateToConsistentValues):

LayoutTests:

Remove the failing test expectation.

* platform/ios-simulator-wk2/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (262282 => 262283)


--- trunk/LayoutTests/ChangeLog	2020-05-29 07:00:15 UTC (rev 262282)
+++ trunk/LayoutTests/ChangeLog	2020-05-29 07:27:03 UTC (rev 262283)
@@ -1,3 +1,15 @@
+2020-05-29  Wenson Hsieh  <[email protected]>
+
+        REGRESSION (r261812): editing/async-clipboard/clipboard-item-get-type-basic.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=212281
+        <rdar://problem/63554912>
+
+        Reviewed by Tim Horton.
+
+        Remove the failing test expectation.
+
+        * platform/ios-simulator-wk2/TestExpectations:
+
 2020-05-28  Zan Dobersek  <[email protected]>
 
         Unreviewed WPE gardening.

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (262282 => 262283)


--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2020-05-29 07:00:15 UTC (rev 262282)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2020-05-29 07:27:03 UTC (rev 262283)
@@ -92,5 +92,3 @@
 webkit.org/b/209234 [ Release ] platform/ios/ios/plugin/youtube-flash-plugin-iframe-no-height-or-width.html [ Pass Failure ]
 
 webkit.org/b/207496 http/wpt/cache-storage/cache-put-keys.https.any.html [ Pass Failure ]
-
-webkit.org/b/212281 [ Release ] editing/async-clipboard/clipboard-item-get-type-basic.html [ Pass Failure ]
\ No newline at end of file

Modified: trunk/Source/WTF/ChangeLog (262282 => 262283)


--- trunk/Source/WTF/ChangeLog	2020-05-29 07:00:15 UTC (rev 262282)
+++ trunk/Source/WTF/ChangeLog	2020-05-29 07:27:03 UTC (rev 262283)
@@ -1,3 +1,15 @@
+2020-05-29  Wenson Hsieh  <[email protected]>
+
+        REGRESSION (r261812): editing/async-clipboard/clipboard-item-get-type-basic.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=212281
+        <rdar://problem/63554912>
+
+        Reviewed by Tim Horton.
+
+        Add a new `HAVE()` define.
+
+        * wtf/PlatformHave.h:
+
 2020-05-27  Keith Miller  <[email protected]>
 
         for-of should check the iterable is a JSArray for FastArray in DFG iterator_open

Modified: trunk/Source/WTF/wtf/PlatformHave.h (262282 => 262283)


--- trunk/Source/WTF/wtf/PlatformHave.h	2020-05-29 07:00:15 UTC (rev 262282)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2020-05-29 07:27:03 UTC (rev 262283)
@@ -634,3 +634,7 @@
 #if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600)
 #define HAVE_DISPLAY_LAYER_BIPLANAR_SUPPORT 1
 #endif
+
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000
+#define HAVE_NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY 1
+#endif

Modified: trunk/Source/WebKit/ChangeLog (262282 => 262283)


--- trunk/Source/WebKit/ChangeLog	2020-05-29 07:00:15 UTC (rev 262282)
+++ trunk/Source/WebKit/ChangeLog	2020-05-29 07:27:03 UTC (rev 262283)
@@ -1,3 +1,15 @@
+2020-05-29  Wenson Hsieh  <[email protected]>
+
+        REGRESSION (r261812): editing/async-clipboard/clipboard-item-get-type-basic.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=212281
+        <rdar://problem/63554912>
+
+        Reviewed by Tim Horton.
+
+        Declare `-delegateSupportsImagePaste` on UIKeyboardImpl.
+
+        * Platform/spi/ios/UIKitSPI.h:
+
 2020-05-28  Peng Liu  <[email protected]>
 
         Clean up WebKit.xcodeproj/project.pbxproj

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (262282 => 262283)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2020-05-29 07:00:15 UTC (rev 262282)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2020-05-29 07:27:03 UTC (rev 262283)
@@ -1312,6 +1312,7 @@
 - (BOOL)handleKeyAppCommandForCurrentEvent;
 - (BOOL)handleKeyInputMethodCommandForCurrentEvent;
 - (BOOL)isCallingInputDelegate;
+- (BOOL)delegateSupportsImagePaste;
 @property (nonatomic, readonly) UIKeyboardInputMode *currentInputModeInPreference;
 @end
 

Modified: trunk/Tools/ChangeLog (262282 => 262283)


--- trunk/Tools/ChangeLog	2020-05-29 07:00:15 UTC (rev 262282)
+++ trunk/Tools/ChangeLog	2020-05-29 07:27:03 UTC (rev 262283)
@@ -1,3 +1,30 @@
+2020-05-29  Wenson Hsieh  <[email protected]>
+
+        REGRESSION (r261812): editing/async-clipboard/clipboard-item-get-type-basic.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=212281
+        <rdar://problem/63554912>
+
+        Reviewed by Tim Horton.
+
+        On some shipping versions of iOS, returning `NO` from `-supportsImagePaste` still results in UIKit keyboard
+        code pinning temporary items to the general pasteboard, which increments the change count of the pasteboard.
+        If this happens in the middle of an attempt to read from the pasteboard, we end up falsely denying access to the
+        contents of the pasteboard, since we believe that the contents of the pasteboard have changed.
+
+        This has the potential to affect any test that attempts to read from the pasteboard on iOS, though the titular
+        layout test seems to trigger the bug more frequently than other tests.
+
+        This item pinning was added in support of being able to insert Memojis from the software keyboard, and works by
+        pretending to copy a temporary PNG image, asking the delegate whether it `-canPerformAction:withSender:`, and
+        then restoring the items previously on the pasteboard. To work around this in the test runner, we can simply
+        swizzle out `-[UIKeyboardImpl delegateSupportsImagePaste]` to always return `NO`, which has the same effect as
+        disabling the Memoji keyboard.
+
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/ios/TestControllerIOS.mm:
+        (overrideKeyboardDelegateSupportsImagePaste):
+        (WTR::TestController::platformResetStateToConsistentValues):
+
 2020-05-28  Myles C. Maxfield  <[email protected]>
 
         Make fast/text/user-installed-fonts/extended-character.html more robust

Modified: trunk/Tools/WebKitTestRunner/TestController.h (262282 => 262283)


--- trunk/Tools/WebKitTestRunner/TestController.h	2020-05-29 07:00:15 UTC (rev 262282)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2020-05-29 07:27:03 UTC (rev 262283)
@@ -554,7 +554,10 @@
     Vector<std::unique_ptr<InstanceMethodSwizzler>> m_inputModeSwizzlers;
     RetainPtr<UIKeyboardInputMode> m_overriddenKeyboardInputMode;
     Vector<std::unique_ptr<InstanceMethodSwizzler>> m_presentPopoverSwizzlers;
+#if !HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)
+    std::unique_ptr<InstanceMethodSwizzler> m_keyboardDelegateSupportsImagePasteSwizzler;
 #endif
+#endif
 
     enum State {
         Initial,

Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (262282 => 262283)


--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2020-05-29 07:00:15 UTC (rev 262282)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2020-05-29 07:27:03 UTC (rev 262283)
@@ -56,6 +56,15 @@
 {
 }
 
+#if !HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)
+
+static BOOL overrideKeyboardDelegateSupportsImagePaste(id, SEL)
+{
+    return NO;
+}
+
+#endif
+
 namespace WTR {
 
 static bool isDoneWaitingForKeyboardToDismiss = true;
@@ -157,6 +166,12 @@
 
     GSEventSetHardwareKeyboardAttached(true, 0);
 
+#if !HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)
+    // FIXME: Remove this workaround once -[UIKeyboardImpl delegateSupportsImagePaste] no longer increments the general pasteboard's changeCount.
+    if (!m_keyboardDelegateSupportsImagePasteSwizzler)
+        m_keyboardDelegateSupportsImagePasteSwizzler = makeUnique<InstanceMethodSwizzler>(UIKeyboardImpl.class, @selector(delegateSupportsImagePaste), reinterpret_cast<IMP>(overrideKeyboardDelegateSupportsImagePaste));
+#endif
+
     m_inputModeSwizzlers.clear();
     m_overriddenKeyboardInputMode = nil;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to