REGRESSION: [ Mac wk2 ] http/tests/inspector/target/provisional-load-cancels-previous...
authoryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jan 2020 04:42:34 +0000 (04:42 +0000)
committeryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jan 2020 04:42:34 +0000 (04:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=205473
<rdar://problem/58093690>

Source/WebInspectorUI:

The failure was due to attempts to add output to the test page which could be not fully
loaded after navigation. To make it deterministic it is now possible to keep provisional
navigation paused and to defer output until the test page is ready.

Reviewed by Brian Burg.

* UserInterface/Protocol/Target.js:
(WI.Target.prototype.initialize):
(WI.Target.prototype._resumeIfPaused): extracted resume logic in a method that
can be overridden in the tests.

* UserInterface/Test/FrontendTestHarness.js:
(FrontendTestHarness.prototype.deferOutputUntilTestPageIsReloaded): allow to pause
output when navigation is started via protocol commands rather than the test harness.

LayoutTests:

Reviewed by Brian Burg.

Keep provisional page paused until second navigation replaces it and also
defer output until test page is fully initialized after navigation.

* http/tests/inspector/target/provisional-load-cancels-previous-load.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254111 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/target/provisional-load-cancels-previous-load.html
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Protocol/Target.js
Source/WebInspectorUI/UserInterface/Test/FrontendTestHarness.js

index d93936b..dcb2b4d 100644 (file)
@@ -1,3 +1,16 @@
+2020-01-06  Yury Semikhatsky  <yurys@chromium.org>
+
+        REGRESSION: [ Mac wk2 ] http/tests/inspector/target/provisional-load-cancels-previous-load.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=205473
+        <rdar://problem/58093690>
+
+        Reviewed by Brian Burg.
+
+        Keep provisional page paused until second navigation replaces it and also
+        defer output until test page is fully initialized after navigation.
+
+        * http/tests/inspector/target/provisional-load-cancels-previous-load.html:
+
 2020-01-06  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         Unreviewed test gardening for WinCairo port after r253326 and r250849.
index 2662622..3772b45 100644 (file)
@@ -18,6 +18,10 @@ function test()
             const url = "http://localhost:8000/inspector/target/provisional-load-cancels-previous-load.html";
             let navigatedTwice = false;
 
+            let originalResumeIfPaused = WI.Target.prototype._resumeIfPaused;
+            // Keep first provisional navigation paused.
+            WI.Target.prototype._resumeIfPaused = () => {};
+
             WI.targetManager.addEventListener(WI.TargetManager.Event.TargetAdded, (event) => {
                 let target = event.data.target;
                 let targetId = targetIdMap.get(target.identifier);
@@ -26,6 +30,9 @@ function test()
                 InspectorTest.expectTrue(target.isPaused, `Target ${targetId} should be paused on start.`);
                 if (!navigatedTwice) {
                     navigatedTwice = true;
+                    WI.Target.prototype._resumeIfPaused = originalResumeIfPaused;
+
+                    InspectorTest.deferOutputUntilTestPageIsReloaded();
 
                     // Send two consequtive navigation requests. The latter will cancel provisional
                     // load of the former.
index c2c41ab..dcc9dc5 100644 (file)
@@ -1,3 +1,24 @@
+2020-01-06  Yury Semikhatsky  <yurys@chromium.org>
+
+        REGRESSION: [ Mac wk2 ] http/tests/inspector/target/provisional-load-cancels-previous-load.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=205473
+        <rdar://problem/58093690>
+
+        The failure was due to attempts to add output to the test page which could be not fully
+        loaded after navigation. To make it deterministic it is now possible to keep provisional
+        navigation paused and to defer output until the test page is ready.
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Protocol/Target.js:
+        (WI.Target.prototype.initialize):
+        (WI.Target.prototype._resumeIfPaused): extracted resume logic in a method that
+        can be overridden in the tests.
+
+        * UserInterface/Test/FrontendTestHarness.js:
+        (FrontendTestHarness.prototype.deferOutputUntilTestPageIsReloaded): allow to pause
+        output when navigation is started via protocol commands rather than the test harness.
+
 2020-01-06  Nikita Vasilyev  <nvasilyev@apple.com>
 
         Web Inspector: Color picker: make it keyboard accessible
index ca385fe..c26a19a 100644 (file)
@@ -100,6 +100,11 @@ WI.Target = class Target extends WI.Object
                 this.InspectorAgent.initialized();
         });
 
+        this._resumeIfPaused();
+    }
+
+    _resumeIfPaused()
+    {
         if (this._isPaused) {
             console.assert(this._parentTarget.hasCommand("Target.resume"));
             this._parentTarget.TargetAgent.resume(this._identifier, (error) => {
index 3acc330..e68c97f 100644 (file)
@@ -127,6 +127,12 @@ FrontendTestHarness = class FrontendTestHarness extends TestHarness
         }
     }
 
+    deferOutputUntilTestPageIsReloaded()
+    {
+        console.assert(!this._testPageIsReloading);
+        this._testPageIsReloading = true;
+    }
+
     testPageDidLoad()
     {
         if (this.dumpActivityToSystemConsole)