Open Bug 1649134 Opened 5 years ago Updated 5 years ago

DragSession can end while paused in debugger

Categories

(DevTools :: Debugger, defect, P3)

77 Branch
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: rob, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0

Steps to reproduce:

  • Go to https://mdn.github.io/dom-examples/drag-and-drop/copy-move-DataTransfer.html
  • Open the debugger in devtools, browse to copy-move-DataTransfer.html
  • Set a breakpoint on line 48 (should be console.log("Drop") in function drop_handler)
  • Try to drag the "select this element and drag to the Copy Drop Zone" into the Copy Drop Zone
  • The breakpoint is reached - if you evaluate ev.dataTransfer in the console, you get null, and if you continue execution of the script, you get an error:

TypeError: ev.dataTransfer is null

Actual results:

ev.dataTransfer is null

Expected results:

ev.dataTransfer should be a valid DataTransfer object

This also happens if I make a copy of that page and insert a debugger; line at line 48.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Debugger
Product: Firefox → DevTools

What is happening is that the drag processing logic does not pause properly, so while the drop handler is paused at line 48, the dragend handler will fire, calling ev.dataTransfer.clearData(); on line 68, so that when you resume and get to line 52, the dataTransfer data has been erased already.

Blocks: dbg-r2c
Severity: -- → S3
Priority: -- → P3
Summary: event.dataTransfer is null if you set a breakpoint in an ondrop handler in the debugger → DragSession can end while paused in debugger
You need to log in before you can comment on or make changes to this bug.