Web Inspector: Sources: breakpoints should be disabled when an audit is running
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Mar 2019 20:50:08 +0000 (20:50 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Mar 2019 20:50:08 +0000 (20:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195105
<rdar://problem/48441373>

Reviewed by Joseph Pecoraro.

* UserInterface/Views/SourcesNavigationSidebarPanel.js:
(WI.SourcesNavigationSidebarPanel):
(WI.SourcesNavigationSidebarPanel.prototype.closed):
(WI.SourcesNavigationSidebarPanel.prototype._updateTemporarilyDisabledBreakpointsButtons): Added.
(WI.SourcesNavigationSidebarPanel.prototype._updateBreakpointsDisabledBanner):
(WI.SourcesNavigationSidebarPanel.prototype._handleTimelineCapturingWillStart):
(WI.SourcesNavigationSidebarPanel.prototype._handleTimelineCapturingStopped):
(WI.SourcesNavigationSidebarPanel.prototype._handleAuditManagerTestScheduled): Added.
(WI.SourcesNavigationSidebarPanel.prototype._handleAuditManagerTestCompleted): Added.
* UserInterface/Views/SourcesNavigationSidebarPanel.css:
(.sidebar > .panel.navigation.sources > .content > .warning-banner + .warning-banner): Added.

* UserInterface/Views/DebuggerSidebarPanel.js:
(WI.DebuggerSidebarPanel):

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.css
Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js

index 8a42095..46bd056 100644 (file)
@@ -1,5 +1,28 @@
 2019-03-02  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: Sources: breakpoints should be disabled when an audit is running
+        https://bugs.webkit.org/show_bug.cgi?id=195105
+        <rdar://problem/48441373>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/SourcesNavigationSidebarPanel.js:
+        (WI.SourcesNavigationSidebarPanel):
+        (WI.SourcesNavigationSidebarPanel.prototype.closed):
+        (WI.SourcesNavigationSidebarPanel.prototype._updateTemporarilyDisabledBreakpointsButtons): Added.
+        (WI.SourcesNavigationSidebarPanel.prototype._updateBreakpointsDisabledBanner):
+        (WI.SourcesNavigationSidebarPanel.prototype._handleTimelineCapturingWillStart):
+        (WI.SourcesNavigationSidebarPanel.prototype._handleTimelineCapturingStopped):
+        (WI.SourcesNavigationSidebarPanel.prototype._handleAuditManagerTestScheduled): Added.
+        (WI.SourcesNavigationSidebarPanel.prototype._handleAuditManagerTestCompleted): Added.
+        * UserInterface/Views/SourcesNavigationSidebarPanel.css:
+        (.sidebar > .panel.navigation.sources > .content > .warning-banner + .warning-banner): Added.
+
+        * UserInterface/Views/DebuggerSidebarPanel.js:
+        (WI.DebuggerSidebarPanel):
+
+2019-03-02  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: Debugger: don't enable breakpoints when source location changes
         https://bugs.webkit.org/show_bug.cgi?id=195081
         <rdar://problem/48422701>
index 6f49942..9b336ea 100644 (file)
@@ -250,8 +250,13 @@ WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSideba
         if (WI.debuggerManager.paused)
             this._debuggerDidPause(null);
 
-        if (WI.timelineManager.isCapturing() && WI.debuggerManager.breakpointsDisabledTemporarily)
-            this._timelineCapturingWillStart(null);
+        if (WI.debuggerManager.breakpointsDisabledTemporarily) {
+            if (WI.timelineManager.isCapturing())
+                this._timelineCapturingWillStart();
+
+            if (WI.auditManager.runningState === WI.AuditManager.RunningState.Active || WI.auditManager.runningState === WI.AuditManager.RunningState.Stopping)
+                this._handleAuditManagerTestScheduled();
+        }
 
         this._updateBreakpointsDisabledBanner();
     }
index 1fbfe2e..a04ecb2 100644 (file)
     border-bottom: 1px solid var(--border-color);
 }
 
+.sidebar > .panel.navigation.sources > .content > .warning-banner + .warning-banner {
+    display: none;
+}
+
 .sidebar > .panel.navigation.sources > .content > .details-section {
     padding-bottom: 1px;
     font-size: 11px;
index f0e57b2..7e1bc06 100644 (file)
@@ -94,6 +94,7 @@ WI.SourcesNavigationSidebarPanel = class SourcesNavigationSidebarPanel extends W
         this._debuggerStepOutButtonItem.enabled = false;
 
         this._timelineRecordingWarningElement = null;
+        this._auditTestWarningElement = null;
         this._breakpointsDisabledWarningElement = null;
 
         this._pauseReasonTreeOutline = null;
@@ -256,6 +257,9 @@ WI.SourcesNavigationSidebarPanel = class SourcesNavigationSidebarPanel extends W
         WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingWillStart, this._handleTimelineCapturingWillStart, this);
         WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._handleTimelineCapturingStopped, this);
 
+        WI.auditManager.addEventListener(WI.AuditManager.Event.TestScheduled, this._handleAuditManagerTestScheduled, this);
+        WI.auditManager.addEventListener(WI.AuditManager.Event.TestCompleted, this._handleAuditManagerTestCompleted, this);
+
         WI.cssManager.addEventListener(WI.CSSManager.Event.StyleSheetAdded, this._handleCSSStyleSheetAdded, this);
 
         WI.targetManager.addEventListener(WI.TargetManager.Event.TargetAdded, this._handleTargetAdded, this);
@@ -315,8 +319,13 @@ WI.SourcesNavigationSidebarPanel = class SourcesNavigationSidebarPanel extends W
         if (WI.debuggerManager.paused)
             this._handleDebuggerPaused();
 
-        if (WI.timelineManager.isCapturing() && WI.debuggerManager.breakpointsDisabledTemporarily)
-            this._handleTimelineCapturingWillStart();
+        if (WI.debuggerManager.breakpointsDisabledTemporarily) {
+            if (WI.timelineManager.isCapturing())
+                this._handleTimelineCapturingWillStart();
+
+            if (WI.auditManager.runningState === WI.AuditManager.RunningState.Active || WI.auditManager.runningState === WI.AuditManager.RunningState.Stopping)
+                this._handleAuditManagerTestScheduled();
+        }
 
         this._updateBreakpointsDisabledBanner();
     }
@@ -348,6 +357,7 @@ WI.SourcesNavigationSidebarPanel = class SourcesNavigationSidebarPanel extends W
         WI.DOMBreakpoint.removeEventListener(null, null, this);
         WI.consoleManager.removeEventListener(null, null, this);
         WI.timelineManager.removeEventListener(null, null, this);
+        WI.auditManager.removeEventListener(null, null, this);
         WI.cssManager.removeEventListener(null, null, this);
         WI.targetManager.removeEventListener(null, null, this);
         WI.notifications.removeEventListener(null, null, this);
@@ -925,9 +935,16 @@ WI.SourcesNavigationSidebarPanel = class SourcesNavigationSidebarPanel extends W
             this._addIssue(issue);
     }
 
+    _updateTemporarilyDisabledBreakpointsButtons()
+    {
+        let breakpointsDisabledTemporarily = WI.debuggerManager.breakpointsDisabledTemporarily;
+        this._debuggerBreakpointsButtonItem.enabled = !breakpointsDisabledTemporarily;
+        this._debuggerPauseResumeButtonItem.enabled = !breakpointsDisabledTemporarily;
+    }
+
     _updateBreakpointsDisabledBanner()
     {
-        if (!WI.debuggerManager.breakpointsEnabled && !this._timelineRecordingWarningElement) {
+        if (!WI.debuggerManager.breakpointsEnabled && !this._timelineRecordingWarningElement && !this._auditTestWarningElement) {
             if (!this._breakpointsDisabledWarningElement) {
                 let enableBreakpointsButton = document.createElement("button");
                 enableBreakpointsButton.textContent = WI.UIString("Enable Breakpoints");
@@ -1607,8 +1624,7 @@ WI.SourcesNavigationSidebarPanel = class SourcesNavigationSidebarPanel extends W
 
     _handleTimelineCapturingWillStart(event)
     {
-        this._debuggerBreakpointsButtonItem.enabled = false;
-        this._debuggerPauseResumeButtonItem.enabled = false;
+        this._updateTemporarilyDisabledBreakpointsButtons();
 
         if (!this._timelineRecordingWarningElement) {
             let stopRecordingButton = document.createElement("button");
@@ -1629,8 +1645,7 @@ WI.SourcesNavigationSidebarPanel = class SourcesNavigationSidebarPanel extends W
 
     _handleTimelineCapturingStopped(event)
     {
-        this._debuggerBreakpointsButtonItem.enabled = true;
-        this._debuggerPauseResumeButtonItem.enabled = true;
+        this._updateTemporarilyDisabledBreakpointsButtons();
 
         if (this._timelineRecordingWarningElement) {
             this._timelineRecordingWarningElement.remove();
@@ -1640,6 +1655,39 @@ WI.SourcesNavigationSidebarPanel = class SourcesNavigationSidebarPanel extends W
         this._updateBreakpointsDisabledBanner();
     }
 
+    _handleAuditManagerTestScheduled(event)
+    {
+        this._updateTemporarilyDisabledBreakpointsButtons();
+
+        if (!this._auditTestWarningElement) {
+            let stopAuditButton = document.createElement("button");
+            stopAuditButton.textContent = WI.UIString("Stop Audit");
+            stopAuditButton.addEventListener("click", (event) => {
+                WI.auditManager.stop();
+            });
+
+            this._auditTestWarningElement = document.createElement("div");
+            this._auditTestWarningElement.classList.add("warning-banner");
+            this._auditTestWarningElement.append(WI.UIString("Debugger disabled during Audit"), document.createElement("br"), stopAuditButton);
+        }
+
+        this.contentView.element.insertBefore(this._auditTestWarningElement, this.contentView.element.firstChild);
+
+        this._updateBreakpointsDisabledBanner();
+    }
+
+    _handleAuditManagerTestCompleted(event)
+    {
+        this._updateTemporarilyDisabledBreakpointsButtons();
+
+        if (this._auditTestWarningElement) {
+            this._auditTestWarningElement.remove();
+            this._auditTestWarningElement = null;
+        }
+
+        this._updateBreakpointsDisabledBanner();
+    }
+
     _handleCSSStyleSheetAdded(event)
     {
         let styleSheet = event.data.styleSheet;