Commit 6bfaed76 authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

Revert "Check page exist after dispatch dragstart"

This reverts commit 2c03b1bd.

Reason for revert: tests fail in

https://ci.chromium.org/buildbot/chromium.webkit/WebKit%20Linux%20Trusty%20Leak/19267

leak log like

({"numberOfLiveDocuments":[1,2],"numberOfLiveFrames":[1,2],"numberOfLiveNodes":[4,9],"numberOfLivePausableObjects":[2,3],"numberOfLiveResourceFetchers":[1,2]})

Original change's description:
> Check page exist after dispatch dragstart
> 
> frame_->GetPage() may be null. need to check before use GetDragState
> This CL reorder the some checks in MouseEventManager::TryStartDrag
> to make sure GetPage is valid before start drag.
> 
> Bug: 843502
> Change-Id: Ifdf5b20d7132ca4b089c9a5b7652ebbd41370c33
> Reviewed-on: https://chromium-review.googlesource.com/1064878
> Commit-Queue: Ella Ge <eirage@chromium.org>
> Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#561262}

TBR=dcheng@chromium.org,nzolghadr@chromium.org,eirage@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 843502
Change-Id: I9412bbdf67a93acccbe4a75c5b50deee832eac97
Reviewed-on: https://chromium-review.googlesource.com/1072968Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561801}
parent 008cf51f
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<iframe id=innerFrame src=resources/drag-inside-iframe.html onload="run_test()"></iframe>
<script>
function onDragStart() {
innerFrame.parentElement.removeChild(innerFrame);
t.done();
}
var t = async_test("Remove iframe when start dragging should not crash")
function run_test() {
internals.settings.setTouchDragDropEnabled(true);
if (window.eventSender)
eventSender.gestureLongPress(50, 50);
}
</script>
......@@ -970,44 +970,40 @@ bool MouseEventManager::TryStartDrag(
mouse_down_pos_))
return false;
if (DispatchDragSrcEvent(EventTypeNames::dragstart, mouse_down_) !=
WebInputEventResult::kNotHandled)
return false;
// Dispatching the event could cause |frame_| to be detached.
if (!frame_->GetPage())
return false;
// If dispatching dragstart brings about another mouse down -- one way
// this will happen is if a DevTools user breaks within a dragstart
// handler and then clicks on the suspended page -- the drag state is
// reset. Hence, need to check if this particular drag operation can
// continue even if dispatchEvent() indicates no (direct) cancellation.
// Do that by checking if m_dragSrc is still set.
if (!GetDragState().drag_src_)
return false;
// Do not start dragging in password field.
// TODO(editing-dev): The use of
// updateStyleAndLayoutIgnorePendingStylesheets needs to be audited. See
// http://crbug.com/590369 for more details.
frame_->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
if (IsInPasswordField(
frame_->Selection().ComputeVisibleSelectionInDOMTree().Start()))
return false;
mouse_down_may_start_drag_ = false;
if (DispatchDragSrcEvent(EventTypeNames::dragstart, mouse_down_) ==
WebInputEventResult::kNotHandled &&
GetDragState().drag_src_) {
// TODO(editing-dev): The use of
// updateStyleAndLayoutIgnorePendingStylesheets needs to be audited. See
// http://crbug.com/590369 for more details.
frame_->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
mouse_down_may_start_drag_ = !IsInPasswordField(
frame_->Selection().ComputeVisibleSelectionInDOMTree().Start());
}
// Invalidate clipboard here against anymore pasteboard writing for
// security. The drag image can still be changed as we drag, but not
// the pasteboard data.
// Invalidate clipboard here against anymore pasteboard writing for security.
// The drag image can still be changed as we drag, but not the pasteboard
// data.
GetDragState().drag_data_transfer_->SetAccessPolicy(
DataTransferAccessPolicy::kImageWritable);
if (drag_controller.StartDrag(frame_, GetDragState(), event.Event(),
mouse_down_pos_))
return true;
// Drag was canned at the last minute - we owe m_dragSrc a DRAGEND event
DispatchDragSrcEvent(EventTypeNames::dragend, event.Event());
if (mouse_down_may_start_drag_) {
// Dispatching the event could cause Page to go away. Make sure it's still
// valid before trying to use DragController.
if (frame_->GetPage() &&
drag_controller.StartDrag(frame_, GetDragState(), event.Event(),
mouse_down_pos_))
return true;
// Drag was canned at the last minute - we owe m_dragSrc a DRAGEND event
DispatchDragSrcEvent(EventTypeNames::dragend, event.Event());
}
return false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment