1 <html> 2 <head> 3 <script> 4 function foo() { 5 if (event.type == "DOMNodeInserted" && event.target.nodeType == 3) 6 document.body.innerHTML = "PASSED"; 7 } 8 9 function runTest() { 10 if (!window.layoutTestController) 11 return; 12 13 window.layoutTestController.dumpAsText(); 14 15 document.addEventListener("DOMNodeInserted", function() { foo() }, true); 16 17 // Select the element 'dragSource'. 18 var selection = window.getSelection(); 19 var range = document.createRange(); 20 range.selectNode(document.getElementById("dragSource")); 21 selection.addRange(range); 22 23 // Drag the source text to the target text. 24 var source = document.getElementById('dragSource'); 25 var target = document.getElementById('dragTarget'); 26 eventSender.mouseMoveTo(source.offsetLeft + 2, source.offsetTop + 2); 27 eventSender.mouseDown(); 28 eventSender.leapForward(500); 29 eventSender.mouseMoveTo(target.offsetLeft + target.offsetWidth / 2, 30 target.offsetTop + target.offsetHeight / 2); 31 eventSender.mouseUp(); 32 } 33 </script> 34 </head> 35 <body contenteditable="true" onload="runTest()"> 36 <p>This test tests for a crash when a DOM mutation event listener 37 modifies the text during a drop. If the test doesn't crash, all is good. 38 <p id="dragSource">drag source text 39 <p id="dragTarget">drag dest text 40 </body> 41 </html>