Changeset 259534 in webkit


Ignore:
Timestamp:
Apr 4, 2020 11:52:15 AM (4 years ago)
Author:
Wenson Hsieh
Message:

Add even more logging to try and diagnose <webkit.org/b/209685>
https://bugs.webkit.org/show_bug.cgi?id=210008

Reviewed by Tim Horton.

Source/WebCore:

  • platform/ios/WebItemProviderPasteboard.mm:

(-[WebItemProviderPasteboard stageRegistrationLists:]):

Source/WebKit:

Revert all (except one) of the logging statements added in r259518, and add several new ones. This last logging
pass demonstrated that DragController had failed to start a drag, since -[WKContentView _didHandleDragStartRequest:]
receives word that the drag has started, yet there are no staged drag items.

  • UIProcess/ios/DragDropInteractionState.mm:

(WebKit::DragDropInteractionState::stageDragItem):
(WebKit::DragDropInteractionState::clearStagedDragSource):

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _didHandleAdditionalDragItemsRequest:]):
(-[WKContentView cleanUpDragSourceSessionState]):
(-[WKContentView _didPerformDragOperation:]):
(-[WKContentView _prepareToDragPromisedAttachment:]):
(-[WKContentView _dragInteraction:prepareForSession:completion:]):
(-[WKContentView dragInteraction:itemsForBeginningSession:]):
(-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
(-[WKContentView dragInteraction:sessionWillBegin:]):
(-[WKContentView dragInteraction:session:didEndWithOperation:]):
(-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
(-[WKContentView dropInteraction:canHandleSession:]):
(-[WKContentView dropInteraction:sessionDidEnter:]):
(-[WKContentView dropInteraction:sessionDidExit:]):
(-[WKContentView dropInteraction:performDrop:]):
(-[WKContentView dropInteraction:sessionDidEnd:]):

Tools:

Replace old logging with new logging (in different places).

  • TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:

(-[DragAndDropSimulator runFrom:to:additionalItemRequestLocations:]):
(-[DragAndDropSimulator _advanceProgress]):
(-[DragAndDropSimulator _webView:adjustedDataInteractionItemProvidersForItemProvider:representingObjects:additionalData:]):

Rule out the possibility that the WebKit client (in this case, the drag and drop simulator) is overriding the
list of drag items by logging the given NSItemProvider that will be used to start the drag.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r259533 r259534  
     12020-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Add even more logging to try and diagnose <webkit.org/b/209685>
     4        https://bugs.webkit.org/show_bug.cgi?id=210008
     5
     6        Reviewed by Tim Horton.
     7
     8        * platform/ios/WebItemProviderPasteboard.mm:
     9        (-[WebItemProviderPasteboard stageRegistrationLists:]):
     10
    1112020-04-04  Myles C. Maxfield  <mmaxfield@apple.com>
    212
  • trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm

    r259518 r259534  
    857857{
    858858    ASSERT(lists.count);
     859    NSLog(@"%s - %@", __PRETTY_FUNCTION__, lists);
    859860    _stagedRegistrationInfoLists = lists;
    860861}
  • trunk/Source/WebKit/ChangeLog

    r259528 r259534  
     12020-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Add even more logging to try and diagnose <webkit.org/b/209685>
     4        https://bugs.webkit.org/show_bug.cgi?id=210008
     5
     6        Reviewed by Tim Horton.
     7
     8        Revert all (except one) of the logging statements added in r259518, and add several new ones. This last logging
     9        pass demonstrated that DragController had failed to start a drag, since -[WKContentView _didHandleDragStartRequest:]
     10        receives word that the drag has started, yet there are no staged drag items.
     11
     12        * UIProcess/ios/DragDropInteractionState.mm:
     13        (WebKit::DragDropInteractionState::stageDragItem):
     14        (WebKit::DragDropInteractionState::clearStagedDragSource):
     15        * UIProcess/ios/WKContentViewInteraction.mm:
     16        (-[WKContentView _didHandleAdditionalDragItemsRequest:]):
     17        (-[WKContentView cleanUpDragSourceSessionState]):
     18        (-[WKContentView _didPerformDragOperation:]):
     19        (-[WKContentView _prepareToDragPromisedAttachment:]):
     20        (-[WKContentView _dragInteraction:prepareForSession:completion:]):
     21        (-[WKContentView dragInteraction:itemsForBeginningSession:]):
     22        (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
     23        (-[WKContentView dragInteraction:sessionWillBegin:]):
     24        (-[WKContentView dragInteraction:session:didEndWithOperation:]):
     25        (-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
     26        (-[WKContentView dropInteraction:canHandleSession:]):
     27        (-[WKContentView dropInteraction:sessionDidEnter:]):
     28        (-[WKContentView dropInteraction:sessionDidExit:]):
     29        (-[WKContentView dropInteraction:performDrop:]):
     30        (-[WKContentView dropInteraction:sessionDidEnd:]):
     31
    1322020-04-03  David Kilzer  <ddkilzer@apple.com>
    233
  • trunk/Source/WebKit/UIProcess/ios/DragDropInteractionState.mm

    r250256 r259534  
    340340void DragDropInteractionState::stageDragItem(const DragItem& item, UIImage *dragImage)
    341341{
     342    NSLog(@"%s - source action := %02x", __PRETTY_FUNCTION__, item.sourceAction);
    342343    static NSInteger currentDragSourceItemIdentifier = 0;
    343344
     
    364365void DragDropInteractionState::clearStagedDragSource(DidBecomeActive didBecomeActive)
    365366{
     367    if (m_stagedDragSource)
     368        NSLog(@"%s - source action := %02x", __PRETTY_FUNCTION__, m_stagedDragSource->action);
     369
    366370    if (didBecomeActive == DidBecomeActive::Yes)
    367371        m_activeDragSources.append(stagedDragSource());
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r259518 r259534  
    70667066    NSArray *dragItemsToAdd = [self _itemsForBeginningOrAddingToSessionWithRegistrationLists:registrationLists stagedDragSource:stagedDragSource];
    70677067
    7068     NSLog(@"Drag session: %p adding %tu items", _dragDropInteractionState.dragSession(), dragItemsToAdd.count);
     7068    RELEASE_LOG(DragAndDrop, "Drag session: %p adding %tu items", _dragDropInteractionState.dragSession(), dragItemsToAdd.count);
    70697069    _dragDropInteractionState.clearStagedDragSource(dragItemsToAdd.count ? WebKit::DragDropInteractionState::DidBecomeActive::Yes : WebKit::DragDropInteractionState::DidBecomeActive::No);
    70707070
     
    71357135
    71367136    if (_dragDropInteractionState.dragSession() || _dragDropInteractionState.isPerformingDrop())
    7137         NSLog(@"Cleaning up dragging state (has pending operation: %d)", [[WebItemProviderPasteboard sharedInstance] hasPendingOperation]);
     7137        RELEASE_LOG(DragAndDrop, "Cleaning up dragging state (has pending operation: %d)", [[WebItemProviderPasteboard sharedInstance] hasPendingOperation]);
    71387138
    71397139    if (![[WebItemProviderPasteboard sharedInstance] hasPendingOperation]) {
     
    72197219- (void)_didPerformDragOperation:(BOOL)handled
    72207220{
    7221     NSLog(@"Finished performing drag controller operation (handled: %d)", handled);
     7221    RELEASE_LOG(DragAndDrop, "Finished performing drag controller operation (handled: %d)", handled);
    72227222    [[WebItemProviderPasteboard sharedInstance] decrementPendingOperationCount];
    72237223    id <UIDropSession> dropSession = _dragDropInteractionState.dropSession();
     
    72657265    ASSERT(numberOfAdditionalTypes == info.additionalData.size());
    72667266
    7267     NSLog(@"Drag session: %p preparing to drag blob: %s with attachment identifier: %s", session.get(), info.blobURL.string().utf8().data(), info.attachmentIdentifier.utf8().data());
     7267    RELEASE_LOG(DragAndDrop, "Drag session: %p preparing to drag blob: %s with attachment identifier: %s", session.get(), info.blobURL.string().utf8().data(), info.attachmentIdentifier.utf8().data());
    72687268
    72697269    NSString *utiType = info.contentType;
     
    72977297        auto attachment = strongSelf->_page->attachmentForIdentifier(info.attachmentIdentifier);
    72987298        if (attachment && attachment->fileWrapper()) {
    7299             NSLog(@"Drag session: %p delivering promised attachment: %s at path: %@", session.get(), info.attachmentIdentifier.utf8().data(), destinationURL.path);
     7299            RELEASE_LOG(DragAndDrop, "Drag session: %p delivering promised attachment: %s at path: %@", session.get(), info.attachmentIdentifier.utf8().data(), destinationURL.path);
    73007300            NSError *fileWrapperError = nil;
    73017301            if ([attachment->fileWrapper() writeToURL:destinationURL options:0 originalContentsURL:nil error:&fileWrapperError])
     
    76207620    [self _cancelLongPressGestureRecognizer];
    76217621
    7622     NSLog(@"Preparing for drag session: %p", session);
     7622    RELEASE_LOG(DragAndDrop, "Preparing for drag session: %p", session);
    76237623    if (self.currentDragOrDropSession) {
    76247624        // FIXME: Support multiple simultaneous drag sessions in the future.
    7625         NSLog(@"Drag session failed: %p (a current drag session already exists)", session);
     7625        RELEASE_LOG(DragAndDrop, "Drag session failed: %p (a current drag session already exists)", session);
    76267626        completion();
    76277627        return;
     
    76357635    _page->requestDragStart(dragOrigin, WebCore::roundedIntPoint([self convertPoint:dragOrigin toView:self.window]), self._allowedDragSourceActions);
    76367636
    7637     NSLog(@"Drag session requested: %p at origin: {%d, %d}", session, dragOrigin.x(), dragOrigin.y());
     7637    RELEASE_LOG(DragAndDrop, "Drag session requested: %p at origin: {%d, %d}", session, dragOrigin.x(), dragOrigin.y());
    76387638}
    76397639
     
    76417641{
    76427642    ASSERT(interaction == _dragInteraction);
    7643     NSLog(@"Drag items requested for session: %p", session);
     7643    RELEASE_LOG(DragAndDrop, "Drag items requested for session: %p", session);
    76447644    if (_dragDropInteractionState.dragSession() != session) {
    7645         NSLog(@"Drag session failed: %p (delegate session does not match %p)", session, _dragDropInteractionState.dragSession());
     7645        RELEASE_LOG(DragAndDrop, "Drag session failed: %p (delegate session does not match %p)", session, _dragDropInteractionState.dragSession());
    76467646        return @[ ];
    76477647    }
    76487648
    76497649    if (!_dragDropInteractionState.hasStagedDragSource()) {
    7650         NSLog(@"Drag session failed: %p (missing staged drag source)", session);
     7650        RELEASE_LOG(DragAndDrop, "Drag session failed: %p (missing staged drag source)", session);
    76517651        return @[ ];
    76527652    }
     
    76587658        _page->dragCancelled();
    76597659
    7660     NSLog(@"Drag session: %p starting with %tu items", session, [dragItems count]);
     7660    RELEASE_LOG(DragAndDrop, "Drag session: %p starting with %tu items", session, [dragItems count]);
    76617661    _dragDropInteractionState.clearStagedDragSource([dragItems count] ? WebKit::DragDropInteractionState::DidBecomeActive::Yes : WebKit::DragDropInteractionState::DidBecomeActive::No);
    76627662
     
    76777677- (void)dragInteraction:(UIDragInteraction *)interaction willAnimateLiftWithAnimator:(id <UIDragAnimating>)animator session:(id <UIDragSession>)session
    76787678{
    7679     NSLog(@"Drag session willAnimateLiftWithAnimator: %p", session);
     7679    RELEASE_LOG(DragAndDrop, "Drag session willAnimateLiftWithAnimator: %p", session);
    76807680    if (_dragDropInteractionState.anyActiveDragSourceIs(WebCore::DragSourceActionSelection)) {
    76817681        [self cancelActiveTextInteractionGestures];
     
    76947694#endif
    76957695        if (finalPosition == UIViewAnimatingPositionStart) {
    7696             NSLog(@"Drag session ended at start: %p", session);
     7696            RELEASE_LOG(DragAndDrop, "Drag session ended at start: %p", session);
    76977697            // The lift was canceled, so -dropInteraction:sessionDidEnd: will never be invoked. This is the last chance to clean up.
    76987698            [protectedSelf cleanUpDragSourceSessionState];
     
    77017701#if !RELEASE_LOG_DISABLED
    77027702        else
    7703             NSLog(@"Drag session did not end at start: %p", session);
     7703            RELEASE_LOG(DragAndDrop, "Drag session did not end at start: %p", session);
    77047704#endif
    77057705    }];
     
    77087708- (void)dragInteraction:(UIDragInteraction *)interaction sessionWillBegin:(id <UIDragSession>)session
    77097709{
    7710     NSLog(@"Drag session beginning: %p", session);
     7710    RELEASE_LOG(DragAndDrop, "Drag session beginning: %p", session);
    77117711    id <WKUIDelegatePrivate> uiDelegate = self.webViewUIDelegate;
    77127712    if ([uiDelegate respondsToSelector:@selector(_webView:dataInteraction:sessionWillBegin:)])
     
    77207720- (void)dragInteraction:(UIDragInteraction *)interaction session:(id <UIDragSession>)session didEndWithOperation:(UIDropOperation)operation
    77217721{
    7722     NSLog(@"Drag session ended: %p (with operation: %tu, performing operation: %d, began dragging: %d)", session, operation, _dragDropInteractionState.isPerformingDrop(), _dragDropInteractionState.didBeginDragging());
     7722    RELEASE_LOG(DragAndDrop, "Drag session ended: %p (with operation: %tu, performing operation: %d, began dragging: %d)", session, operation, _dragDropInteractionState.isPerformingDrop(), _dragDropInteractionState.didBeginDragging());
    77237723
    77247724    [self _restoreCalloutBarIfNeeded];
     
    77547754- (void)dragInteraction:(UIDragInteraction *)interaction item:(UIDragItem *)item willAnimateCancelWithAnimator:(id <UIDragAnimating>)animator
    77557755{
    7756     NSLog(@"Drag interaction willAnimateCancelWithAnimator");
     7756    RELEASE_LOG(DragAndDrop, "Drag interaction willAnimateCancelWithAnimator");
    77577757    [animator addCompletion:[protectedSelf = retainPtr(self), page = _page] (UIViewAnimatingPosition finalPosition) {
    7758         NSLog(@"Drag interaction willAnimateCancelWithAnimator (animation completion block fired)");
     7758        RELEASE_LOG(DragAndDrop, "Drag interaction willAnimateCancelWithAnimator (animation completion block fired)");
    77597759        page->dragCancelled();
    77607760        if (auto completion = protectedSelf->_dragDropInteractionState.takeDragCancelSetDownBlock()) {
     
    77867786    // FIXME: Support multiple simultaneous drop sessions in the future.
    77877787    id <UIDragDropSession> dragOrDropSession = self.currentDragOrDropSession;
    7788     NSLog(@"Can handle drag session: %p with local session: %p existing session: %p?", session, session.localDragSession, dragOrDropSession);
     7788    RELEASE_LOG(DragAndDrop, "Can handle drag session: %p with local session: %p existing session: %p?", session, session.localDragSession, dragOrDropSession);
    77897789
    77907790    return !dragOrDropSession || session.localDragSession == dragOrDropSession;
     
    77937793- (void)dropInteraction:(UIDropInteraction *)interaction sessionDidEnter:(id <UIDropSession>)session
    77947794{
    7795     NSLog(@"Drop session entered: %p with %tu items", session, session.items.count);
     7795    RELEASE_LOG(DragAndDrop, "Drop session entered: %p with %tu items", session, session.items.count);
    77967796    auto dragData = [self dragDataForDropSession:session dragDestinationAction:[self _dragDestinationActionForDropSession:session]];
    77977797
     
    78357835- (void)dropInteraction:(UIDropInteraction *)interaction sessionDidExit:(id <UIDropSession>)session
    78367836{
    7837     NSLog(@"Drop session exited: %p with %tu items", session, session.items.count);
     7837    RELEASE_LOG(DragAndDrop, "Drop session exited: %p with %tu items", session, session.items.count);
    78387838    [[WebItemProviderPasteboard sharedInstance] setItemProviders:extractItemProvidersFromDropSession(session)];
    78397839
     
    78677867    BOOL shouldSnapshotView = ![self _handleDropByInsertingImagePlaceholders:itemProviders session:session];
    78687868
    7869     NSLog(@"Loading data from %tu item providers for session: %p", itemProviders.count, session);
     7869    RELEASE_LOG(DragAndDrop, "Loading data from %tu item providers for session: %p", itemProviders.count, session);
    78707870    // Always loading content from the item provider ensures that the web process will be allowed to call back in to the UI
    78717871    // process to access pasteboard contents at a later time. Ideally, we only need to do this work if we're over a file input
     
    78747874    RetainPtr<WKContentView> retainedSelf(self);
    78757875    [[WebItemProviderPasteboard sharedInstance] doAfterLoadingProvidedContentIntoFileURLs:[retainedSelf, capturedDragData = WTFMove(dragData), shouldSnapshotView] (NSArray *fileURLs) mutable {
    7876         NSLog(@"Loaded data into %tu files", fileURLs.count);
     7876        RELEASE_LOG(DragAndDrop, "Loaded data into %tu files", fileURLs.count);
    78777877        Vector<String> filenames;
    78787878        for (NSURL *fileURL in fileURLs)
     
    79367936- (void)dropInteraction:(UIDropInteraction *)interaction sessionDidEnd:(id <UIDropSession>)session
    79377937{
    7938     NSLog(@"Drop session ended: %p (performing operation: %d, began dragging: %d)", session, _dragDropInteractionState.isPerformingDrop(), _dragDropInteractionState.didBeginDragging());
     7938    RELEASE_LOG(DragAndDrop, "Drop session ended: %p (performing operation: %d, began dragging: %d)", session, _dragDropInteractionState.isPerformingDrop(), _dragDropInteractionState.didBeginDragging());
    79397939    if (_dragDropInteractionState.isPerformingDrop()) {
    79407940        // In the case where we are performing a drop, wait until after the drop is handled in the web process to reset drag and drop interaction state.
  • trunk/Tools/ChangeLog

    r259531 r259534  
     12020-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Add even more logging to try and diagnose <webkit.org/b/209685>
     4        https://bugs.webkit.org/show_bug.cgi?id=210008
     5
     6        Reviewed by Tim Horton.
     7
     8        Replace old logging with new logging (in different places).
     9
     10        * TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:
     11        (-[DragAndDropSimulator runFrom:to:additionalItemRequestLocations:]):
     12        (-[DragAndDropSimulator _advanceProgress]):
     13        (-[DragAndDropSimulator _webView:adjustedDataInteractionItemProvidersForItemProvider:representingObjects:additionalData:]):
     14
     15        Rule out the possibility that the WebKit client (in this case, the drag and drop simulator) is overriding the
     16        list of drag items by logging the given NSItemProvider that will be used to start the drag.
     17
    1182020-04-04  Peng Liu  <peng.liu6@apple.com>
    219
  • trunk/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm

    r259518 r259534  
    456456        _dragSession = adoptNS([[MockDragSession alloc] initWithWindow:[_webView window] allowMove:self.shouldAllowMoveOperation]);
    457457        [_dragSession setMockLocationInWindow:_startLocation];
    458         NSLog(@"%s - preparing for drag session", __PRETTY_FUNCTION__);
    459458        [(id <UIDragInteractionDelegate_ForWebKitOnly>)[_webView dragInteractionDelegate] _dragInteraction:[_webView dragInteraction] prepareForSession:_dragSession.get() completion:[strongSelf = retainPtr(self)] {
    460             NSLog(@"%s - done preparing for drag session with phase: %ld", __PRETTY_FUNCTION__, strongSelf->_phase);
    461459            if (strongSelf->_phase == DragAndDropPhaseCancelled)
    462460                return;
     
    605603    }
    606604
    607     NSLog(@"%s - phase: %ld", __PRETTY_FUNCTION__, _phase);
    608605    switch (_phase) {
    609606    case DragAndDropPhaseBeginning: {
     
    611608        NSArray *items = [[_webView dragInteractionDelegate] dragInteraction:[_webView dragInteraction] itemsForBeginningSession:_dragSession.get()];
    612609        if (!items.count) {
     610            NSLog(@"%s (found no drag items when beginning session)", __PRETTY_FUNCTION__);
    613611            _phase = DragAndDropPhaseCancelled;
    614612            _currentProgress = 1;
     
    901899- (NSArray *)_webView:(WKWebView *)webView adjustedDataInteractionItemProvidersForItemProvider:(NSItemProvider *)itemProvider representingObjects:(NSArray *)representingObjects additionalData:(NSDictionary *)additionalData
    902900{
     901    NSLog(@"%s - self.convertItemProvidersBlock := %p; itemProvider.registeredTypeIdentifiers := %@", __PRETTY_FUNCTION__, self.convertItemProvidersBlock, itemProvider.registeredTypeIdentifiers);
    903902    return self.convertItemProvidersBlock ? self.convertItemProvidersBlock(itemProvider, representingObjects, additionalData) : @[ itemProvider ];
    904903}
Note: See TracChangeset for help on using the changeset viewer.