| Summary: | DND causes javascript error | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Michael Klein <michael.klein> | ||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P1 | ||||||
| Version: | 1.4 | ||||||
| Target Milestone: | 1.4 RC2 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 196225 [details]
Proposed fix
The fix is to stop the propagation of dragEnd event in DNDSupport.js#_dragEndHandler.
Applied patch to CVS HEAD and v14_Maintenance branch. |
Environment: Firefox 4.0.1/IE 9.0.8112 on Win7 The bug occurs using RAP 1.4 RC1 (maintenance branch) and HEAD Steps to reproduce: * create a composite * add a label to the composite * add drag support to the composite * add drag support to the label * try to drag the label and drop it anywhere (don't have to be a drop target) -> Javascript error occurred Expected: Regardless whether or not this is a reasonable use case, nested drag sources should never cause a javascript error which ends in an client crash. Here is a snippet to reproduce: public class Snippet implements IEntryPoint { public int createUI() { Display display = new Display(); Shell shell = new Shell(display, SWT.TITLE); createContent(shell); shell.layout(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return 0; } private void createContent(Shell shell) { shell.setLayout(new GridLayout(2, false)); // drag label Composite labelDragParent = new Composite(shell, SWT.NONE); labelDragParent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); labelDragParent.setLayout(new GridLayout(1, false)); Label labelDrag = new Label(labelDragParent, SWT.BORDER); labelDrag.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); labelDrag.setText("Drag"); // drop label Composite labelDropParent = new Composite(shell, SWT.NONE); labelDropParent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); labelDropParent.setLayout(new GridLayout(1, false)); Label labelDrop = new Label(labelDropParent, SWT.BORDER); labelDrop.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); labelDrop.setText("Drop"); // drag support DragSource dragSource = new DragSource(labelDragParent, DND.DROP_MOVE); dragSource.setTransfer(new Transfer[] {TextTransfer.getInstance()}); dragSource = new DragSource(labelDrag, DND.DROP_MOVE); dragSource.setTransfer(new Transfer[] {TextTransfer.getInstance()}); } }