<!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>[174028] 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/174028">174028</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-09-26 16:25:17 -0700 (Fri, 26 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Automatic Inspection should continue once all breakpoints are loaded
https://bugs.webkit.org/show_bug.cgi?id=137038

Patch by Joseph Pecoraro &lt;pecoraro@apple.com&gt; on 2014-09-26
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

Add a new protocol command &quot;Inspector.initialized&quot; that signifies to the backend
when the frontend has sent all its initialization messages to the backend. This
can include information like breakpoints, which we would want to have loaded
before any JavaScript evaluates in the context.

* inspector/protocol/InspectorDomain.json:
New protocol command, Inspector.initialized.

* inspector/agents/InspectorAgent.h:
* inspector/agents/InspectorAgent.cpp:
(Inspector::InspectorAgent::InspectorAgent):
(Inspector::InspectorAgent::initialized):
Tell the InspectorEnvironment (the Controller) the frontend has initialized.

* inspector/InspectorEnvironment.h:
Abstract virtual method to handle frontend initialization. To be
implemented by all of the InspectorControllers.

* inspector/JSGlobalObjectInspectorController.h:
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
(Inspector::JSGlobalObjectInspectorController::connectFrontend):
(Inspector::JSGlobalObjectInspectorController::disconnectFrontend):
(Inspector::JSGlobalObjectInspectorController::frontendInitialized):
When a frontend is initialized, if it was automatic inspection unpause the debuggable.

* inspector/remote/RemoteInspectorDebuggable.cpp:
(Inspector::RemoteInspectorDebuggable::unpauseForInitializedInspector):
Complete setup for this debuggable.

* inspector/remote/RemoteInspectorDebuggable.h:
* inspector/remote/RemoteInspectorDebuggableConnection.mm:
(Inspector::RemoteInspectorDebuggableConnection::setup):
Move the setup complete to later, when the frontend sends an &quot;initialized&quot; message.

* inspector/remote/RemoteInspector.h:
* inspector/remote/RemoteInspector.mm:
(Inspector::RemoteInspector::updateDebuggableAutomaticInspectCandidate):
Provide a longer timeout now that the frontend must send messages after the connection
has established. The longest I have seen in  600ms, but the average tends to be 200ms.
So bump the timeout to 800ms for a buffer.

(Inspector::RemoteInspector::setupSucceeded): Deleted.
(Inspector::RemoteInspector::setupCompleted):
Rename, as this happens at a slightly different time.

Source/WebCore:

Handle frontend initialization messages even though pages cannot
be automatically inspected yet.

* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
(WebCore::InspectorController::connectFrontend):
(WebCore::InspectorController::disconnectFrontend):
(WebCore::InspectorController::frontendInitialized):
* inspector/InspectorController.h:
* inspector/WorkerInspectorController.h:
* page/Page.h:
(WebCore::Page::inspectorDebuggable):

Source/WebInspectorUI:

* UserInterface/Base/Main.js:
Send the initialized message after we have sent all other setup messages,
such as enabling features and setting breakpoints.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorInspectorEnvironmenth">trunk/Source/JavaScriptCore/inspector/InspectorEnvironment.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSGlobalObjectInspectorControllercpp">trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSGlobalObjectInspectorControllerh">trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorAgentcpp">trunk/Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorAgenth">trunk/Source/JavaScriptCore/inspector/agents/InspectorAgent.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolInspectorDomainjson">trunk/Source/JavaScriptCore/inspector/protocol/InspectorDomain.json</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggablecpp">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionmm">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorControllercpp">trunk/Source/WebCore/inspector/InspectorController.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorControllerh">trunk/Source/WebCore/inspector/InspectorController.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorWorkerInspectorControllerh">trunk/Source/WebCore/inspector/WorkerInspectorController.h</a></li>
<li><a href="#trunkSourceWebCorepagePageh">trunk/Source/WebCore/page/Page.h</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseMainjs">trunk/Source/WebInspectorUI/UserInterface/Base/Main.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2014-09-26  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Automatic Inspection should continue once all breakpoints are loaded
+        https://bugs.webkit.org/show_bug.cgi?id=137038
+
+        Reviewed by Timothy Hatcher.
+
+        Add a new protocol command &quot;Inspector.initialized&quot; that signifies to the backend
+        when the frontend has sent all its initialization messages to the backend. This
+        can include information like breakpoints, which we would want to have loaded
+        before any JavaScript evaluates in the context.
+
+        * inspector/protocol/InspectorDomain.json:
+        New protocol command, Inspector.initialized.
+
+        * inspector/agents/InspectorAgent.h:
+        * inspector/agents/InspectorAgent.cpp:
+        (Inspector::InspectorAgent::InspectorAgent):
+        (Inspector::InspectorAgent::initialized):
+        Tell the InspectorEnvironment (the Controller) the frontend has initialized.
+
+        * inspector/InspectorEnvironment.h:
+        Abstract virtual method to handle frontend initialization. To be
+        implemented by all of the InspectorControllers.
+
+        * inspector/JSGlobalObjectInspectorController.h:
+        * inspector/JSGlobalObjectInspectorController.cpp:
+        (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
+        (Inspector::JSGlobalObjectInspectorController::connectFrontend):
+        (Inspector::JSGlobalObjectInspectorController::disconnectFrontend):
+        (Inspector::JSGlobalObjectInspectorController::frontendInitialized):
+        When a frontend is initialized, if it was automatic inspection unpause the debuggable.
+
+        * inspector/remote/RemoteInspectorDebuggable.cpp:
+        (Inspector::RemoteInspectorDebuggable::unpauseForInitializedInspector):
+        Complete setup for this debuggable.
+
+        * inspector/remote/RemoteInspectorDebuggable.h:
+        * inspector/remote/RemoteInspectorDebuggableConnection.mm:
+        (Inspector::RemoteInspectorDebuggableConnection::setup):
+        Move the setup complete to later, when the frontend sends an &quot;initialized&quot; message.
+
+        * inspector/remote/RemoteInspector.h:
+        * inspector/remote/RemoteInspector.mm:
+        (Inspector::RemoteInspector::updateDebuggableAutomaticInspectCandidate):
+        Provide a longer timeout now that the frontend must send messages after the connection
+        has established. The longest I have seen in  600ms, but the average tends to be 200ms.
+        So bump the timeout to 800ms for a buffer.
+
+        (Inspector::RemoteInspector::setupSucceeded): Deleted.
+        (Inspector::RemoteInspector::setupCompleted):
+        Rename, as this happens at a slightly different time.
+
</ins><span class="cx"> 2014-09-26  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         DFG shouldn't insert store barriers when it has it on good authority that we're not storing a cell
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInspectorEnvironmenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InspectorEnvironment.h (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InspectorEnvironment.h        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/JavaScriptCore/inspector/InspectorEnvironment.h        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx">     virtual InspectorEvaluateHandler evaluateHandler() const = 0;
</span><span class="cx">     virtual void willCallInjectedScriptFunction(JSC::ExecState*, const String&amp; scriptName, int scriptLine) = 0;
</span><span class="cx">     virtual void didCallInjectedScriptFunction(JSC::ExecState*) = 0;
</span><ins>+    virtual void frontendInitialized() = 0;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace Inspector
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSGlobalObjectInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -47,6 +47,10 @@
</span><span class="cx"> #include &lt;dlfcn.h&gt;
</span><span class="cx"> #include &lt;execinfo.h&gt;
</span><span class="cx"> 
</span><ins>+#if ENABLE(REMOTE_INSPECTOR)
+#include &quot;JSGlobalObjectDebuggable.h&quot;
+#endif
+
</ins><span class="cx"> using namespace JSC;
</span><span class="cx"> 
</span><span class="cx"> namespace Inspector {
</span><span class="lines">@@ -56,6 +60,7 @@
</span><span class="cx">     , m_injectedScriptManager(std::make_unique&lt;InjectedScriptManager&gt;(*this, InjectedScriptHost::create()))
</span><span class="cx">     , m_inspectorFrontendChannel(nullptr)
</span><span class="cx">     , m_includeNativeCallStackWithExceptions(true)
</span><ins>+    , m_isAutomaticInspection(false)
</ins><span class="cx"> {
</span><span class="cx">     auto runtimeAgent = std::make_unique&lt;JSGlobalObjectRuntimeAgent&gt;(m_injectedScriptManager.get(), m_globalObject);
</span><span class="cx">     auto consoleAgent = std::make_unique&lt;JSGlobalObjectConsoleAgent&gt;(m_injectedScriptManager.get());
</span><span class="lines">@@ -67,7 +72,7 @@
</span><span class="cx"> 
</span><span class="cx">     runtimeAgent-&gt;setScriptDebugServer(&amp;debuggerAgent-&gt;scriptDebugServer());
</span><span class="cx"> 
</span><del>-    m_agents.append(std::make_unique&lt;InspectorAgent&gt;());
</del><ins>+    m_agents.append(std::make_unique&lt;InspectorAgent&gt;(*this));
</ins><span class="cx">     m_agents.append(WTF::move(runtimeAgent));
</span><span class="cx">     m_agents.append(WTF::move(consoleAgent));
</span><span class="cx">     m_agents.append(WTF::move(debuggerAgent));
</span><span class="lines">@@ -90,19 +95,12 @@
</span><span class="cx">     ASSERT(!m_inspectorFrontendChannel);
</span><span class="cx">     ASSERT(!m_inspectorBackendDispatcher);
</span><span class="cx"> 
</span><ins>+    m_isAutomaticInspection = isAutomaticInspection;
+
</ins><span class="cx">     m_inspectorFrontendChannel = frontendChannel;
</span><span class="cx">     m_inspectorBackendDispatcher = InspectorBackendDispatcher::create(frontendChannel);
</span><span class="cx"> 
</span><span class="cx">     m_agents.didCreateFrontendAndBackend(frontendChannel, m_inspectorBackendDispatcher.get());
</span><del>-
-    if (isAutomaticInspection) {
-        // FIXME: We should not always pause for automatic inspection.
-        // Currently if we don't automatically pause, then we may miss a breakpoint, since breakpoints
-        // come from the frontend and might be received after some evaluateScript message. We should
-        // have the frontend signal the backend when its setup messages are complete.
-        m_debuggerAgent-&gt;enable(nullptr);
-        m_debuggerAgent-&gt;pause(nullptr);
-    }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void JSGlobalObjectInspectorController::disconnectFrontend(InspectorDisconnectReason reason)
</span><span class="lines">@@ -115,6 +113,8 @@
</span><span class="cx">     m_inspectorBackendDispatcher-&gt;clearFrontend();
</span><span class="cx">     m_inspectorBackendDispatcher.clear();
</span><span class="cx">     m_inspectorFrontendChannel = nullptr;
</span><ins>+
+    m_isAutomaticInspection = false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void JSGlobalObjectInspectorController::dispatchMessageFromFrontend(const String&amp; message)
</span><span class="lines">@@ -192,6 +192,14 @@
</span><span class="cx">     return JSC::evaluate;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void JSGlobalObjectInspectorController::frontendInitialized()
+{
+#if ENABLE(REMOTE_INSPECTOR)
+    if (m_isAutomaticInspection)
+        m_globalObject.inspectorDebuggable().unpauseForInitializedInspector();
+#endif
+}
+
</ins><span class="cx"> } // namespace Inspector
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(INSPECTOR)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSGlobalObjectInspectorControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -78,6 +78,7 @@
</span><span class="cx">     virtual InspectorEvaluateHandler evaluateHandler() const override;
</span><span class="cx">     virtual void willCallInjectedScriptFunction(JSC::ExecState*, const String&amp;, int) override { }
</span><span class="cx">     virtual void didCallInjectedScriptFunction(JSC::ExecState*) override { }
</span><ins>+    virtual void frontendInitialized() override;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void appendAPIBacktrace(ScriptCallStack* callStack);
</span><span class="lines">@@ -91,6 +92,7 @@
</span><span class="cx">     InspectorFrontendChannel* m_inspectorFrontendChannel;
</span><span class="cx">     RefPtr&lt;InspectorBackendDispatcher&gt; m_inspectorBackendDispatcher;
</span><span class="cx">     bool m_includeNativeCallStackWithExceptions;
</span><ins>+    bool m_isAutomaticInspection;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace Inspector
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -33,13 +33,15 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INSPECTOR)
</span><span class="cx"> 
</span><ins>+#include &quot;InspectorEnvironment.h&quot;
</ins><span class="cx"> #include &quot;InspectorValues.h&quot;
</span><span class="cx"> #include &quot;ScriptValue.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace Inspector {
</span><span class="cx"> 
</span><del>-InspectorAgent::InspectorAgent()
</del><ins>+InspectorAgent::InspectorAgent(InspectorEnvironment&amp; environment)
</ins><span class="cx">     : InspectorAgentBase(ASCIILiteral(&quot;Inspector&quot;))
</span><ins>+    , m_environment(environment)
</ins><span class="cx">     , m_enabled(false)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -87,6 +89,11 @@
</span><span class="cx">     m_enabled = false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InspectorAgent::initialized(ErrorString*)
+{
+    m_environment.frontendInitialized();
+}
+
</ins><span class="cx"> void InspectorAgent::inspect(PassRefPtr&lt;Protocol::Runtime::RemoteObject&gt; objectToInspect, PassRefPtr&lt;InspectorObject&gt; hints)
</span><span class="cx"> {
</span><span class="cx">     if (m_enabled &amp;&amp; m_frontendDispatcher) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorAgent.h (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorAgent.h        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorAgent.h        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -40,10 +40,10 @@
</span><span class="cx"> 
</span><span class="cx"> namespace Inspector {
</span><span class="cx"> 
</span><del>-class InspectorObject;
-class InstrumentingAgents;
</del><ins>+class InspectorEnvironment;
</ins><span class="cx"> class InspectorInspectorBackendDispatcher;
</span><span class="cx"> class InspectorInspectorFrontendDispatchers;
</span><ins>+class InspectorObject;
</ins><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    InspectorAgent();
</del><ins>+    InspectorAgent(InspectorEnvironment&amp;);
</ins><span class="cx">     virtual ~InspectorAgent();
</span><span class="cx"> 
</span><span class="cx">     virtual void didCreateFrontendAndBackend(InspectorFrontendChannel*, InspectorBackendDispatcher*) override;
</span><span class="lines">@@ -59,11 +59,13 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void enable(ErrorString*) override;
</span><span class="cx">     virtual void disable(ErrorString*) override;
</span><ins>+    virtual void initialized(ErrorString*) override;
</ins><span class="cx"> 
</span><span class="cx">     void inspect(PassRefPtr&lt;Protocol::Runtime::RemoteObject&gt; objectToInspect, PassRefPtr&lt;InspectorObject&gt; hints);
</span><span class="cx">     void evaluateForTestInFrontend(const String&amp; script);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    InspectorEnvironment&amp; m_environment;
</ins><span class="cx">     std::unique_ptr&lt;InspectorInspectorFrontendDispatcher&gt; m_frontendDispatcher;
</span><span class="cx">     RefPtr&lt;InspectorInspectorBackendDispatcher&gt; m_backendDispatcher;
</span><span class="cx">     Vector&lt;String&gt; m_pendingEvaluateTestCommands;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolInspectorDomainjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/InspectorDomain.json (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/InspectorDomain.json        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/JavaScriptCore/inspector/protocol/InspectorDomain.json        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -9,6 +9,10 @@
</span><span class="cx">         {
</span><span class="cx">             &quot;name&quot;: &quot;disable&quot;,
</span><span class="cx">             &quot;description&quot;: &quot;Disables inspector domain notifications.&quot;
</span><ins>+        },
+        {
+            &quot;name&quot;: &quot;initialized&quot;,
+            &quot;description&quot;: &quot;Sent by the frontend after all initialization messages have been sent.&quot;
</ins><span class="cx">         }
</span><span class="cx">     ],
</span><span class="cx">     &quot;events&quot;: [
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx">     void updateDebuggableAutomaticInspectCandidate(RemoteInspectorDebuggable*);
</span><span class="cx">     void sendMessageToRemoteFrontend(unsigned identifier, const String&amp; message);
</span><span class="cx">     void setupFailed(unsigned identifier);
</span><del>-    void setupSucceeded(unsigned identifier);
</del><ins>+    void setupCompleted(unsigned identifier);
</ins><span class="cx">     bool waitingForAutomaticInspection(unsigned identifier);
</span><span class="cx"> 
</span><span class="cx">     bool enabled() const { return m_enabled; }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -221,7 +221,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // In case debuggers fail to respond, or we cannot connect to webinspectord, automatically continue after a short period of time.
</span><del>-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
</del><ins>+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.8 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
</ins><span class="cx">             std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</span><span class="cx">             if (m_automaticInspectionCandidateIdentifier == identifier) {
</span><span class="cx">                 LOG_ERROR(&quot;Skipping Automatic Inspection Candidate with pageId(%u) because we failed to receive a response in time.&quot;, m_automaticInspectionCandidateIdentifier);
</span><span class="lines">@@ -286,7 +286,7 @@
</span><span class="cx">     pushListingSoon();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteInspector::setupSucceeded(unsigned identifier)
</del><ins>+void RemoteInspector::setupCompleted(unsigned identifier)
</ins><span class="cx"> {
</span><span class="cx">     std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -91,6 +91,11 @@
</span><span class="cx">         loop.cycle();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RemoteInspectorDebuggable::unpauseForInitializedInspector()
+{
+    RemoteInspector::shared().setupCompleted(identifier());
+}
+
</ins><span class="cx"> } // namespace Inspector
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(REMOTE_INSPECTOR)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool automaticInspectionAllowed() const { return false; }
</span><span class="cx">     virtual void pauseWaitingForAutomaticInspection();
</span><ins>+    virtual void unpauseForInitializedInspector();
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     unsigned m_identifier;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -166,7 +166,6 @@
</span><span class="cx">             } else {
</span><span class="cx">                 m_debuggable-&gt;connect(this, isAutomaticInspection);
</span><span class="cx">                 m_connected = true;
</span><del>-                RemoteInspector::shared().setupSucceeded(identifier());
</del><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         deref();
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/WebCore/ChangeLog        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-09-26  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Automatic Inspection should continue once all breakpoints are loaded
+        https://bugs.webkit.org/show_bug.cgi?id=137038
+
+        Reviewed by Timothy Hatcher.
+
+        Handle frontend initialization messages even though pages cannot
+        be automatically inspected yet.
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        (WebCore::InspectorController::connectFrontend):
+        (WebCore::InspectorController::disconnectFrontend):
+        (WebCore::InspectorController::frontendInitialized):
+        * inspector/InspectorController.h:
+        * inspector/WorkerInspectorController.h:
+        * page/Page.h:
+        (WebCore::Page::inspectorDebuggable):
+
</ins><span class="cx"> 2014-09-26  David Kilzer  &lt;ddkilzer@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (r173988): Fix unused variable warning in PDFDocumentImage.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorController.cpp        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -74,6 +74,10 @@
</span><span class="cx"> #include &lt;inspector/agents/InspectorAgent.h&gt;
</span><span class="cx"> #include &lt;runtime/JSLock.h&gt;
</span><span class="cx"> 
</span><ins>+#if ENABLE(REMOTE_INSPECTOR)
+#include &quot;PageDebuggable.h&quot;
+#endif
+
</ins><span class="cx"> using namespace JSC;
</span><span class="cx"> using namespace Inspector;
</span><span class="cx"> 
</span><span class="lines">@@ -88,13 +92,14 @@
</span><span class="cx">     , m_inspectorClient(inspectorClient)
</span><span class="cx">     , m_inspectorFrontendClient(nullptr)
</span><span class="cx">     , m_isUnderTest(false)
</span><ins>+    , m_isAutomaticInspection(false)
</ins><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx">     , m_hasRemoteFrontend(false)
</span><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx">     ASSERT_ARG(inspectorClient, inspectorClient);
</span><span class="cx"> 
</span><del>-    auto inspectorAgentPtr = std::make_unique&lt;InspectorAgent&gt;();
</del><ins>+    auto inspectorAgentPtr = std::make_unique&lt;InspectorAgent&gt;(*this);
</ins><span class="cx">     m_inspectorAgent = inspectorAgentPtr.get();
</span><span class="cx">     m_instrumentingAgents-&gt;setInspectorAgent(m_inspectorAgent);
</span><span class="cx">     m_agents.append(WTF::move(inspectorAgentPtr));
</span><span class="lines">@@ -231,13 +236,15 @@
</span><span class="cx">         m_inspectorFrontendClient-&gt;windowObjectCleared();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InspectorController::connectFrontend(InspectorFrontendChannel* frontendChannel, bool)
</del><ins>+void InspectorController::connectFrontend(InspectorFrontendChannel* frontendChannel, bool isAutomaticInspection)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(frontendChannel);
</span><span class="cx">     ASSERT(m_inspectorClient);
</span><span class="cx">     ASSERT(!m_inspectorFrontendChannel);
</span><span class="cx">     ASSERT(!m_inspectorBackendDispatcher);
</span><span class="cx"> 
</span><ins>+    m_isAutomaticInspection = isAutomaticInspection;
+
</ins><span class="cx">     m_inspectorFrontendChannel = frontendChannel;
</span><span class="cx">     m_inspectorBackendDispatcher = InspectorBackendDispatcher::create(frontendChannel);
</span><span class="cx"> 
</span><span class="lines">@@ -263,6 +270,8 @@
</span><span class="cx">     m_inspectorBackendDispatcher.clear();
</span><span class="cx">     m_inspectorFrontendChannel = nullptr;
</span><span class="cx"> 
</span><ins>+    m_isAutomaticInspection = false;
+
</ins><span class="cx">     // Release overlay page resources.
</span><span class="cx">     m_overlay-&gt;freePage();
</span><span class="cx">     InspectorInstrumentation::frontendDeleted();
</span><span class="lines">@@ -438,6 +447,14 @@
</span><span class="cx">     InspectorInstrumentation::didCallFunction(cookie, scriptExecutionContext);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InspectorController::frontendInitialized()
+{
+#if ENABLE(REMOTE_INSPECTOR)
+    if (m_isAutomaticInspection)
+        m_page.inspectorDebuggable().unpauseForInitializedInspector();
+#endif
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(INSPECTOR)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorController.h (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorController.h        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/WebCore/inspector/InspectorController.h        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -129,6 +129,7 @@
</span><span class="cx">     virtual Inspector::InspectorEvaluateHandler evaluateHandler() const override;
</span><span class="cx">     virtual void willCallInjectedScriptFunction(JSC::ExecState*, const String&amp; scriptName, int scriptLine) override;
</span><span class="cx">     virtual void didCallInjectedScriptFunction(JSC::ExecState*) override;
</span><ins>+    virtual void frontendInitialized() override;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     friend InstrumentingAgents* instrumentationForPage(Page*);
</span><span class="lines">@@ -153,6 +154,7 @@
</span><span class="cx">     Inspector::InspectorAgentRegistry m_agents;
</span><span class="cx">     Vector&lt;InspectorInstrumentationCookie, 2&gt; m_injectedScriptInstrumentationCookies;
</span><span class="cx">     bool m_isUnderTest;
</span><ins>+    bool m_isAutomaticInspection;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx">     bool m_hasRemoteFrontend;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorWorkerInspectorControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/WorkerInspectorController.h (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/WorkerInspectorController.h        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/WebCore/inspector/WorkerInspectorController.h        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -73,6 +73,7 @@
</span><span class="cx">     virtual Inspector::InspectorEvaluateHandler evaluateHandler() const override;
</span><span class="cx">     virtual void willCallInjectedScriptFunction(JSC::ExecState*, const String&amp; scriptName, int scriptLine) override;
</span><span class="cx">     virtual void didCallInjectedScriptFunction(JSC::ExecState*) override;
</span><ins>+    virtual void frontendInitialized() override { }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     friend InstrumentingAgents* instrumentationForWorkerGlobalScope(WorkerGlobalScope*);
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/WebCore/page/Page.h        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -410,6 +410,10 @@
</span><span class="cx"> 
</span><span class="cx">     PageConsoleClient&amp; console() { return *m_consoleClient; }
</span><span class="cx"> 
</span><ins>+#if ENABLE(REMOTE_INSPECTOR)
+    PageDebuggable&amp; inspectorDebuggable() const { return *m_inspectorDebuggable.get(); }
+#endif
+
</ins><span class="cx">     void hiddenPageCSSAnimationSuspensionStateChanged();
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/WebInspectorUI/ChangeLog        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-09-26  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Automatic Inspection should continue once all breakpoints are loaded
+        https://bugs.webkit.org/show_bug.cgi?id=137038
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Base/Main.js:
+        Send the initialized message after we have sent all other setup messages,
+        such as enabling features and setting breakpoints.
+
</ins><span class="cx"> 2014-09-26  Saam Barati  &lt;saambarati1@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Type Token View shows type information on hover when it shouldn't
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseMainjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (174027 => 174028)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2014-09-26 23:18:08 UTC (rev 174027)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2014-09-26 23:25:17 UTC (rev 174028)
</span><span class="lines">@@ -117,6 +117,12 @@
</span><span class="cx">     if (window.ConsoleAgent)
</span><span class="cx">         ConsoleAgent.enable();
</span><span class="cx"> 
</span><ins>+    // Tell the backend we are initialized after all our initialization messages have been sent.
+    setTimeout(function() {
+        if (window.InspectorAgent &amp;&amp; InspectorAgent.initialized)
+            InspectorAgent.initialized();
+    }, 0);
+
</ins><span class="cx">     // Register for events.
</span><span class="cx">     this.replayManager.addEventListener(WebInspector.ReplayManager.Event.CaptureStarted, this._captureDidStart, this);
</span><span class="cx">     this.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
</span></span></pre>
</div>
</div>

</body>
</html>