<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[201171] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/201171">201171</a></dd>
<dt>Author</dt> <dd>bburg@apple.com</dd>
<dt>Date</dt> <dd>2016-05-19 10:58:16 -0700 (Thu, 19 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: timelines should not update via requestAnimationFrame unless Web Inspector is visible
https://bugs.webkit.org/show_bug.cgi?id=157897
&lt;rdar://problem/26330802&gt;

Reviewed by Timothy Hatcher.

Source/WebInspectorUI:

The timelines overview tries to animate using requestAnimationFrame, even if the
inspector frontend is not really visible. When it does this, requestAnimationFrame
simply stalls out until the inspector becomes visible. If a recording is started
while the inspector is not visible, then when it is shown again, the timeline will
start to animate from 0s instead of the current time. This happens because the
requestAnimationFrame was requested when the current time actually was 0, and it
finally executes some time later, when the current time is no longer accurate.
Since the timelines animate by calculating time elapsed since the previous frame
rather than using event timestamps, there is no way for the timelines to skip forward
in their animations in scenarios where the current time becomes arbitrarily skewed.

To fix this, consider the visibility state of the frontend as reported by the UIProcess.
Fire a global notification when visibility state changes, and start or stop updating
the current time as the frontend becomes visible or not shown.

This does not affect most other uses of requestAnimationFrame, which are used as
timers to call updateLayout at an appropriate time. The timelines case is different
because the current time is fixed prior to requesting an animation frame, and
later animation frames are only triggered by earlier requests, so there's nothing to
coalesce.

* UserInterface/Base/Main.js:
(WebInspector.loaded): Initialize WebInspector.visible.

* UserInterface/Base/Object.js: Add new event.

* UserInterface/Protocol/InspectorFrontendAPI.js:
(InspectorFrontendAPI.setIsVisible): Added.

* UserInterface/Test/Test.js:
(WebInspector.updateVisibilityState): Add a stub.

* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView):
(WebInspector.TimelineRecordingContentView.prototype._inspectorVisibilityStateChanged):
If visibility state changes while capturing, then start or stop updating the
current time as appropriate. Otherwise, refresh the timelines with updated
times so that they know about the recording's updated start/current/end time.

(WebInspector.TimelineRecordingContentView.prototype._startUpdatingCurrentTime):
Bail out if the Web Inspector frontend is not visible to the user and won't be
able to service requestAnimationFrames immediately.

Source/WebKit2:

The UIProcess needs to notify the Inspector frontend when it is truly visible.
The frontend can't use document.visibilityState because it doesn't seem to work
if the inspector frontend's WKWebView is created but not attached to a window.

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::open):
(WebKit::WebInspectorProxy::didClose):
Send visibility updates to the inspector process when the inspector becomes
&quot;visible&quot; or &quot;not visible&quot;. It becomes visible if it is attached to the
inspected page's window, or gets its own native window.

* WebProcess/WebPage/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::frontendLoaded):
(WebKit::WebInspectorUI::setDockingUnavailable):
(WebKit::WebInspectorUI::setIsVisible):
Call InspectorFrontendAPI.updateVisibilityState to let the frontend know.

* WebProcess/WebPage/WebInspectorUI.h:
* WebProcess/WebPage/WebInspectorUI.messages.in:
Add new message.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseMainjs">trunk/Source/WebInspectorUI/UserInterface/Base/Main.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseObjectjs">trunk/Source/WebInspectorUI/UserInterface/Base/Object.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolInspectorFrontendAPIjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTestTestjs">trunk/Source/WebInspectorUI/UserInterface/Test/Test.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTimelineRecordingContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebInspectorProxycpp">trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebInspectorUIcpp">trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebInspectorUIh">trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebInspectorUImessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.messages.in</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (201170 => 201171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-05-19 17:27:11 UTC (rev 201170)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-05-19 17:58:16 UTC (rev 201171)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2016-05-19  Brian Burg  &lt;bburg@apple.com&gt;
+
+        Web Inspector: timelines should not update via requestAnimationFrame unless Web Inspector is visible
+        https://bugs.webkit.org/show_bug.cgi?id=157897
+        &lt;rdar://problem/26330802&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        The timelines overview tries to animate using requestAnimationFrame, even if the
+        inspector frontend is not really visible. When it does this, requestAnimationFrame
+        simply stalls out until the inspector becomes visible. If a recording is started
+        while the inspector is not visible, then when it is shown again, the timeline will
+        start to animate from 0s instead of the current time. This happens because the
+        requestAnimationFrame was requested when the current time actually was 0, and it
+        finally executes some time later, when the current time is no longer accurate.
+        Since the timelines animate by calculating time elapsed since the previous frame
+        rather than using event timestamps, there is no way for the timelines to skip forward
+        in their animations in scenarios where the current time becomes arbitrarily skewed.
+
+        To fix this, consider the visibility state of the frontend as reported by the UIProcess.
+        Fire a global notification when visibility state changes, and start or stop updating
+        the current time as the frontend becomes visible or not shown.
+
+        This does not affect most other uses of requestAnimationFrame, which are used as
+        timers to call updateLayout at an appropriate time. The timelines case is different
+        because the current time is fixed prior to requesting an animation frame, and
+        later animation frames are only triggered by earlier requests, so there's nothing to
+        coalesce.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.loaded): Initialize WebInspector.visible.
+
+        * UserInterface/Base/Object.js: Add new event.
+
+        * UserInterface/Protocol/InspectorFrontendAPI.js:
+        (InspectorFrontendAPI.setIsVisible): Added.
+
+        * UserInterface/Test/Test.js:
+        (WebInspector.updateVisibilityState): Add a stub.
+
+        * UserInterface/Views/TimelineRecordingContentView.js:
+        (WebInspector.TimelineRecordingContentView):
+        (WebInspector.TimelineRecordingContentView.prototype._inspectorVisibilityStateChanged):
+        If visibility state changes while capturing, then start or stop updating the
+        current time as appropriate. Otherwise, refresh the timelines with updated
+        times so that they know about the recording's updated start/current/end time.
+
+        (WebInspector.TimelineRecordingContentView.prototype._startUpdatingCurrentTime):
+        Bail out if the Web Inspector frontend is not visible to the user and won't be
+        able to service requestAnimationFrames immediately.
+
</ins><span class="cx"> 2016-05-18  Timothy Hatcher  &lt;timothy@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Classes toggle wraps in some localizations
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseMainjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (201170 => 201171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2016-05-19 17:27:11 UTC (rev 201170)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2016-05-19 17:58:16 UTC (rev 201171)
</span><span class="lines">@@ -176,6 +176,8 @@
</span><span class="cx">         y: 0
</span><span class="cx">     };
</span><span class="cx"> 
</span><ins>+    this.visible = false;
+
</ins><span class="cx">     this._windowKeydownListeners = [];
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -711,6 +713,12 @@
</span><span class="cx">     this._updateDockNavigationItems();
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+WebInspector.updateVisibilityState = function(visible)
+{
+    this.visible = visible;
+    this.notifications.dispatchEventToListeners(WebInspector.Notification.VisibilityStateDidChange);
+}
+
</ins><span class="cx"> WebInspector.handlePossibleLinkClick = function(event, frame, alwaysOpenExternally)
</span><span class="cx"> {
</span><span class="cx">     var anchorElement = event.target.enclosingNodeOrSelfWithNodeName(&quot;a&quot;);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseObjectjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Object.js (201170 => 201171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Object.js        2016-05-19 17:27:11 UTC (rev 201170)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Object.js        2016-05-19 17:58:16 UTC (rev 201171)
</span><span class="lines">@@ -216,4 +216,5 @@
</span><span class="cx">     ExtraDomainsActivated: &quot;extra-domains-activated&quot;,
</span><span class="cx">     TabTypesChanged: &quot;tab-types-changed&quot;,
</span><span class="cx">     DebugUIEnabledDidChange: &quot;debug-ui-enabled-did-change&quot;,
</span><ins>+    VisibilityStateDidChange: &quot;visibility-state-did-change&quot;,
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolInspectorFrontendAPIjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js (201170 => 201171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js        2016-05-19 17:27:11 UTC (rev 201170)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js        2016-05-19 17:58:16 UTC (rev 201171)
</span><span class="lines">@@ -68,6 +68,11 @@
</span><span class="cx">         WebInspector.updateDockedState(side);
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    setIsVisible: function(visible)
+    {
+        WebInspector.updateVisibilityState(visible);
+    },
+
</ins><span class="cx">     showConsole: function()
</span><span class="cx">     {
</span><span class="cx">         WebInspector.showConsoleTab();
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTestTestjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Test/Test.js (201170 => 201171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Test/Test.js        2016-05-19 17:27:11 UTC (rev 201170)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/Test.js        2016-05-19 17:58:16 UTC (rev 201171)
</span><span class="lines">@@ -95,6 +95,7 @@
</span><span class="cx"> // Add stubs that are called by the frontend API.
</span><span class="cx"> WebInspector.updateDockedState = () =&gt; {};
</span><span class="cx"> WebInspector.updateDockingAvailability = () =&gt; {};
</span><ins>+WebInspector.updateVisibilityState = () =&gt; {};
</ins><span class="cx"> 
</span><span class="cx"> window.InspectorTest = new FrontendTestHarness();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTimelineRecordingContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js (201170 => 201171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js        2016-05-19 17:27:11 UTC (rev 201170)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js        2016-05-19 17:58:16 UTC (rev 201171)
</span><span class="lines">@@ -91,6 +91,8 @@
</span><span class="cx"> 
</span><span class="cx">         WebInspector.TimelineView.addEventListener(WebInspector.TimelineView.Event.RecordWasFiltered, this._recordWasFiltered, this);
</span><span class="cx"> 
</span><ins>+        WebInspector.notifications.addEventListener(WebInspector.Notification.VisibilityStateDidChange, this._inspectorVisibilityStateChanged, this);
+
</ins><span class="cx">         for (let instrument of this._recording.instruments)
</span><span class="cx">             this._instrumentAdded(instrument);
</span><span class="cx"> 
</span><span class="lines">@@ -341,6 +343,33 @@
</span><span class="cx">         this.dispatchEventToListeners(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    _inspectorVisibilityStateChanged()
+    {
+        if (WebInspector.timelineManager.activeRecording !== this._recording)
+            return;
+
+        // Stop updating since the results won't be rendered anyway.
+        if (!WebInspector.visible &amp;&amp; this._updating) {
+            this._stopUpdatingCurrentTime();
+            return;
+        }
+
+        // Nothing else to do if the current time was not being updated.
+        if (!WebInspector.visible)
+            return;
+
+        let {startTime, endTime} = this.representedObject;
+        if (!WebInspector.timelineManager.isCapturing()) {
+            // Force the overview to render data from the entire recording.
+            // This is necessary if the recording was started when the inspector was not
+            // visible because the views were never updated with currentTime/endTime.
+            this._updateTimes(startTime, endTime, endTime);
+            return;
+        }
+
+        this._startUpdatingCurrentTime(endTime);
+    }
+
</ins><span class="cx">     _update(timestamp)
</span><span class="cx">     {
</span><span class="cx">         if (this._waitingToResetCurrentTime) {
</span><span class="lines">@@ -401,9 +430,13 @@
</span><span class="cx">         if (this._updating)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        if (typeof startTime === &quot;number&quot;)
</del><ins>+        // Don't update the current time if the Inspector is not visible, as the requestAnimationFrames won't work.
+        if (!WebInspector.visible)
+            return;
+
+        if (typeof startTime === &quot;number&quot; &amp;&amp; !isNaN(this._currentTime))
</ins><span class="cx">             this._currentTime = startTime;
</span><del>-        else if (!isNaN(this._currentTime)) {
</del><ins>+        else {
</ins><span class="cx">             // This happens when you stop and later restart recording.
</span><span class="cx">             // COMPATIBILITY (iOS 9): Timeline.recordingStarted events did not include a timestamp.
</span><span class="cx">             // We likely need to jump into the future to a better current time which we can
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (201170 => 201171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-05-19 17:27:11 UTC (rev 201170)
+++ trunk/Source/WebKit2/ChangeLog        2016-05-19 17:58:16 UTC (rev 201171)
</span><span class="lines">@@ -1,5 +1,34 @@
</span><span class="cx"> 2016-05-19  Brian Burg  &lt;bburg@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: timelines should not update via requestAnimationFrame unless Web Inspector is visible
+        https://bugs.webkit.org/show_bug.cgi?id=157897
+        &lt;rdar://problem/26330802&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        The UIProcess needs to notify the Inspector frontend when it is truly visible.
+        The frontend can't use document.visibilityState because it doesn't seem to work
+        if the inspector frontend's WKWebView is created but not attached to a window.
+
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::open):
+        (WebKit::WebInspectorProxy::didClose):
+        Send visibility updates to the inspector process when the inspector becomes
+        &quot;visible&quot; or &quot;not visible&quot;. It becomes visible if it is attached to the
+        inspected page's window, or gets its own native window.
+
+        * WebProcess/WebPage/WebInspectorUI.cpp:
+        (WebKit::WebInspectorUI::frontendLoaded):
+        (WebKit::WebInspectorUI::setDockingUnavailable):
+        (WebKit::WebInspectorUI::setIsVisible):
+        Call InspectorFrontendAPI.updateVisibilityState to let the frontend know.
+
+        * WebProcess/WebPage/WebInspectorUI.h:
+        * WebProcess/WebPage/WebInspectorUI.messages.in:
+        Add new message.
+
+2016-05-19  Brian Burg  &lt;bburg@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: use a consistent prefix for injected scripts
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=157715
</span><span class="cx">         &lt;rdar://problem/26287188&gt;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebInspectorProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (201170 => 201171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp        2016-05-19 17:27:11 UTC (rev 201170)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp        2016-05-19 17:58:16 UTC (rev 201171)
</span><span class="lines">@@ -581,6 +581,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_isVisible = true;
</span><ins>+    m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::SetIsVisible(m_isVisible), m_inspectorPage-&gt;pageID());
</ins><span class="cx"> 
</span><span class="cx">     platformOpen();
</span><span class="cx"> }
</span><span class="lines">@@ -590,13 +591,14 @@
</span><span class="cx">     if (!m_inspectorPage)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_inspectorPage-&gt;process().removeMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage-&gt;pageID());
-
</del><span class="cx">     m_isVisible = false;
</span><span class="cx">     m_isProfilingPage = false;
</span><span class="cx">     m_showMessageSent = false;
</span><span class="cx">     m_ignoreFirstBringToFront = false;
</span><span class="cx"> 
</span><ins>+    m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::SetIsVisible(m_isVisible), m_inspectorPage-&gt;pageID());
+    m_inspectorPage-&gt;process().removeMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage-&gt;pageID());
+
</ins><span class="cx">     if (m_isAttached)
</span><span class="cx">         platformDetach();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebInspectorUIcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp (201170 => 201171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp        2016-05-19 17:27:11 UTC (rev 201170)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp        2016-05-19 17:58:16 UTC (rev 201171)
</span><span class="lines">@@ -95,6 +95,7 @@
</span><span class="cx">     // cleared due to a reload, the dock state won't be resent from UIProcess.
</span><span class="cx">     setDockingUnavailable(m_dockingUnavailable);
</span><span class="cx">     setDockSide(m_dockSide);
</span><ins>+    setIsVisible(m_isVisible);
</ins><span class="cx"> 
</span><span class="cx">     WebProcess::singleton().parentProcessConnection()-&gt;send(Messages::WebInspectorProxy::FrontendLoaded(), m_inspectedPageIdentifier);
</span><span class="cx"> 
</span><span class="lines">@@ -178,10 +179,18 @@
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorUI::setDockingUnavailable(bool unavailable)
</span><span class="cx"> {
</span><ins>+    m_dockingUnavailable = unavailable;
+
</ins><span class="cx">     m_frontendAPIDispatcher.dispatchCommand(ASCIILiteral(&quot;setDockingUnavailable&quot;), unavailable);
</span><del>-    m_dockingUnavailable = unavailable;
</del><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebInspectorUI::setIsVisible(bool visible)
+{
+    m_isVisible = visible;
+
+    m_frontendAPIDispatcher.dispatchCommand(ASCIILiteral(&quot;setIsVisible&quot;), visible);
+}
+
</ins><span class="cx"> void WebInspectorUI::changeAttachedWindowHeight(unsigned height)
</span><span class="cx"> {
</span><span class="cx">     WebProcess::singleton().parentProcessConnection()-&gt;send(Messages::WebInspectorProxy::SetAttachedWindowHeight(height), m_inspectedPageIdentifier);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebInspectorUIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h (201170 => 201171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h        2016-05-19 17:27:11 UTC (rev 201170)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h        2016-05-19 17:58:16 UTC (rev 201171)
</span><span class="lines">@@ -74,6 +74,8 @@
</span><span class="cx">     void setDockSide(DockSide);
</span><span class="cx">     void setDockingUnavailable(bool);
</span><span class="cx"> 
</span><ins>+    void setIsVisible(bool);
+
</ins><span class="cx">     void didSave(const String&amp; url);
</span><span class="cx">     void didAppend(const String&amp; url);
</span><span class="cx"> 
</span><span class="lines">@@ -126,6 +128,7 @@
</span><span class="cx">     uint64_t m_inspectedPageIdentifier { 0 };
</span><span class="cx">     bool m_underTest { false };
</span><span class="cx">     bool m_dockingUnavailable { false };
</span><ins>+    bool m_isVisible { false };
</ins><span class="cx">     DockSide m_dockSide { DockSide::Undocked };
</span><span class="cx">     unsigned m_inspectionLevel { 1 };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebInspectorUImessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.messages.in (201170 => 201171)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.messages.in        2016-05-19 17:27:11 UTC (rev 201170)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.messages.in        2016-05-19 17:58:16 UTC (rev 201171)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">     AttachedRight()
</span><span class="cx">     Detached()
</span><span class="cx">     SetDockingUnavailable(bool unavailable)
</span><ins>+    SetIsVisible(bool visible)
</ins><span class="cx"> 
</span><span class="cx">     ShowConsole()
</span><span class="cx">     ShowResources()
</span></span></pre>
</div>
</div>

</body>
</html>