Title: [202352] trunk/Source/WebInspectorUI
Revision
202352
Author
[email protected]
Date
2016-06-22 15:05:40 -0700 (Wed, 22 Jun 2016)

Log Message

Web Inspector: don't start auto capturing if the Inspector window is not visible
https://bugs.webkit.org/show_bug.cgi?id=159014
<rdar://problem/26931269>

Reviewed by Joseph Pecoraro.

TimelineTabContentView should not tell the timeline manager to enable
auto-capturing unless the Web Inspector UI is visible. If it is preloaded
but not shown to the user, then auto-capturing may inadvertently disable
the debugger, causing it to miss `debugger` statements and not bring the
inspector to front.

* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.prototype.set autoCaptureOnPageLoad):
Bail out if nothing changed. Coerce to a boolean since the backend requires a boolean.

* UserInterface/Views/TimelineTabContentView.js:
(WebInspector.TimelineTabContentView): Listen for UI visibility changes.
(WebInspector.TimelineTabContentView.prototype.shown):
Enable auto-capturing if the UI is visible.

(WebInspector.TimelineTabContentView.prototype.closed): Added.
Remove listeners on global objects so this tab doesn't leak.

(WebInspector.TimelineTabContentView.prototype._inspectorVisibilityChanged):
Update the auto-capturing setting if the UI became visible or not visible.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (202351 => 202352)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-06-22 21:41:01 UTC (rev 202351)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-06-22 22:05:40 UTC (rev 202352)
@@ -1,3 +1,32 @@
+2016-06-22  Brian Burg  <[email protected]>
+
+        Web Inspector: don't start auto capturing if the Inspector window is not visible
+        https://bugs.webkit.org/show_bug.cgi?id=159014
+        <rdar://problem/26931269>
+
+        Reviewed by Joseph Pecoraro.
+
+        TimelineTabContentView should not tell the timeline manager to enable
+        auto-capturing unless the Web Inspector UI is visible. If it is preloaded
+        but not shown to the user, then auto-capturing may inadvertently disable
+        the debugger, causing it to miss `debugger` statements and not bring the
+        inspector to front.
+
+        * UserInterface/Controllers/TimelineManager.js:
+        (WebInspector.TimelineManager.prototype.set autoCaptureOnPageLoad):
+        Bail out if nothing changed. Coerce to a boolean since the backend requires a boolean.
+
+        * UserInterface/Views/TimelineTabContentView.js:
+        (WebInspector.TimelineTabContentView): Listen for UI visibility changes.
+        (WebInspector.TimelineTabContentView.prototype.shown):
+        Enable auto-capturing if the UI is visible.
+
+        (WebInspector.TimelineTabContentView.prototype.closed): Added.
+        Remove listeners on global objects so this tab doesn't leak.
+
+        (WebInspector.TimelineTabContentView.prototype._inspectorVisibilityChanged):
+        Update the auto-capturing setting if the UI became visible or not visible.
+
 2016-06-22  Nikita Vasilyev  <[email protected]>
 
         Web Inspector: Simplify CSS rule for ContentBrowser navigation bar items

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (202351 => 202352)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2016-06-22 21:41:01 UTC (rev 202351)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2016-06-22 22:05:40 UTC (rev 202352)
@@ -135,10 +135,15 @@
 
     set autoCaptureOnPageLoad(autoCapture)
     {
+        autoCapture = !!autoCapture;
+
+        if (this._autoCaptureOnPageLoad === autoCapture)
+            return;
+
         this._autoCaptureOnPageLoad = autoCapture;
 
         if (window.TimelineAgent && TimelineAgent.setAutoCaptureEnabled)
-            TimelineAgent.setAutoCaptureEnabled(autoCapture);
+            TimelineAgent.setAutoCaptureEnabled(this._autoCaptureOnPageLoad);
     }
 
     get enabledTimelineTypes()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js (202351 => 202352)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js	2016-06-22 21:41:01 UTC (rev 202351)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js	2016-06-22 22:05:40 UTC (rev 202352)
@@ -70,6 +70,8 @@
         WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted, this._capturingStartedOrStopped, this);
         WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStartedOrStopped, this);
 
+        WebInspector.notifications.addEventListener(WebInspector.Notification.VisibilityStateDidChange, this._inspectorVisibilityChanged, this);
+
         this._displayedRecording = null;
         this._displayedContentView = null;
         this._viewMode = null;
@@ -277,7 +279,8 @@
         this._toggleRecordingShortcut.disabled = false;
         this._toggleNewRecordingShortcut.disabled = false;
 
-        WebInspector.timelineManager.autoCaptureOnPageLoad = true;
+        if (WebInspector.visible)
+            WebInspector.timelineManager.autoCaptureOnPageLoad = true;
     }
 
     hidden()
@@ -290,6 +293,15 @@
         WebInspector.timelineManager.autoCaptureOnPageLoad = false;
     }
 
+    closed()
+    {
+        if (WebInspector.FPSInstrument.supported())
+            this.contentBrowser.navigationBar.removeEventListener(null, null, this);
+
+        WebInspector.timelineManager.removeEventListener(null, null, this);
+        WebInspector.notifications.removeEventListener(null, null, this);
+    }
+
     canShowRepresentedObject(representedObject)
     {
         return representedObject instanceof WebInspector.TimelineRecording;
@@ -362,6 +374,11 @@
         this._recordButton.toggled = isCapturing;
     }
 
+    _inspectorVisibilityChanged(event)
+    {
+        WebInspector.timelineManager.autoCaptureOnPageLoad = !!this.visible && !!WebInspector.visible;
+    }
+
     _toggleRecordingOnSpacebar(event)
     {
         if (WebInspector.isEventTargetAnEditableField(event))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to