LayoutTest inspector/dom-debugger/node-removed.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=154610
<rdar://problem/24801209>

Reviewed by Matt Baker.

Reenabled the test on all platforms.

The test was missing call to Debugger.setBreakpointsActive. Apparently at the time
it was written calling Debugger.setBreakpoint automatically activated breakpoint but
the behavior changed over time. I also removed some unnecessary code.

* inspector/dom-debugger/node-removed-expected.txt:
* inspector/dom-debugger/node-removed.html:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@250956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 1b43a09..74981ff 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,22 @@
+2019-10-09  Yury Semikhatsky  <yurys@chromium.org>
+
+        LayoutTest inspector/dom-debugger/node-removed.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=154610
+        <rdar://problem/24801209>
+
+        Reviewed by Matt Baker.
+
+        Reenabled the test on all platforms.
+
+        The test was missing call to Debugger.setBreakpointsActive. Apparently at the time
+        it was written calling Debugger.setBreakpoint automatically activated breakpoint but
+        the behavior changed over time. I also removed some unnecessary code.
+
+        * inspector/dom-debugger/node-removed-expected.txt:
+        * inspector/dom-debugger/node-removed.html:
+        * platform/gtk/TestExpectations:
+        * platform/mac/TestExpectations:
+
 2019-10-09  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Make fast/text/complex-initial-advance.html more robust
diff --git a/LayoutTests/inspector/dom-debugger/node-removed-expected.txt b/LayoutTests/inspector/dom-debugger/node-removed-expected.txt
index 709ab62..5588419 100644
--- a/LayoutTests/inspector/dom-debugger/node-removed-expected.txt
+++ b/LayoutTests/inspector/dom-debugger/node-removed-expected.txt
@@ -1,6 +1,6 @@
 Testing that DOM.childNodeRemoved is correctly triggered even when the element is moved while paused in the debugger on a DOMDebugger "node-removed" breakpoint.
 
-Found <script>
+Created output element.
 Stopped on DOM breakpoint
 PASS: onChildNodeRemoved called for #target_element
 PASS: onChildNodeInserted called for parent node #final_container
diff --git a/LayoutTests/inspector/dom-debugger/node-removed.html b/LayoutTests/inspector/dom-debugger/node-removed.html
index 1a33837..471ae58 100644
--- a/LayoutTests/inspector/dom-debugger/node-removed.html
+++ b/LayoutTests/inspector/dom-debugger/node-removed.html
@@ -2,8 +2,6 @@
 <head>
 <script src="../../http/tests/inspector/resources/protocol-test.js"></script>
 <script>
-window.onload = runTest;
-
 function removeNode()
 {
     document.getElementById("target_element").remove();
@@ -23,8 +21,7 @@
     InspectorProtocol.eventHandler["DOM.childNodeRemoved"] = onChildNodeRemoved;
     InspectorProtocol.eventHandler["DOM.childNodeInserted"] = onChildNodeInserted;
     InspectorProtocol.eventHandler["Debugger.paused"] = onDebuggerPaused;
-    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = onScriptParsed;
-    
+
     function createNodeAttributesMap(attributes)
     {
         var attributesMap = {};
@@ -82,7 +79,7 @@
     }
 
     function onDebuggerPaused(response)
-    {   
+    {
         ProtocolTest.log("Stopped on DOM breakpoint");
         InspectorProtocol.sendCommand("Runtime.evaluate", {"expression": "moveNode()"}, function() {
             InspectorProtocol.sendCommand("Debugger.resume");
@@ -90,20 +87,6 @@
         });
     }
 
-    function onScriptParsed(messageObject)
-    {
-        // FIXME: The DOM breakpoints are not working unless there's a JS brakpoint set. Setting a fake breakpoint to workaround that.
-        // https://bugs.webkit.org/show_bug.cgi?id=123770 
-        if (/node-removed\.html$/.test(messageObject.params.url) && messageObject.params.startLine > 20) {
-            InspectorProtocol.eventHandler["Debugger.scriptParsed"] = null;
-            ProtocolTest.log("Found <script>");
-            var location = {scriptId: messageObject.params.scriptId, lineNumber: messageObject.params.startLine + 2, columnNumber: 0};
-            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
-                InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
-            });
-        }
-    }
-
     function onGotDocument(response)
     {
         InspectorProtocol.checkForError(response);
@@ -122,22 +105,19 @@
     }
 
     InspectorProtocol.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.setBreakpointsActive", {active: true});
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
+    // Log something to precreate output element to avoid DOM events from test logs.
+    ProtocolTest.log("Created output element.");
 }
 </script>
 </head>
-<body>
+<body onload="runTest()">
 
 <p>Testing that DOM.childNodeRemoved is correctly triggered even when the element is moved while paused in the debugger on a DOMDebugger "node-removed" breakpoint.</p>
 
 <div id="target_element"></div>
 <div id="final_container"></div>
 
-<!-- Script tag required to workaround bug 123770. See onScriptParsed for details. -->
-<script>// Line 0
-function testFunction() { // Line 1
-    console.log("FAIL: Workaround JS code should not run.");
-}
-</script>
-
 </body>
 </html>
diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations
index f8707a5..eb57514 100644
--- a/LayoutTests/platform/gtk/TestExpectations
+++ b/LayoutTests/platform/gtk/TestExpectations
@@ -2403,8 +2403,6 @@
 webkit.org/b/145169 media/track/track-css-user-override.html [ Timeout Pass ]
 webkit.org/b/145171 fast/events/tabindex-focus-blur-all.html [ Crash Pass ]
 
-webkit.org/b/153468 inspector/dom-debugger/node-removed.html [ Timeout ]
-
 webkit.org/b/113127 media/track/track-prefer-captions.html [ Timeout ]
 
 webkit.org/b/144690 editing/spelling/context-menu-suggestions-multiword-selection.html [ Timeout ]
diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations
index 341b2aa..6576eaa 100644
--- a/LayoutTests/platform/mac/TestExpectations
+++ b/LayoutTests/platform/mac/TestExpectations
@@ -1062,7 +1062,6 @@
 webkit.org/b/168387 [ Debug ] inspector/debugger/tail-recursion.html [ Pass Timeout ]
 webkit.org/b/170127 inspector/dom-debugger/dom-breakpoints.html [ Pass Timeout ]
 webkit.org/b/148636 inspector/dom/getAccessibilityPropertiesForNode.html [ Pass Timeout ]
-webkit.org/b/154610 inspector/dom-debugger/node-removed.html [ Pass Timeout ]
 webkit.org/b/153039 [ Debug ] inspector/heap/garbageCollected.html [ Pass Timeout ]
 webkit.org/b/167408 [ Debug ] inspector/heap/gc.html [ Slow ]
 webkit.org/b/167184 [ Debug ] inspector/indexeddb/clearObjectStore.html [ Pass Timeout ]