Title: [238841] trunk/Source/WebInspectorUI
Revision
238841
Author
[email protected]
Date
2018-12-03 20:06:31 -0800 (Mon, 03 Dec 2018)

Log Message

Web Inspector: Audit: navigating while tests are running should stop and clear all results
https://bugs.webkit.org/show_bug.cgi?id=192317
<rdar://problem/46435222>

Reviewed by Joseph Pecoraro.

* UserInterface/Controllers/AuditManager.js:
(WI.AuditManager.prototype.async start):
(WI.AuditManager.prototype._handleFrameMainResourceDidChange):

* UserInterface/Views/AuditNavigationSidebarPanel.js:
(WI.AuditNavigationSidebarPanel.prototype.initialLayout):
Drive-by: pass the index of the saved result.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (238840 => 238841)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-12-04 04:03:46 UTC (rev 238840)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-12-04 04:06:31 UTC (rev 238841)
@@ -1,5 +1,21 @@
 2018-12-03  Devin Rousso  <[email protected]>
 
+        Web Inspector: Audit: navigating while tests are running should stop and clear all results
+        https://bugs.webkit.org/show_bug.cgi?id=192317
+        <rdar://problem/46435222>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Controllers/AuditManager.js:
+        (WI.AuditManager.prototype.async start):
+        (WI.AuditManager.prototype._handleFrameMainResourceDidChange):
+
+        * UserInterface/Views/AuditNavigationSidebarPanel.js:
+        (WI.AuditNavigationSidebarPanel.prototype.initialLayout):
+        Drive-by: pass the index of the saved result.
+
+2018-12-03  Devin Rousso  <[email protected]>
+
         Web Inspector: Audit: "Add Default Audits" shown when there are no filter results
         https://bugs.webkit.org/show_bug.cgi?id=192105
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js (238840 => 238841)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js	2018-12-04 04:03:46 UTC (rev 238840)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js	2018-12-04 04:06:31 UTC (rev 238841)
@@ -66,6 +66,8 @@
         if (!tests.length)
             return;
 
+        let mainResource = WI.networkManager.mainFrame.mainResource;
+
         this._runningState = WI.AuditManager.RunningState.Active;
         this._runningTests = tests;
         for (let test of this._runningTests)
@@ -81,6 +83,12 @@
         this._runningTests = [];
 
         this._addResult(result);
+
+        if (mainResource !== WI.networkManager.mainFrame.mainResource) {
+            // Navigated while tests were running.
+            for (let test of this._tests)
+                test.clearResult();
+        }
     }
 
     stop()
@@ -194,8 +202,12 @@
         if (!event.target.isMainFrame())
             return;
 
-        for (let test of this._tests)
-            test.clearResult();
+        if (this._runningState === WI.AuditManager.RunningState.Active)
+            this.stop();
+        else {
+            for (let test of this._tests)
+                test.clearResult();
+        }
     }
 
     addDefaultTestsIfNeeded()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/AuditNavigationSidebarPanel.js (238840 => 238841)


--- trunk/Source/WebInspectorUI/UserInterface/Views/AuditNavigationSidebarPanel.js	2018-12-04 04:03:46 UTC (rev 238840)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/AuditNavigationSidebarPanel.js	2018-12-04 04:06:31 UTC (rev 238841)
@@ -83,8 +83,9 @@
         for (let test of WI.auditManager.tests)
             this._addTest(test);
 
-        for (let result of WI.auditManager.results)
-            this._addResult(result);
+        WI.auditManager.results.forEach((result, i) => {
+            this._addResult(result, i);
+        });
 
         WI.auditManager.addEventListener(WI.AuditManager.Event.TestAdded, this._handleAuditTestAdded, this);
         WI.auditManager.addEventListener(WI.AuditManager.Event.TestCompleted, this._handleAuditTestCompleted, this);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to