Bug 209685 - REGRESSION: 4 TestWebKitAPI.DragAndDropTests.DataTransferSetData tests failing on iOS
Summary: REGRESSION: 4 TestWebKitAPI.DragAndDropTests.DataTransferSetData tests failin...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-03-27 15:19 PDT by Ryan Haddad
Modified: 2020-04-06 17:00 PDT (History)
13 users (show)

See Also:


Attachments
Patch (6.59 KB, patch)
2020-04-06 11:22 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Fix typo (6.59 KB, patch)
2020-04-06 13:23 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Haddad 2020-03-27 15:19:44 PDT
Failed

    TestWebKitAPI.DragAndDropTests.DataTransferSetDataInvalidURL
        2020-03-27 14:12:15.559 TestWebKitAPI[48608:5108740] Encountered error: Error Domain=NSCocoaErrorDomain Code=3840 "No value." UserInfo={NSDebugDescription=No value.} while serializing JSON string.
        2020-03-27 14:12:15.559 TestWebKitAPI[48608:5108740] Expected JSON:  to match values: {
            dragover =     {
                "text/uri-list" = "";
            };
            drop =     {
                "text/uri-list" = "some random string";
            };
        }
        
        /Volumes/Data/slave/ios-simulator-13-release/build/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:175
        Value of: success
          Actual: false
        Expected: true
        

    TestWebKitAPI.DragAndDropTests.DataTransferSetDataCannotWritePlatformTypes
        2020-03-27 14:12:14.494 TestWebKitAPI[48602:5107756] Encountered error: Error Domain=NSCocoaErrorDomain Code=3840 "No value." UserInfo={NSDebugDescription=No value.} while serializing JSON string.
        2020-03-27 14:12:14.494 TestWebKitAPI[48602:5107756] Expected JSON:  to match values: {
            dragover =     {
                "com.adobe.pdf" = "";
                "text/plain" = "";
            };
            drop =     {
                "com.adobe.pdf" = "try and decode me!";
                "text/plain" = foo;
            };
        }
        
        /Volumes/Data/slave/ios-simulator-13-release/build/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:126
        Value of: [registeredTypes containsObject:(NSString *)firstType]
          Actual: false
        Expected: true
        
        
        /Volumes/Data/slave/ios-simulator-13-release/build/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:175
        Value of: success
          Actual: false
        Expected: true
        

Timeout

    TestWebKitAPI.DragAndDropTests.DataTransferSetDataValidURL
        2020-03-27 14:12:49.648 TestWebKitAPI[48620:5110799] Encountered error: Error Domain=NSCocoaErrorDomain Code=3840 "No value." UserInfo={NSDebugDescription=No value.} while serializing JSON string.
        2020-03-27 14:12:49.648 TestWebKitAPI[48620:5110799] Expected JSON:  to match values: {
            dragover =     {
                "text/uri-list" = "";
            };
            drop =     {
                "text/uri-list" = "https://webkit.org/b/123";
            };
        }

    TestWebKitAPI.DragAndDropTests.DataTransferSetDataUnescapedURL
        2020-03-27 14:12:16.622 TestWebKitAPI[48614:5109712] Encountered error: Error Domain=NSCocoaErrorDomain Code=3840 "No value." UserInfo={NSDebugDescription=No value.} while serializing JSON string.
        2020-03-27 14:12:16.623 TestWebKitAPI[48614:5109712] Expected JSON:  to match values: {
            dragover =     {
                "text/uri-list" = "";
            };
            drop =     {
                "text/uri-list" = "http://webkit.org/b/\U4f60\U597d;?x=8 + 6";
            };
        }

https://build.webkit.org/builders/Apple%20iOS%2013%20Simulator%20Release%20WK2%20(Tests)/builds/3367
Comment 1 Radar WebKit Bug Importer 2020-03-27 15:21:18 PDT
<rdar://problem/60987461>
Comment 2 Wenson Hsieh 2020-03-27 15:24:02 PDT
Hm…iOS EWS was green in my latest drag and drop escapade (webkit.org/b/209642), but maybe I missed something. I’ll take a look.
Comment 3 Ryan Haddad 2020-03-27 15:33:24 PDT
I think this started after I upgraded the bots to 10.15.4 and installed the 13.4 SDK.
Comment 4 Ryan Haddad 2020-03-27 15:34:30 PDT
This isn't happening on debug bots with the same configuration, and I can't repro it locally with by debug build either.
Comment 5 Wenson Hsieh 2020-03-28 16:13:26 PDT
From the output, it’s clear that the test expects a drop to happen, but it never does.

Some logging in -[WKContentView dropInteraction:sessionDidUpdate:] (in the UI process) as well as DragController::dragEnteredOrUpdated (in the web process) would give us more clues.
Comment 6 Wenson Hsieh 2020-04-03 21:48:10 PDT
From <https://bugs.webkit.org/show_bug.cgi?id=209988>, we observe:

        2020-04-03 21:05:45.096 TestWebKitAPI[69849:285586774] -[DragAndDropSimulator runFrom:to:additionalItemRequestLocations:] - preparing for drag session
        2020-04-03 21:05:45.096 TestWebKitAPI[69849:285586774] Preparing for drag session: 0x7fc9a0592d40
        2020-04-03 21:05:45.096 TestWebKitAPI[69849:285586774] Drag session requested: 0x7fc9a0592d40 at origin: {50, 225}
        2020-04-03 21:05:45.165 TestWebKitAPI[69849:285586774] Handling drag start request (started: 1, completion block: 0x7fc9a06ca330)
        2020-04-03 21:05:45.165 TestWebKitAPI[69849:285586774] auto DragAndDropSimulator::runFrom:to:additionalItemRequestLocations:::(anonymous class)::operator()() const - done preparing for drag session with phase: 1
        2020-04-03 21:05:45.166 TestWebKitAPI[69849:285586774] -[DragAndDropSimulator _advanceProgress] - phase: 1
        2020-04-03 21:05:45.166 TestWebKitAPI[69849:285586774] Drag items requested for session: 0x7fc9a0592d40
        2020-04-03 21:05:45.166 TestWebKitAPI[69849:285586774] Drag session: 0x7fc9a0592d40 starting with 0 items
        2020-04-03 21:05:45.166 TestWebKitAPI[69849:285586774] Cleaning up dragging state (has pending operation: 0)
        2020-04-03 21:05:45.171 TestWebKitAPI[69849:285586774] Encountered error: Error Domain=NSCocoaErrorDomain Code=3840 "No value." UserInfo={NSDebugDescription=No value.} while serializing JSON string.
        2020-04-03 21:05:45.171 TestWebKitAPI[69849:285586774] Expected JSON:  to match values: {
            dragover =     {
                "text/uri-list" = "";
            };
            drop =     {
                "text/uri-list" = "some random string";
            };
        }
        
        /Volumes/Data/slave/ios-simulator-13-release/build/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:175
        Value of: success
          Actual: false
        Expected: true

…the smoking gun is this line:

        2020-04-03 21:05:45.166 TestWebKitAPI[69849:285586774] Drag session: 0x7fc9a0592d40 starting with 0 items

I would expect there to be at least 1 item in this case, due to the text selection.
Comment 7 Wenson Hsieh 2020-04-04 22:37:16 PDT
The latest logging after trac.webkit.org/r259541 makes it obvious that we’re failing on this bot because the staged item provider keeps getting overwritten. The PasteboardCustomData contains the information needed to start the drag, but for some reason, we end up writing an empty string to the pasteboard, which clears out the staged item :(

Timeout

    TestWebKitAPI.DragAndDropTests.DataTransferSetDataValidURL
        2020-04-04 19:39:09.104 TestWebKitAPI[67931:311616776] -[WebItemProviderPasteboard stageRegistrationLists:] - (
            "<WebItemProviderRegistrationInfoList: 0x7fb3935c3100(com.apple.WebKit.custom-pasteboard-data => 106 bytes), (NSURL)>"
        )
        1   0x1149353c7 -[WebItemProviderPasteboard stageRegistrationLists:]
        2   0x113680e1b WebCore::registerItemsToPasteboard(NSArray<WebItemProviderRegistrationInfoList*>*, id<AbstractPasteboard>)
        3   0x113680a8a WebCore::PlatformPasteboard::write(WTF::Vector<WebCore::PasteboardCustomData, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc> const&)
        4   0x111083672 WebKit::WebPasteboardProxy::writeCustomData(IPC::Connection&, WTF::Vector<WebCore::PasteboardCustomData, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc> const&, WTF::String const&, WTF::CompletionHandler<void (long long)>&&)
        5   0x1113df80a void IPC::handleMessageSynchronousWantsConnection<Messages::WebPasteboardProxy::WriteCustomData, WebKit::WebPasteboardProxy, void (WebKit::WebPasteboardProxy::*)(IPC::Connection&, WTF::Vector<WebCore::PasteboardCustomData, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc> const&, WTF::String const&, WTF::CompletionHandler<void (long long)>&&)>(IPC::Connection&, IPC::Decoder&, std::__1::unique_ptr<IPC::Encoder, std::__1::default_delete<IPC::Encoder> >&, WebKit::WebPasteboardProxy*, void (WebKit::WebPasteboardProxy::*)(IPC::Connection&, WTF::Vector<WebCore::PasteboardCustomData, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc> const&, WTF::String const&, WTF::CompletionHandler<void (long long)>&&))
        6   0x110e3790c IPC::MessageReceiverMap::dispatchSyncMessage(IPC::Connection&, IPC::Decoder&, std::__1::unique_ptr<IPC::Encoder, std::__1::default_delete<IPC::Encoder> >&)
        7   0x111112a88 WebKit::WebProcessProxy::didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::__1::unique_ptr<IPC::Encoder, std::__1::default_delete<IPC::Encoder> >&)
        8   0x110e20420 IPC::Connection::dispatchSyncMessage(IPC::Decoder&)
        9   0x110e20825 IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >)
        10  0x110e1ccb6 IPC::Connection::SyncMessageState::ConnectionAndIncomingMessage::dispatch()
        11  0x110e1cde8 IPC::Connection::SyncMessageState::dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection(IPC::Connection&)
        12  0x10fbacf7a WTF::RunLoop::performWork()
        13  0x10fbad132 WTF::RunLoop::performWork(void*)
        14  0x119140c71 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
        15  0x119140b9c __CFRunLoopDoSource0
        16  0x119140374 __CFRunLoopDoSources0
        17  0x11913af6e __CFRunLoopRun
        18  0x11913a884 CFRunLoopRunSpecific
        19  0x118a00831 -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
        20  0x10f11ba03 TestWebKitAPI::Util::run(bool*)
        21  0x10eed34f0 -[DragAndDropSimulator runFrom:to:additionalItemRequestLocations:]
        22  0x10eef5614 TestWebKitAPI::DragAndDropTests_DataTransferSetDataValidURL_Test::TestBody()
        23  0x10f1d2189 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)
        24  0x10f1d20f2 testing::Test::Run()
        25  0x10f1d2a1f testing::TestInfo::Run()
        26  0x10f1d3037 testing::TestCase::Run()
        27  0x10f1daeb0 testing::internal::UnitTestImpl::RunAllTests()
        28  0x10f1daafd bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)
        29  0x10f1daa88 testing::UnitTest::Run()
        30  0x10f0fa3fe TestWebKitAPI::TestsController::run(int, char**)
        31  0x10f1b0362 main
        2020-04-04 19:39:09.124 TestWebKitAPI[67931:311616776] -[WebItemProviderPasteboard stageRegistrationLists:] - (
            "<WebItemProviderRegistrationInfoList: 0x7fb393616670>"
        )
        1   0x1149353c7 -[WebItemProviderPasteboard stageRegistrationLists:]
        2   0x113680e1b WebCore::registerItemsToPasteboard(NSArray<WebItemProviderRegistrationInfoList*>*, id<AbstractPasteboard>)
        3   0x11367f648 WebCore::PlatformPasteboard::write(WTF::String const&, WTF::String const&)
        4   0x11108423d WebKit::WebPasteboardProxy::writeStringToPasteboard(IPC::Connection&, WTF::String const&, WTF::String const&, WTF::String const&)
        5   0x1113ded5f WebKit::WebPasteboardProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&)
        6   0x110e37880 IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&)
        7   0x1111129e4 WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&)
        8   0x110e2082c IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >)
        9   0x110e1fe5b IPC::Connection::dispatchIncomingMessages()
        10  0x10fbacf7a WTF::RunLoop::performWork()
        11  0x10fbad132 WTF::RunLoop::performWork(void*)
        12  0x119140c71 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
        13  0x119140b9c __CFRunLoopDoSource0
        14  0x119140374 __CFRunLoopDoSources0
        15  0x11913af6e __CFRunLoopRun
        16  0x11913a884 CFRunLoopRunSpecific
        17  0x118a00831 -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
        18  0x10f11ba03 TestWebKitAPI::Util::run(bool*)
        19  0x10eed34f0 -[DragAndDropSimulator runFrom:to:additionalItemRequestLocations:]
        20  0x10eef5614 TestWebKitAPI::DragAndDropTests_DataTransferSetDataValidURL_Test::TestBody()
        21  0x10f1d2189 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)
        22  0x10f1d20f2 testing::Test::Run()
        23  0x10f1d2a1f testing::TestInfo::Run()
        24  0x10f1d3037 testing::TestCase::Run()
        25  0x10f1daeb0 testing::internal::UnitTestImpl::RunAllTests()
        26  0x10f1daafd bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)
        27  0x10f1daa88 testing::UnitTest::Run()
        28  0x10f0fa3fe TestWebKitAPI::TestsController::run(int, char**)
        29  0x10f1b0362 main
        30  0x11a02710d start
        2020-04-04 19:39:09.193 TestWebKitAPI[67931:311616776] Encountered error: Error Domain=NSCocoaErrorDomain Code=3840 "No value." UserInfo={NSDebugDescription=No value.} while serializing JSON string.
        2020-04-04 19:39:09.193 TestWebKitAPI[67931:311616776] Expected JSON:  to match values: {
            dragover =     {
                "text/uri-list" = "";
            };
            drop =     {
                "text/uri-list" = "https://webkit.org/b/123";
            };
        }
Comment 8 Wenson Hsieh 2020-04-06 11:22:32 PDT Comment hidden (obsolete)
Comment 9 Alexey Proskuryakov 2020-04-06 13:18:02 PDT
Comment on attachment 395593 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        After updating a WebKit open source test runner to iOS 13, 4 pasteboard-related API tests began to fail in

Not enough fours here: should be "iOS 13.4".
Comment 10 Wenson Hsieh 2020-04-06 13:22:01 PDT
Comment on attachment 395593 [details]
Patch

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

>> Source/WebCore/ChangeLog:9
>> +        After updating a WebKit open source test runner to iOS 13, 4 pasteboard-related API tests began to fail in
> 
> Not enough fours here: should be "iOS 13.4".

Whoops — fixed!
Comment 11 Wenson Hsieh 2020-04-06 13:23:20 PDT
Created attachment 395610 [details]
Fix typo
Comment 12 Megan Gardner 2020-04-06 13:38:23 PDT
Comment on attachment 395610 [details]
Fix typo

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

> Source/WebCore/editing/Editor.cpp:432
>  

This seems like just a rework of the replaced code? Is there a reason we don't need to explicitly clear the new pasteboard anymore?

> Source/WebCore/platform/ios/WebItemProviderPasteboard.mm:859
>      _stagedRegistrationInfoLists = lists;

Was this the only logging that was left? I thought there was a lot more?
Comment 13 Wenson Hsieh 2020-04-06 14:16:13 PDT
Comment on attachment 395610 [details]
Fix typo

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

Thanks for the review!

>> Source/WebCore/editing/Editor.cpp:432
>>  
> 
> This seems like just a rework of the replaced code? Is there a reason we don't need to explicitly clear the new pasteboard anymore?

We were clearing out pasteboard data twice in this scenario, since `writeCustomData` already clears out whatever used to be on the pasteboard, so this change removes the redundant call to Pasteboard::clear(). There’s a bit more detail in the ChangeLog entry above.

>> Source/WebCore/platform/ios/WebItemProviderPasteboard.mm:859
>>      _stagedRegistrationInfoLists = lists;
> 
> Was this the only logging that was left? I thought there was a lot more?

AFAICT, this is all. I’ve been removing old logging statements as I was adding them — e.g. https://trac.webkit.org/r259541.
Comment 14 EWS 2020-04-06 17:00:11 PDT
Committed r259613: <https://trac.webkit.org/changeset/259613>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 395610 [details].