Web Inspector: http/tests/inspector/target/pause-on-inline-debugger-statement.html is crashing in debug
https://bugs.webkit.org/show_bug.cgi?id=204901

Reviewed by Devin Rousso.

Restructured the test to avoid inadvertent alert() when navigating to a new
process. New logs are printed after inspected page has navigated.

* http/tests/inspector/target/pause-on-inline-debugger-statement-expected.txt:
* http/tests/inspector/target/pause-on-inline-debugger-statement.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@253179 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index d3a4f71..57d076d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,5 +1,18 @@
 2019-12-05  Yury Semikhatsky  <yurys@chromium.org>
 
+        Web Inspector: http/tests/inspector/target/pause-on-inline-debugger-statement.html is crashing in debug
+        https://bugs.webkit.org/show_bug.cgi?id=204901
+
+        Reviewed by Devin Rousso.
+
+        Restructured the test to avoid inadvertent alert() when navigating to a new
+        process. New logs are printed after inspected page has navigated.
+
+        * http/tests/inspector/target/pause-on-inline-debugger-statement-expected.txt:
+        * http/tests/inspector/target/pause-on-inline-debugger-statement.html:
+
+2019-12-05  Yury Semikhatsky  <yurys@chromium.org>
+
         Web Inspector: Avoid using Runtime.executionContextCreated to figure out the iframe's contentDocument node.
         https://bugs.webkit.org/show_bug.cgi?id=122764
         <rdar://problem/15222136>
diff --git a/LayoutTests/http/tests/inspector/target/pause-on-inline-debugger-statement-expected.txt b/LayoutTests/http/tests/inspector/target/pause-on-inline-debugger-statement-expected.txt
index b2f668e..58f6521 100644
--- a/LayoutTests/http/tests/inspector/target/pause-on-inline-debugger-statement-expected.txt
+++ b/LayoutTests/http/tests/inspector/target/pause-on-inline-debugger-statement-expected.txt
@@ -1,2 +1,7 @@
-ALERT: PASS: Should pause on debugger statement.
 Test page used to check that execution will break on inline 'debugger' statement after cross-origin navigation.
+
+
+== Running test suite: Target.PSON
+-- Running test case: InlineDebuggerStatement
+PASS: Should pause on debugger statement.
+
diff --git a/LayoutTests/http/tests/inspector/target/pause-on-inline-debugger-statement.html b/LayoutTests/http/tests/inspector/target/pause-on-inline-debugger-statement.html
index a694dd2..9d0d8e9 100644
--- a/LayoutTests/http/tests/inspector/target/pause-on-inline-debugger-statement.html
+++ b/LayoutTests/http/tests/inspector/target/pause-on-inline-debugger-statement.html
@@ -11,24 +11,19 @@
     suite.addTestCase({
         name: "InlineDebuggerStatement",
         description: "Check that new provisional page can be paused before navigation.",
-        test(resolve, reject) {
-            WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused)
-            .then(() => {
-                InspectorTest.pass(`Should pause on debugger statement.`);
-
-                // Wait for page reload event to avoid race between test results flushing and the test completion.
-                let pageLoadPromise = InspectorTest.awaitEvent(FrontendTestHarness.Event.TestPageDidLoad);
-                //WI.mainTarget.DebuggerAgent.
-                Promise.resolve().then(() => {
-                    WI.debuggerManager.resume();
-                });
-                return pageLoadPromise;
-            })
-            .then(resolve);
-
-
+        async test() {
             const url = "http://localhost:8000/inspector/target/resources/inline-debugger-statement.html";
             WI.mainTarget.PageAgent.navigate(url);
+
+            await WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused);
+
+            // Wait for page reload event to avoid race between test results flushing and the test completion.
+            await Promise.all([
+                InspectorTest.awaitEvent(FrontendTestHarness.Event.TestPageDidLoad),
+                WI.debuggerManager.resume()
+            ]);
+
+            InspectorTest.pass(`Should pause on debugger statement.`);
         }
     });