<!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>[243303] trunk/Source/WebCore</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/243303">243303</a></dd>
<dt>Author</dt> <dd>drousso@apple.com</dd>
<dt>Date</dt> <dd>2019-03-21 11:22:08 -0700 (Thu, 21 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Page: lazily create the agent
https://bugs.webkit.org/show_bug.cgi?id=195592
<rdar://problem/48791916>

Reviewed by Timothy Hatcher.

No change in functionality.

Have more agents save the inspected `Page` so they don't need to access it via the
`InspectorPageAgent`. Make some of `InspectorPageAgent`'s functions `static` so other
agents can use them without needing to have access to an enabled `InspectorPageAgent`.

* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
(WebCore::InspectorController::createLazyAgents):

* inspector/agents/InspectorPageAgent.h:
(WebCore::InspectorPageAgent::page): Deleted.
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::InspectorPageAgent):
(WebCore::InspectorPageAgent::enable):
(WebCore::InspectorPageAgent::disable):
(WebCore::InspectorPageAgent::reload):
(WebCore::InspectorPageAgent::navigate):
(WebCore::InspectorPageAgent::overrideSetting):
(WebCore::InspectorPageAgent::getCookies):
(WebCore::InspectorPageAgent::deleteCookie):
(WebCore::InspectorPageAgent::getResourceTree):
(WebCore::InspectorPageAgent::searchInResources):
(WebCore::InspectorPageAgent::didPaint):
(WebCore::InspectorPageAgent::didLayout):
(WebCore::InspectorPageAgent::didScroll):
(WebCore::InspectorPageAgent::didRecalculateStyle):
(WebCore::InspectorPageAgent::setEmulatedMedia):
(WebCore::InspectorPageAgent::setForcedAppearance):
(WebCore::InspectorPageAgent::getCompositingBordersVisible):
(WebCore::InspectorPageAgent::setCompositingBordersVisible):
(WebCore::InspectorPageAgent::snapshotNode):
(WebCore::InspectorPageAgent::snapshotRect):
(WebCore::InspectorPageAgent::archive):
(WebCore::InspectorPageAgent::mainFrame): Deleted.
(WebCore::InspectorPageAgent::hasIdForFrame const): Deleted.

* inspector/agents/InspectorApplicationCacheAgent.h:
* inspector/agents/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::InspectorApplicationCacheAgent):
(WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus):
(WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
(WebCore::InspectorApplicationCacheAgent::assertFrameWithDocumentLoader):

* inspector/agents/InspectorCanvasAgent.h:
* inspector/agents/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
(WebCore::InspectorCanvasAgent::enable):

* inspector/agents/InspectorDOMStorageAgent.h:
* inspector/agents/InspectorDOMStorageAgent.cpp:
(WebCore::InspectorDOMStorageAgent::InspectorDOMStorageAgent):
(WebCore::InspectorDOMStorageAgent::findStorageArea):

* inspector/agents/InspectorIndexedDBAgent.h:
* inspector/agents/InspectorIndexedDBAgent.cpp:
(WebCore::InspectorIndexedDBAgent::InspectorIndexedDBAgent):
(WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
(WebCore::InspectorIndexedDBAgent::requestDatabase):
(WebCore::InspectorIndexedDBAgent::requestData):
(WebCore::InspectorIndexedDBAgent::clearObjectStore):

* inspector/agents/page/PageDebuggerAgent.h:
* inspector/agents/page/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::PageDebuggerAgent):
(WebCore::PageDebuggerAgent::sourceMapURLForScript):
(WebCore::PageDebuggerAgent::breakpointActionLog):
(WebCore::PageDebuggerAgent::injectedScriptForEval):

* inspector/agents/page/PageNetworkAgent.h:
* inspector/agents/page/PageNetworkAgent.cpp:
(WebCore::PageNetworkAgent::PageNetworkAgent):
(WebCore::PageNetworkAgent::loaderIdentifier):
(WebCore::PageNetworkAgent::frameIdentifier):
(WebCore::PageNetworkAgent::setResourceCachingDisabled):
(WebCore::PageNetworkAgent::scriptExecutionContext):

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):</pre>

<h3>Modified Paths</h3>
<ul>
<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="#trunkSourceWebCoreinspectorInspectorInstrumentationcpp">trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsInspectorApplicationCacheAgentcpp">trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsInspectorApplicationCacheAgenth">trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsInspectorCanvasAgentcpp">trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsInspectorCanvasAgenth">trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsInspectorDOMStorageAgentcpp">trunk/Source/WebCore/inspector/agents/InspectorDOMStorageAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsInspectorDOMStorageAgenth">trunk/Source/WebCore/inspector/agents/InspectorDOMStorageAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsInspectorIndexedDBAgentcpp">trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsInspectorIndexedDBAgenth">trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsInspectorPageAgentcpp">trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsInspectorPageAgenth">trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentspagePageDebuggerAgentcpp">trunk/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentspagePageDebuggerAgenth">trunk/Source/WebCore/inspector/agents/page/PageDebuggerAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentspagePageNetworkAgentcpp">trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentspagePageNetworkAgenth">trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/ChangeLog      2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -1,3 +1,91 @@
</span><ins>+2019-03-21  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Page: lazily create the agent
+        https://bugs.webkit.org/show_bug.cgi?id=195592
+        <rdar://problem/48791916>
+
+        Reviewed by Timothy Hatcher.
+
+        No change in functionality.
+
+        Have more agents save the inspected `Page` so they don't need to access it via the
+        `InspectorPageAgent`. Make some of `InspectorPageAgent`'s functions `static` so other
+        agents can use them without needing to have access to an enabled `InspectorPageAgent`.
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        (WebCore::InspectorController::createLazyAgents):
+
+        * inspector/agents/InspectorPageAgent.h:
+        (WebCore::InspectorPageAgent::page): Deleted.
+        * inspector/agents/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::InspectorPageAgent):
+        (WebCore::InspectorPageAgent::enable):
+        (WebCore::InspectorPageAgent::disable):
+        (WebCore::InspectorPageAgent::reload):
+        (WebCore::InspectorPageAgent::navigate):
+        (WebCore::InspectorPageAgent::overrideSetting):
+        (WebCore::InspectorPageAgent::getCookies):
+        (WebCore::InspectorPageAgent::deleteCookie):
+        (WebCore::InspectorPageAgent::getResourceTree):
+        (WebCore::InspectorPageAgent::searchInResources):
+        (WebCore::InspectorPageAgent::didPaint):
+        (WebCore::InspectorPageAgent::didLayout):
+        (WebCore::InspectorPageAgent::didScroll):
+        (WebCore::InspectorPageAgent::didRecalculateStyle):
+        (WebCore::InspectorPageAgent::setEmulatedMedia):
+        (WebCore::InspectorPageAgent::setForcedAppearance):
+        (WebCore::InspectorPageAgent::getCompositingBordersVisible):
+        (WebCore::InspectorPageAgent::setCompositingBordersVisible):
+        (WebCore::InspectorPageAgent::snapshotNode):
+        (WebCore::InspectorPageAgent::snapshotRect):
+        (WebCore::InspectorPageAgent::archive):
+        (WebCore::InspectorPageAgent::mainFrame): Deleted.
+        (WebCore::InspectorPageAgent::hasIdForFrame const): Deleted.
+
+        * inspector/agents/InspectorApplicationCacheAgent.h:
+        * inspector/agents/InspectorApplicationCacheAgent.cpp:
+        (WebCore::InspectorApplicationCacheAgent::InspectorApplicationCacheAgent):
+        (WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus):
+        (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
+        (WebCore::InspectorApplicationCacheAgent::assertFrameWithDocumentLoader):
+
+        * inspector/agents/InspectorCanvasAgent.h:
+        * inspector/agents/InspectorCanvasAgent.cpp:
+        (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
+        (WebCore::InspectorCanvasAgent::enable):
+
+        * inspector/agents/InspectorDOMStorageAgent.h:
+        * inspector/agents/InspectorDOMStorageAgent.cpp:
+        (WebCore::InspectorDOMStorageAgent::InspectorDOMStorageAgent):
+        (WebCore::InspectorDOMStorageAgent::findStorageArea):
+
+        * inspector/agents/InspectorIndexedDBAgent.h:
+        * inspector/agents/InspectorIndexedDBAgent.cpp:
+        (WebCore::InspectorIndexedDBAgent::InspectorIndexedDBAgent):
+        (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
+        (WebCore::InspectorIndexedDBAgent::requestDatabase):
+        (WebCore::InspectorIndexedDBAgent::requestData):
+        (WebCore::InspectorIndexedDBAgent::clearObjectStore):
+
+        * inspector/agents/page/PageDebuggerAgent.h:
+        * inspector/agents/page/PageDebuggerAgent.cpp:
+        (WebCore::PageDebuggerAgent::PageDebuggerAgent):
+        (WebCore::PageDebuggerAgent::sourceMapURLForScript):
+        (WebCore::PageDebuggerAgent::breakpointActionLog):
+        (WebCore::PageDebuggerAgent::injectedScriptForEval):
+
+        * inspector/agents/page/PageNetworkAgent.h:
+        * inspector/agents/page/PageNetworkAgent.cpp:
+        (WebCore::PageNetworkAgent::PageNetworkAgent):
+        (WebCore::PageNetworkAgent::loaderIdentifier):
+        (WebCore::PageNetworkAgent::frameIdentifier):
+        (WebCore::PageNetworkAgent::setResourceCachingDisabled):
+        (WebCore::PageNetworkAgent::scriptExecutionContext):
+
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
+
</ins><span class="cx"> 2019-03-21  Brent Fulgham  <bfulgham@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Hardening: Use WeakPtrs in VideoFullscreenInterface{Mac,AVKit}
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorController.cpp   2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp      2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -110,10 +110,6 @@
</span><span class="cx">     m_instrumentingAgents->setInspectorAgent(m_inspectorAgent);
</span><span class="cx">     m_agents.append(WTFMove(inspectorAgentPtr));
</span><span class="cx"> 
</span><del>-    auto pageAgentPtr = std::make_unique<InspectorPageAgent>(pageContext, inspectorClient, m_overlay.get());
-    m_pageAgent = pageAgentPtr.get();
-    m_agents.append(WTFMove(pageAgentPtr));
-
</del><span class="cx">     auto consoleAgent = std::make_unique<PageConsoleAgent>(pageContext);
</span><span class="cx">     m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get());
</span><span class="cx">     m_agents.append(WTFMove(consoleAgent));
</span><span class="lines">@@ -160,23 +156,27 @@
</span><span class="cx"> 
</span><span class="cx">     auto pageContext = pageAgentContext();
</span><span class="cx"> 
</span><ins>+    auto pageAgentPtr = std::make_unique<InspectorPageAgent>(pageContext, m_inspectorClient, m_overlay.get());
+    m_pageAgent = pageAgentPtr.get();
+    m_agents.append(WTFMove(pageAgentPtr));
+
</ins><span class="cx">     m_agents.append(std::make_unique<PageRuntimeAgent>(pageContext));
</span><span class="cx"> 
</span><del>-    auto debuggerAgent = std::make_unique<PageDebuggerAgent>(pageContext, m_pageAgent);
</del><ins>+    auto debuggerAgent = std::make_unique<PageDebuggerAgent>(pageContext);
</ins><span class="cx">     auto debuggerAgentPtr = debuggerAgent.get();
</span><span class="cx">     m_agents.append(WTFMove(debuggerAgent));
</span><span class="cx"> 
</span><del>-    m_agents.append(std::make_unique<PageNetworkAgent>(pageContext, m_pageAgent));
</del><ins>+    m_agents.append(std::make_unique<PageNetworkAgent>(pageContext));
</ins><span class="cx">     m_agents.append(std::make_unique<InspectorCSSAgent>(pageContext));
</span><span class="cx">     m_agents.append(std::make_unique<InspectorDOMAgent>(pageContext, m_overlay.get()));
</span><span class="cx">     m_agents.append(std::make_unique<InspectorDOMDebuggerAgent>(pageContext, debuggerAgentPtr));
</span><del>-    m_agents.append(std::make_unique<InspectorApplicationCacheAgent>(pageContext, m_pageAgent));
</del><ins>+    m_agents.append(std::make_unique<InspectorApplicationCacheAgent>(pageContext));
</ins><span class="cx">     m_agents.append(std::make_unique<InspectorLayerTreeAgent>(pageContext));
</span><span class="cx">     m_agents.append(std::make_unique<InspectorWorkerAgent>(pageContext));
</span><span class="cx">     m_agents.append(std::make_unique<InspectorDOMStorageAgent>(pageContext));
</span><span class="cx">     m_agents.append(std::make_unique<InspectorDatabaseAgent>(pageContext));
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><del>-    m_agents.append(std::make_unique<InspectorIndexedDBAgent>(pageContext, m_pageAgent));
</del><ins>+    m_agents.append(std::make_unique<InspectorIndexedDBAgent>(pageContext));
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     auto scriptProfilerAgentPtr = std::make_unique<InspectorScriptProfilerAgent>(pageContext);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorInstrumentationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp      2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -109,11 +109,11 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, DOMWrapperWorld& world)
</span><span class="cx"> {
</span><del>-    InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent();
</del><span class="cx">     if (PageDebuggerAgent* debuggerAgent = instrumentingAgents.pageDebuggerAgent()) {
</span><del>-        if (pageAgent && &world == &mainThreadNormalWorld() && &frame == &pageAgent->mainFrame())
</del><ins>+        if (&world == &mainThreadNormalWorld() && frame.isMainFrame())
</ins><span class="cx">             debuggerAgent->didClearMainFrameWindowObject();
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     if (PageRuntimeAgent* pageRuntimeAgent = instrumentingAgents.pageRuntimeAgent()) {
</span><span class="cx">         if (&world == &mainThreadNormalWorld())
</span><span class="cx">             pageRuntimeAgent->didCreateMainWorldContext(frame);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsInspectorApplicationCacheAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.cpp (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.cpp 2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.cpp    2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -40,11 +40,11 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace Inspector;
</span><span class="cx"> 
</span><del>-InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(WebAgentContext& context, InspectorPageAgent* pageAgent)
</del><ins>+InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(PageAgentContext& context)
</ins><span class="cx">     : InspectorAgentBase("ApplicationCache"_s, context)
</span><span class="cx">     , m_frontendDispatcher(std::make_unique<Inspector::ApplicationCacheFrontendDispatcher>(context.frontendRouter))
</span><span class="cx">     , m_backendDispatcher(Inspector::ApplicationCacheBackendDispatcher::create(context.backendDispatcher, this))
</span><del>-    , m_pageAgent(pageAgent)
</del><ins>+    , m_inspectedPage(context.inspectedPage)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -67,8 +67,13 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame)
</span><span class="cx"> {
</span><ins>+    auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
+    if (!pageAgent)
+        return;
+
</ins><span class="cx">     if (!frame)
</span><span class="cx">         return;
</span><ins>+
</ins><span class="cx">     auto* documentLoader = frame->loader().documentLoader();
</span><span class="cx">     if (!documentLoader)
</span><span class="cx">         return;
</span><span class="lines">@@ -77,7 +82,7 @@
</span><span class="cx">     int status = host.status();
</span><span class="cx">     auto manifestURL = host.applicationCacheInfo().manifest.string();
</span><span class="cx"> 
</span><del>-    m_frontendDispatcher->applicationCacheStatusUpdated(m_pageAgent->frameId(frame), manifestURL, status);
</del><ins>+    m_frontendDispatcher->applicationCacheStatusUpdated(pageAgent->frameId(frame), manifestURL, status);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorApplicationCacheAgent::networkStateChanged()
</span><span class="lines">@@ -89,7 +94,9 @@
</span><span class="cx"> {
</span><span class="cx">     result = JSON::ArrayOf<Inspector::Protocol::ApplicationCache::FrameWithManifest>::create();
</span><span class="cx"> 
</span><del>-    for (Frame* frame = &m_pageAgent->mainFrame(); frame; frame = frame->tree().traverseNext()) {
</del><ins>+    auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
+
+    for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) {
</ins><span class="cx">         auto* documentLoader = frame->loader().documentLoader();
</span><span class="cx">         if (!documentLoader)
</span><span class="cx">             continue;
</span><span class="lines">@@ -98,7 +105,7 @@
</span><span class="cx">         String manifestURL = host.applicationCacheInfo().manifest.string();
</span><span class="cx">         if (!manifestURL.isEmpty()) {
</span><span class="cx">             result->addItem(Inspector::Protocol::ApplicationCache::FrameWithManifest::create()
</span><del>-                .setFrameId(m_pageAgent->frameId(frame))
</del><ins>+                .setFrameId(pageAgent->frameId(frame))
</ins><span class="cx">                 .setManifestURL(manifestURL)
</span><span class="cx">                 .setStatus(static_cast<int>(host.status()))
</span><span class="cx">                 .release());
</span><span class="lines">@@ -108,7 +115,13 @@
</span><span class="cx"> 
</span><span class="cx"> DocumentLoader* InspectorApplicationCacheAgent::assertFrameWithDocumentLoader(ErrorString& errorString, const String& frameId)
</span><span class="cx"> {
</span><del>-    Frame* frame = m_pageAgent->assertFrame(errorString, frameId);
</del><ins>+    auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
+    if (!pageAgent) {
+        errorString = "Missing Page agent"_s;
+        return nullptr;
+    }
+
+    Frame* frame = pageAgent->assertFrame(errorString, frameId);
</ins><span class="cx">     if (!frame)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsInspectorApplicationCacheAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.h (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.h   2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.h      2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -37,7 +37,6 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Frame;
</span><del>-class InspectorPageAgent;
</del><span class="cx"> class Page;
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="lines">@@ -46,15 +45,17 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorApplicationCacheAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    InspectorApplicationCacheAgent(WebAgentContext&, InspectorPageAgent*);
</del><ins>+    InspectorApplicationCacheAgent(PageAgentContext&);
</ins><span class="cx">     virtual ~InspectorApplicationCacheAgent() = default;
</span><span class="cx"> 
</span><span class="cx">     void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
</span><span class="cx">     void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
</span><span class="cx"> 
</span><ins>+    // InspectorInstrumentation
</ins><span class="cx">     void updateApplicationCacheStatus(Frame*);
</span><span class="cx">     void networkStateChanged();
</span><span class="cx"> 
</span><ins>+    // ApplicationCacheBackendDispatcherHandler
</ins><span class="cx">     void enable(ErrorString&) override;
</span><span class="cx">     void getFramesWithManifests(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::ApplicationCache::FrameWithManifest>>& result) override;
</span><span class="cx">     void getManifestForFrame(ErrorString&, const String& frameId, String* manifestURL) override;
</span><span class="lines">@@ -69,7 +70,7 @@
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr<Inspector::ApplicationCacheFrontendDispatcher> m_frontendDispatcher;
</span><span class="cx">     RefPtr<Inspector::ApplicationCacheBackendDispatcher> m_backendDispatcher;
</span><del>-    InspectorPageAgent* m_pageAgent { nullptr };
</del><ins>+    Page& m_inspectedPage;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsInspectorCanvasAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp   2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp      2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -71,11 +71,12 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace Inspector;
</span><span class="cx"> 
</span><del>-InspectorCanvasAgent::InspectorCanvasAgent(WebAgentContext& context)
</del><ins>+InspectorCanvasAgent::InspectorCanvasAgent(PageAgentContext& context)
</ins><span class="cx">     : InspectorAgentBase("Canvas"_s, context)
</span><span class="cx">     , m_frontendDispatcher(std::make_unique<Inspector::CanvasFrontendDispatcher>(context.frontendRouter))
</span><span class="cx">     , m_backendDispatcher(Inspector::CanvasBackendDispatcher::create(context.backendDispatcher, this))
</span><span class="cx">     , m_injectedScriptManager(context.injectedScriptManager)
</span><ins>+    , m_inspectedPage(context.inspectedPage)
</ins><span class="cx">     , m_canvasDestroyedTimer(*this, &InspectorCanvasAgent::canvasDestroyedTimerFired)
</span><span class="cx">     , m_canvasRecordingTimer(*this, &InspectorCanvasAgent::canvasRecordingTimerFired)
</span><span class="cx"> {
</span><span class="lines">@@ -111,13 +112,9 @@
</span><span class="cx">         if (!is<Document>(scriptExecutionContext))
</span><span class="cx">             return false;
</span><span class="cx"> 
</span><del>-        if (auto* inspectorPageAgent = m_instrumentingAgents.inspectorPageAgent()) {
-            // FIXME: <https://webkit.org/b/168475> Web Inspector: Correctly display iframe's WebSockets
-            auto* document = downcast<Document>(scriptExecutionContext);
-            return document->page() == &inspectorPageAgent->page();
-        }
-
-        return false;
</del><ins>+        // FIXME: <https://webkit.org/b/168475> Web Inspector: Correctly display iframe's WebSockets
+        auto* document = downcast<Document>(scriptExecutionContext);
+        return document->page() == &m_inspectedPage;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsInspectorCanvasAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.h (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.h     2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.h        2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorCanvasAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    explicit InspectorCanvasAgent(WebAgentContext&);
</del><ins>+    explicit InspectorCanvasAgent(PageAgentContext&);
</ins><span class="cx">     virtual ~InspectorCanvasAgent() = default;
</span><span class="cx"> 
</span><span class="cx">     void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
</span><span class="lines">@@ -128,12 +128,15 @@
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr<Inspector::CanvasFrontendDispatcher> m_frontendDispatcher;
</span><span class="cx">     RefPtr<Inspector::CanvasBackendDispatcher> m_backendDispatcher;
</span><ins>+
</ins><span class="cx">     Inspector::InjectedScriptManager& m_injectedScriptManager;
</span><ins>+    Page& m_inspectedPage;
+
</ins><span class="cx">     HashMap<String, RefPtr<InspectorCanvas>> m_identifierToInspectorCanvas;
</span><span class="cx">     Vector<String> m_removedCanvasIdentifiers;
</span><ins>+    Optional<size_t> m_recordingAutoCaptureFrameCount;
</ins><span class="cx">     Timer m_canvasDestroyedTimer;
</span><span class="cx">     Timer m_canvasRecordingTimer;
</span><del>-    Optional<size_t> m_recordingAutoCaptureFrameCount;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsInspectorDOMStorageAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMStorageAgent.cpp (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/InspectorDOMStorageAgent.cpp       2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMStorageAgent.cpp  2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -54,10 +54,11 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace Inspector;
</span><span class="cx"> 
</span><del>-InspectorDOMStorageAgent::InspectorDOMStorageAgent(WebAgentContext& context)
</del><ins>+InspectorDOMStorageAgent::InspectorDOMStorageAgent(PageAgentContext& context)
</ins><span class="cx">     : InspectorAgentBase("DOMStorage"_s, context)
</span><span class="cx">     , m_frontendDispatcher(std::make_unique<Inspector::DOMStorageFrontendDispatcher>(context.frontendRouter))
</span><span class="cx">     , m_backendDispatcher(Inspector::DOMStorageBackendDispatcher::create(context.backendDispatcher, this))
</span><ins>+    , m_inspectedPage(context.inspectedPage)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -178,14 +179,7 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
-    ASSERT(pageAgent);
-    if (!pageAgent) {
-        errorString = "Missing Page agent"_s;
-        return nullptr;
-    }
-
-    targetFrame = pageAgent->findFrameWithSecurityOrigin(securityOrigin);
</del><ins>+    targetFrame = InspectorPageAgent::findFrameWithSecurityOrigin(m_inspectedPage, securityOrigin);
</ins><span class="cx">     if (!targetFrame) {
</span><span class="cx">         errorString = "Frame not found for the given security origin"_s;
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -192,8 +186,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!isLocalStorage)
</span><del>-        return pageAgent->page().sessionStorage()->storageArea(targetFrame->document()->securityOrigin().data());
-    return pageAgent->page().storageNamespaceProvider().localStorageArea(*targetFrame->document());
</del><ins>+        return m_inspectedPage.sessionStorage()->storageArea(targetFrame->document()->securityOrigin().data());
+    return m_inspectedPage.storageNamespaceProvider().localStorageArea(*targetFrame->document());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsInspectorDOMStorageAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMStorageAgent.h (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/InspectorDOMStorageAgent.h 2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMStorageAgent.h    2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorDOMStorageAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    InspectorDOMStorageAgent(WebAgentContext&);
</del><ins>+    InspectorDOMStorageAgent(PageAgentContext&);
</ins><span class="cx">     virtual ~InspectorDOMStorageAgent() = default;
</span><span class="cx"> 
</span><span class="cx">     void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
</span><span class="lines">@@ -76,6 +76,8 @@
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr<Inspector::DOMStorageFrontendDispatcher> m_frontendDispatcher;
</span><span class="cx">     RefPtr<Inspector::DOMStorageBackendDispatcher> m_backendDispatcher;
</span><ins>+
+    Page& m_inspectedPage;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsInspectorIndexedDBAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp        2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp   2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -519,16 +519,14 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace
</span><span class="cx"> 
</span><del>-InspectorIndexedDBAgent::InspectorIndexedDBAgent(WebAgentContext& context, InspectorPageAgent* pageAgent)
</del><ins>+InspectorIndexedDBAgent::InspectorIndexedDBAgent(PageAgentContext& context)
</ins><span class="cx">     : InspectorAgentBase("IndexedDB"_s, context)
</span><span class="cx">     , m_injectedScriptManager(context.injectedScriptManager)
</span><span class="cx">     , m_backendDispatcher(Inspector::IndexedDBBackendDispatcher::create(context.backendDispatcher, this))
</span><del>-    , m_pageAgent(pageAgent)
</del><ins>+    , m_inspectedPage(context.inspectedPage)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-InspectorIndexedDBAgent::~InspectorIndexedDBAgent() = default;
-
</del><span class="cx"> void InspectorIndexedDBAgent::didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -590,7 +588,7 @@
</span><span class="cx">     
</span><span class="cx"> void InspectorIndexedDBAgent::requestDatabaseNames(const String& securityOrigin, Ref<RequestDatabaseNamesCallback>&& callback)
</span><span class="cx"> {
</span><del>-    Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin);
</del><ins>+    auto* frame = InspectorPageAgent::findFrameWithSecurityOrigin(m_inspectedPage, securityOrigin);
</ins><span class="cx">     Document* document;
</span><span class="cx">     IDBFactory* idbFactory;
</span><span class="cx">     if (!getDocumentAndIDBFactoryFromFrameOrSendFailure(frame, document, idbFactory, callback))
</span><span class="lines">@@ -612,7 +610,7 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorIndexedDBAgent::requestDatabase(const String& securityOrigin, const String& databaseName, Ref<RequestDatabaseCallback>&& callback)
</span><span class="cx"> {
</span><del>-    Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin);
</del><ins>+    auto* frame = InspectorPageAgent::findFrameWithSecurityOrigin(m_inspectedPage, securityOrigin);
</ins><span class="cx">     Document* document;
</span><span class="cx">     IDBFactory* idbFactory;
</span><span class="cx">     if (!getDocumentAndIDBFactoryFromFrameOrSendFailure(frame, document, idbFactory, callback))
</span><span class="lines">@@ -624,7 +622,7 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorIndexedDBAgent::requestData(const String& securityOrigin, const String& databaseName, const String& objectStoreName, const String& indexName, int skipCount, int pageSize, const JSON::Object* keyRange, Ref<RequestDataCallback>&& callback)
</span><span class="cx"> {
</span><del>-    Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin);
</del><ins>+    auto* frame = InspectorPageAgent::findFrameWithSecurityOrigin(m_inspectedPage, securityOrigin);
</ins><span class="cx">     Document* document;
</span><span class="cx">     IDBFactory* idbFactory;
</span><span class="cx">     if (!getDocumentAndIDBFactoryFromFrameOrSendFailure(frame, document, idbFactory, callback))
</span><span class="lines">@@ -735,7 +733,7 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorIndexedDBAgent::clearObjectStore(const String& securityOrigin, const String& databaseName, const String& objectStoreName, Ref<ClearObjectStoreCallback>&& callback)
</span><span class="cx"> {
</span><del>-    Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin);
</del><ins>+    auto* frame = InspectorPageAgent::findFrameWithSecurityOrigin(m_inspectedPage, securityOrigin);
</ins><span class="cx">     Document* document;
</span><span class="cx">     IDBFactory* idbFactory;
</span><span class="cx">     if (!getDocumentAndIDBFactoryFromFrameOrSendFailure(frame, document, idbFactory, callback))
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsInspectorIndexedDBAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.h (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.h  2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.h     2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class InspectorPageAgent;
</del><ins>+class Page;
</ins><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><span class="lines">@@ -51,13 +51,13 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorIndexedDBAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    InspectorIndexedDBAgent(WebAgentContext&, InspectorPageAgent*);
-    virtual ~InspectorIndexedDBAgent();
</del><ins>+    InspectorIndexedDBAgent(PageAgentContext&);
+    virtual ~InspectorIndexedDBAgent() = default;
</ins><span class="cx"> 
</span><span class="cx">     void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
</span><span class="cx">     void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
</span><span class="cx"> 
</span><del>-    // Called from the front-end.
</del><ins>+    // IndexedDBBackendDispatcherHandler
</ins><span class="cx">     void enable(ErrorString&) override;
</span><span class="cx">     void disable(ErrorString&) override;
</span><span class="cx">     void requestDatabaseNames(const String& securityOrigin, Ref<RequestDatabaseNamesCallback>&&) override;
</span><span class="lines">@@ -68,7 +68,8 @@
</span><span class="cx"> private:
</span><span class="cx">     Inspector::InjectedScriptManager& m_injectedScriptManager;
</span><span class="cx">     RefPtr<Inspector::IndexedDBBackendDispatcher> m_backendDispatcher;
</span><del>-    InspectorPageAgent* m_pageAgent { nullptr };
</del><ins>+
+    Page& m_inspectedPage;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsInspectorPageAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp     2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp        2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -309,11 +309,29 @@
</span><span class="cx">     return resourceTypeJSON(inspectorResourceType(cachedResource));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Frame* InspectorPageAgent::findFrameWithSecurityOrigin(Page& page, const String& originRawString)
+{
+    for (Frame* frame = &page.mainFrame(); frame; frame = frame->tree().traverseNext()) {
+        if (frame->document()->securityOrigin().toRawString() == originRawString)
+            return frame;
+    }
+    return nullptr;
+}
+
+DocumentLoader* InspectorPageAgent::assertDocumentLoader(ErrorString& errorString, Frame* frame)
+{
+    FrameLoader& frameLoader = frame->loader();
+    DocumentLoader* documentLoader = frameLoader.documentLoader();
+    if (!documentLoader)
+        errorString = "No documentLoader for given frame found"_s;
+    return documentLoader;
+}
+
</ins><span class="cx"> InspectorPageAgent::InspectorPageAgent(PageAgentContext& context, InspectorClient* client, InspectorOverlay* overlay)
</span><span class="cx">     : InspectorAgentBase("Page"_s, context)
</span><span class="cx">     , m_frontendDispatcher(std::make_unique<Inspector::PageFrontendDispatcher>(context.frontendRouter))
</span><span class="cx">     , m_backendDispatcher(Inspector::PageBackendDispatcher::create(context.backendDispatcher, this))
</span><del>-    , m_page(context.inspectedPage)
</del><ins>+    , m_inspectedPage(context.inspectedPage)
</ins><span class="cx">     , m_client(client)
</span><span class="cx">     , m_overlay(overlay)
</span><span class="cx"> {
</span><span class="lines">@@ -336,7 +354,9 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::enable(ErrorString&)
</span><span class="cx"> {
</span><del>-    m_enabled = true;
</del><ins>+    if (m_instrumentingAgents.inspectorPageAgent() == this)
+        return;
+
</ins><span class="cx">     m_instrumentingAgents.setInspectorPageAgent(this);
</span><span class="cx"> 
</span><span class="cx">     auto stopwatch = m_environment.executionStopwatch();
</span><span class="lines">@@ -344,15 +364,12 @@
</span><span class="cx">     stopwatch->start();
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(OS_DARK_MODE_SUPPORT)
</span><del>-    defaultAppearanceDidChange(m_page.defaultUseDarkAppearance());
</del><ins>+    defaultAppearanceDidChange(m_inspectedPage.defaultUseDarkAppearance());
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::disable(ErrorString&)
</span><span class="cx"> {
</span><del>-    m_enabled = false;
-    m_instrumentingAgents.setInspectorPageAgent(nullptr);
-
</del><span class="cx">     ErrorString unused;
</span><span class="cx">     setShowPaintRects(unused, false);
</span><span class="cx">     setShowRulers(unused, false);
</span><span class="lines">@@ -361,11 +378,13 @@
</span><span class="cx">     setForcedAppearance(unused, emptyString());
</span><span class="cx"> 
</span><span class="cx"> #define DISABLE_INSPECTOR_OVERRIDE_SETTING(name) \
</span><del>-    m_page.settings().set##name##InspectorOverride(WTF::nullopt);
</del><ins>+    m_inspectedPage.settings().set##name##InspectorOverride(WTF::nullopt);
</ins><span class="cx"> 
</span><span class="cx">     FOR_EACH_INSPECTOR_OVERRIDE_SETTING(DISABLE_INSPECTOR_OVERRIDE_SETTING)
</span><span class="cx"> 
</span><span class="cx"> #undef DISABLE_INSPECTOR_OVERRIDE_SETTING
</span><ins>+
+    m_instrumentingAgents.setInspectorPageAgent(nullptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources)
</span><span class="lines">@@ -379,13 +398,13 @@
</span><span class="cx">     if (!revalidateAllResources)
</span><span class="cx">         reloadOptions.add(ReloadOption::ExpiredOnly);
</span><span class="cx"> 
</span><del>-    m_page.mainFrame().loader().reload(reloadOptions);
</del><ins>+    m_inspectedPage.mainFrame().loader().reload(reloadOptions);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::navigate(ErrorString&, const String& url)
</span><span class="cx"> {
</span><span class="cx">     UserGestureIndicator indicator { ProcessingUserGesture };
</span><del>-    Frame& frame = m_page.mainFrame();
</del><ins>+    Frame& frame = m_inspectedPage.mainFrame();
</ins><span class="cx"> 
</span><span class="cx">     ResourceRequest resourceRequest { frame.document()->completeURL(url) };
</span><span class="cx">     FrameLoadRequest frameLoadRequest { *frame.document(), frame.document()->securityOrigin(), resourceRequest, "_self"_s, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow, InitiatedByMainFrame::Unknown };
</span><span class="lines">@@ -414,9 +433,9 @@
</span><span class="cx"> #define CASE_INSPECTOR_OVERRIDE_SETTING(name) \
</span><span class="cx">     case Inspector::Protocol::Page::Setting::name: { \
</span><span class="cx">         if (value) \
</span><del>-            m_page.settings().set##name##InspectorOverride(*value); \
</del><ins>+            m_inspectedPage.settings().set##name##InspectorOverride(*value); \
</ins><span class="cx">         else \
</span><del>-            m_page.settings().set##name##InspectorOverride(WTF::nullopt); \
</del><ins>+            m_inspectedPage.settings().set##name##InspectorOverride(WTF::nullopt); \
</ins><span class="cx">         return; \
</span><span class="cx">     } \
</span><span class="cx"> 
</span><span class="lines">@@ -493,7 +512,7 @@
</span><span class="cx">     // always return the same true/false value.
</span><span class="cx">     bool rawCookiesImplemented = false;
</span><span class="cx"> 
</span><del>-    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
</del><ins>+    for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) {
</ins><span class="cx">         Document* document = frame->document();
</span><span class="cx">         if (!document || !document->page())
</span><span class="cx">             continue;
</span><span class="lines">@@ -524,7 +543,7 @@
</span><span class="cx"> void InspectorPageAgent::deleteCookie(ErrorString&, const String& cookieName, const String& url)
</span><span class="cx"> {
</span><span class="cx">     URL parsedURL({ }, url);
</span><del>-    for (Frame* frame = &m_page.mainFrame(); frame; frame = frame->tree().traverseNext()) {
</del><ins>+    for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) {
</ins><span class="cx">         if (auto* document = frame->document()) {
</span><span class="cx">             if (auto* page = document->page())
</span><span class="cx">                 page->cookieJar().deleteCookie(*document, parsedURL, cookieName);
</span><span class="lines">@@ -534,7 +553,7 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::getResourceTree(ErrorString&, RefPtr<Inspector::Protocol::Page::FrameResourceTree>& object)
</span><span class="cx"> {
</span><del>-    object = buildObjectForFrameTree(&m_page.mainFrame());
</del><ins>+    object = buildObjectForFrameTree(&m_inspectedPage.mainFrame());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::getResourceContent(ErrorString& errorString, const String& frameId, const String& url, String* content, bool* base64Encoded)
</span><span class="lines">@@ -607,7 +626,7 @@
</span><span class="cx">     bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false;
</span><span class="cx">     JSC::Yarr::RegularExpression regex = ContentSearchUtilities::createSearchRegex(text, caseSensitive, isRegex);
</span><span class="cx"> 
</span><del>-    for (Frame* frame = &m_page.mainFrame(); frame; frame = frame->tree().traverseNext()) {
</del><ins>+    for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) {
</ins><span class="cx">         for (auto* cachedResource : cachedResourcesForFrame(frame)) {
</span><span class="cx">             if (auto textContent = InspectorNetworkAgent::textContentForCachedResource(*cachedResource)) {
</span><span class="cx">                 int matchesCount = ContentSearchUtilities::countRegularExpressionMatches(regex, *textContent);
</span><span class="lines">@@ -662,11 +681,6 @@
</span><span class="cx">     m_identifierToFrame.remove(identifier);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Frame& InspectorPageAgent::mainFrame()
-{
-    return m_page.mainFrame();
-}
-
</del><span class="cx"> Frame* InspectorPageAgent::frameForId(const String& frameId)
</span><span class="cx"> {
</span><span class="cx">     return frameId.isEmpty() ? nullptr : m_identifierToFrame.get(frameId);
</span><span class="lines">@@ -683,11 +697,6 @@
</span><span class="cx">     }).iterator->value;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool InspectorPageAgent::hasIdForFrame(Frame* frame) const
-{
-    return frame && m_frameToIdentifier.contains(frame);
-}
-
</del><span class="cx"> String InspectorPageAgent::loaderId(DocumentLoader* loader)
</span><span class="cx"> {
</span><span class="cx">     if (!loader)
</span><span class="lines">@@ -697,15 +706,6 @@
</span><span class="cx">     }).iterator->value;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Frame* InspectorPageAgent::findFrameWithSecurityOrigin(const String& originRawString)
-{
-    for (Frame* frame = &m_page.mainFrame(); frame; frame = frame->tree().traverseNext()) {
-        if (frame->document()->securityOrigin().toRawString() == originRawString)
-            return frame;
-    }
-    return nullptr;
-}
-
</del><span class="cx"> Frame* InspectorPageAgent::assertFrame(ErrorString& errorString, const String& frameId)
</span><span class="cx"> {
</span><span class="cx">     Frame* frame = frameForId(frameId);
</span><span class="lines">@@ -714,15 +714,6 @@
</span><span class="cx">     return frame;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-DocumentLoader* InspectorPageAgent::assertDocumentLoader(ErrorString& errorString, Frame* frame)
-{
-    FrameLoader& frameLoader = frame->loader();
-    DocumentLoader* documentLoader = frameLoader.documentLoader();
-    if (!documentLoader)
-        errorString = "No documentLoader for given frame found"_s;
-    return documentLoader;
-}
-
</del><span class="cx"> void InspectorPageAgent::loaderDetachedFromFrame(DocumentLoader& loader)
</span><span class="cx"> {
</span><span class="cx">     m_loaderToIdentifier.remove(&loader);
</span><span class="lines">@@ -755,7 +746,7 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::didPaint(RenderObject& renderer, const LayoutRect& rect)
</span><span class="cx"> {
</span><del>-    if (!m_enabled || !m_showPaintRects)
</del><ins>+    if (!m_showPaintRects)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     LayoutRect absoluteRect = LayoutRect(renderer.localToAbsoluteQuad(FloatRect(rect)).boundingBox());
</span><span class="lines">@@ -781,22 +772,17 @@
</span><span class="cx">     if (isFirstLayout)
</span><span class="cx">         m_isFirstLayoutAfterOnLoad = false;
</span><span class="cx"> 
</span><del>-    if (!m_enabled)
-        return;
-
</del><span class="cx">     m_overlay->update();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::didScroll()
</span><span class="cx"> {
</span><del>-    if (m_enabled)
-        m_overlay->update();
</del><ins>+    m_overlay->update();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::didRecalculateStyle()
</span><span class="cx"> {
</span><del>-    if (m_enabled)
-        m_overlay->update();
</del><ins>+    m_overlay->update();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Ref<Inspector::Protocol::Page::Frame> InspectorPageAgent::buildObjectForFrame(Frame* frame)
</span><span class="lines">@@ -870,9 +856,9 @@
</span><span class="cx"> 
</span><span class="cx">     m_emulatedMedia = media;
</span><span class="cx"> 
</span><del>-    m_page.updateStyleAfterChangeInEnvironment();
</del><ins>+    m_inspectedPage.updateStyleAfterChangeInEnvironment();
</ins><span class="cx"> 
</span><del>-    if (auto* document = m_page.mainFrame().document())
</del><ins>+    if (auto* document = m_inspectedPage.mainFrame().document())
</ins><span class="cx">         document->updateLayout();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -884,11 +870,11 @@
</span><span class="cx">     m_forcedAppearance = appearance;
</span><span class="cx"> 
</span><span class="cx">     if (appearance == "Light"_s)
</span><del>-        m_page.setUseDarkAppearanceOverride(false);
</del><ins>+        m_inspectedPage.setUseDarkAppearanceOverride(false);
</ins><span class="cx">     else if (appearance == "Dark"_s)
</span><del>-        m_page.setUseDarkAppearanceOverride(true);
</del><ins>+        m_inspectedPage.setUseDarkAppearanceOverride(true);
</ins><span class="cx">     else
</span><del>-        m_page.setUseDarkAppearanceOverride(WTF::nullopt);
</del><ins>+        m_inspectedPage.setUseDarkAppearanceOverride(WTF::nullopt);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::applyUserAgentOverride(String& userAgent)
</span><span class="lines">@@ -905,19 +891,17 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::getCompositingBordersVisible(ErrorString&, bool* outParam)
</span><span class="cx"> {
</span><del>-    *outParam = m_page.settings().showDebugBorders() || m_page.settings().showRepaintCounter();
</del><ins>+    *outParam = m_inspectedPage.settings().showDebugBorders() || m_inspectedPage.settings().showRepaintCounter();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::setCompositingBordersVisible(ErrorString&, bool visible)
</span><span class="cx"> {
</span><del>-    m_page.settings().setShowDebugBorders(visible);
-    m_page.settings().setShowRepaintCounter(visible);
</del><ins>+    m_inspectedPage.settings().setShowDebugBorders(visible);
+    m_inspectedPage.settings().setShowRepaintCounter(visible);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::snapshotNode(ErrorString& errorString, int nodeId, String* outDataURL)
</span><span class="cx"> {
</span><del>-    Frame& frame = mainFrame();
-
</del><span class="cx">     InspectorDOMAgent* domAgent = m_instrumentingAgents.inspectorDOMAgent();
</span><span class="cx">     ASSERT(domAgent);
</span><span class="cx">     Node* node = domAgent->assertNode(errorString, nodeId);
</span><span class="lines">@@ -924,7 +908,7 @@
</span><span class="cx">     if (!node)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    std::unique_ptr<ImageBuffer> snapshot = WebCore::snapshotNode(frame, *node);
</del><ins>+    std::unique_ptr<ImageBuffer> snapshot = WebCore::snapshotNode(m_inspectedPage.mainFrame(), *node);
</ins><span class="cx">     if (!snapshot) {
</span><span class="cx">         errorString = "Could not capture snapshot"_s;
</span><span class="cx">         return;
</span><span class="lines">@@ -935,14 +919,12 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::snapshotRect(ErrorString& errorString, int x, int y, int width, int height, const String& coordinateSystem, String* outDataURL)
</span><span class="cx"> {
</span><del>-    Frame& frame = mainFrame();
-
</del><span class="cx">     SnapshotOptions options = SnapshotOptionsNone;
</span><span class="cx">     if (coordinateSystem == "Viewport")
</span><span class="cx">         options |= SnapshotOptionsInViewCoordinates;
</span><span class="cx"> 
</span><span class="cx">     IntRect rectangle(x, y, width, height);
</span><del>-    std::unique_ptr<ImageBuffer> snapshot = snapshotFrameRect(frame, rectangle, options);
</del><ins>+    std::unique_ptr<ImageBuffer> snapshot = snapshotFrameRect(m_inspectedPage.mainFrame(), rectangle, options);
</ins><span class="cx"> 
</span><span class="cx">     if (!snapshot) {
</span><span class="cx">         errorString = "Could not capture snapshot"_s;
</span><span class="lines">@@ -955,8 +937,7 @@
</span><span class="cx"> void InspectorPageAgent::archive(ErrorString& errorString, String* data)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(WEB_ARCHIVE) && USE(CF)
</span><del>-    Frame& frame = mainFrame();
-    auto archive = LegacyWebArchive::create(frame);
</del><ins>+    auto archive = LegacyWebArchive::create(m_inspectedPage.mainFrame());
</ins><span class="cx">     if (!archive) {
</span><span class="cx">         errorString = "Could not create web archive for main frame"_s;
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsInspectorPageAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h       2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h  2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -79,12 +79,13 @@
</span><span class="cx">     static Vector<CachedResource*> cachedResourcesForFrame(Frame*);
</span><span class="cx">     static void resourceContent(ErrorString&, Frame*, const URL&, String* result, bool* base64Encoded);
</span><span class="cx">     static String sourceMapURLForResource(CachedResource*);
</span><del>-
</del><span class="cx">     static CachedResource* cachedResource(Frame*, const URL&);
</span><span class="cx">     static Inspector::Protocol::Page::ResourceType resourceTypeJSON(ResourceType);
</span><span class="cx">     static ResourceType inspectorResourceType(CachedResource::Type);
</span><span class="cx">     static ResourceType inspectorResourceType(const CachedResource&);
</span><span class="cx">     static Inspector::Protocol::Page::ResourceType cachedResourceTypeJSON(const CachedResource&);
</span><ins>+    static Frame* findFrameWithSecurityOrigin(Page&, const String& originRawString);
+    static DocumentLoader* assertDocumentLoader(ErrorString&, Frame*);
</ins><span class="cx"> 
</span><span class="cx">     // Page API for InspectorFrontend
</span><span class="cx">     void enable(ErrorString&) final;
</span><span class="lines">@@ -132,15 +133,10 @@
</span><span class="cx">     void willDestroyFrontendAndBackend(Inspector::DisconnectReason) final;
</span><span class="cx"> 
</span><span class="cx">     // Cross-agents API
</span><del>-    Page& page() { return m_page; }
-    Frame& mainFrame();
</del><span class="cx">     Frame* frameForId(const String& frameId);
</span><span class="cx">     WEBCORE_EXPORT String frameId(Frame*);
</span><del>-    bool hasIdForFrame(Frame*) const;
</del><span class="cx">     String loaderId(DocumentLoader*);
</span><del>-    Frame* findFrameWithSecurityOrigin(const String& originRawString);
</del><span class="cx">     Frame* assertFrame(ErrorString&, const String& frameId);
</span><del>-    static DocumentLoader* assertDocumentLoader(ErrorString&, Frame*);
</del><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     double timestamp();
</span><span class="lines">@@ -154,7 +150,7 @@
</span><span class="cx">     std::unique_ptr<Inspector::PageFrontendDispatcher> m_frontendDispatcher;
</span><span class="cx">     RefPtr<Inspector::PageBackendDispatcher> m_backendDispatcher;
</span><span class="cx"> 
</span><del>-    Page& m_page;
</del><ins>+    Page& m_inspectedPage;
</ins><span class="cx">     InspectorClient* m_client { nullptr };
</span><span class="cx">     InspectorOverlay* m_overlay { nullptr };
</span><span class="cx"> 
</span><span class="lines">@@ -161,12 +157,11 @@
</span><span class="cx">     HashMap<Frame*, String> m_frameToIdentifier;
</span><span class="cx">     HashMap<String, Frame*> m_identifierToFrame;
</span><span class="cx">     HashMap<DocumentLoader*, String> m_loaderToIdentifier;
</span><del>-    bool m_enabled { false };
-    bool m_isFirstLayoutAfterOnLoad { false };
-    bool m_showPaintRects { false };
</del><span class="cx">     String m_userAgentOverride;
</span><span class="cx">     String m_emulatedMedia;
</span><span class="cx">     String m_forcedAppearance;
</span><ins>+    bool m_isFirstLayoutAfterOnLoad { false };
+    bool m_showPaintRects { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentspagePageDebuggerAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp 2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp    2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -56,10 +56,9 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace Inspector;
</span><span class="cx"> 
</span><del>-PageDebuggerAgent::PageDebuggerAgent(PageAgentContext& context, InspectorPageAgent* pageAgent)
</del><ins>+PageDebuggerAgent::PageDebuggerAgent(PageAgentContext& context)
</ins><span class="cx">     : WebDebuggerAgent(context)
</span><del>-    , m_page(context.inspectedPage)
-    , m_pageAgent(pageAgent)
</del><ins>+    , m_inspectedPage(context.inspectedPage)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -81,7 +80,7 @@
</span><span class="cx">     static NeverDestroyed<String> sourceMapHTTPHeaderDeprecated(MAKE_STATIC_STRING_IMPL("X-SourceMap"));
</span><span class="cx"> 
</span><span class="cx">     if (!script.url.isEmpty()) {
</span><del>-        CachedResource* resource = m_pageAgent->cachedResource(&m_page.mainFrame(), URL({ }, script.url));
</del><ins>+        CachedResource* resource = InspectorPageAgent::cachedResource(&m_inspectedPage.mainFrame(), URL({ }, script.url));
</ins><span class="cx">         if (resource) {
</span><span class="cx">             String sourceMapHeader = resource->response().httpHeaderField(sourceMapHTTPHeader);
</span><span class="cx">             if (!sourceMapHeader.isEmpty())
</span><span class="lines">@@ -116,13 +115,13 @@
</span><span class="cx"> 
</span><span class="cx"> void PageDebuggerAgent::breakpointActionLog(JSC::ExecState& state, const String& message)
</span><span class="cx"> {
</span><del>-    m_pageAgent->page().console().addMessage(MessageSource::JS, MessageLevel::Log, message, createScriptCallStack(&state));
</del><ins>+    m_inspectedPage.console().addMessage(MessageSource::JS, MessageLevel::Log, message, createScriptCallStack(&state));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString& errorString, const int* executionContextId)
</span><span class="cx"> {
</span><span class="cx">     if (!executionContextId) {
</span><del>-        JSC::ExecState* scriptState = mainWorldExecState(&m_pageAgent->mainFrame());
</del><ins>+        JSC::ExecState* scriptState = mainWorldExecState(&m_inspectedPage.mainFrame());
</ins><span class="cx">         return injectedScriptManager().injectedScriptFor(scriptState);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentspagePageDebuggerAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/page/PageDebuggerAgent.h (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/page/PageDebuggerAgent.h   2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/page/PageDebuggerAgent.h      2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -38,7 +38,6 @@
</span><span class="cx"> class Document;
</span><span class="cx"> class EventListener;
</span><span class="cx"> class EventTarget;
</span><del>-class InspectorPageAgent;
</del><span class="cx"> class Page;
</span><span class="cx"> class RegisteredEventListener;
</span><span class="cx"> class TimerBase;
</span><span class="lines">@@ -47,7 +46,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(PageDebuggerAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    PageDebuggerAgent(PageAgentContext&, InspectorPageAgent*);
</del><ins>+    PageDebuggerAgent(PageAgentContext&);
</ins><span class="cx">     virtual ~PageDebuggerAgent() = default;
</span><span class="cx"> 
</span><span class="cx">     void didClearMainFrameWindowObject();
</span><span class="lines">@@ -85,10 +84,8 @@
</span><span class="cx"> 
</span><span class="cx">     Inspector::InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
</span><span class="cx"> 
</span><del>-    Page& m_page;
</del><ins>+    Page& m_inspectedPage;
</ins><span class="cx"> 
</span><del>-    InspectorPageAgent* m_pageAgent;
-
</del><span class="cx">     HashMap<const RegisteredEventListener*, int> m_registeredEventListeners;
</span><span class="cx">     HashMap<const TimerBase*, int> m_postMessageTimers;
</span><span class="cx">     int m_nextEventListenerIdentifier { 1 };
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentspagePageNetworkAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp  2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp     2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -38,23 +38,28 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace Inspector;
</span><span class="cx"> 
</span><del>-PageNetworkAgent::PageNetworkAgent(PageAgentContext& context, InspectorPageAgent* pageAgent)
</del><ins>+PageNetworkAgent::PageNetworkAgent(PageAgentContext& context)
</ins><span class="cx">     : InspectorNetworkAgent(context)
</span><del>-    , m_pageAgent(pageAgent)
</del><ins>+    , m_inspectedPage(context.inspectedPage)
</ins><span class="cx"> {
</span><del>-    ASSERT(m_pageAgent);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String PageNetworkAgent::loaderIdentifier(DocumentLoader* loader)
</span><span class="cx"> {
</span><del>-    return m_pageAgent->loaderId(loader);
</del><ins>+    if (loader) {
+        if (auto* pageAgent = m_instrumentingAgents.inspectorPageAgent())
+            return pageAgent->loaderId(loader);
+    }
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String PageNetworkAgent::frameIdentifier(DocumentLoader* loader)
</span><span class="cx"> {
</span><del>-    if (!loader)
-        return { };
-    return m_pageAgent->frameId(loader->frame());
</del><ins>+    if (loader) {
+        if (auto* pageAgent = m_instrumentingAgents.inspectorPageAgent())
+            return pageAgent->frameId(loader->frame());
+    }
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Vector<WebSocket*> PageNetworkAgent::activeWebSockets(const LockHolder& lock)
</span><span class="lines">@@ -77,7 +82,7 @@
</span><span class="cx"> 
</span><span class="cx">         // FIXME: <https://webkit.org/b/168475> Web Inspector: Correctly display iframe's WebSockets
</span><span class="cx">         auto* document = downcast<Document>(webSocket->scriptExecutionContext());
</span><del>-        if (document->page() != &m_pageAgent->page())
</del><ins>+        if (document->page() != &m_inspectedPage)
</ins><span class="cx">             continue;
</span><span class="cx"> 
</span><span class="cx">         webSockets.append(webSocket);
</span><span class="lines">@@ -88,12 +93,18 @@
</span><span class="cx"> 
</span><span class="cx"> void PageNetworkAgent::setResourceCachingDisabled(bool disabled)
</span><span class="cx"> {
</span><del>-    m_pageAgent->page().setResourceCachingDisabledOverride(disabled);
</del><ins>+    m_inspectedPage.setResourceCachingDisabledOverride(disabled);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ScriptExecutionContext* PageNetworkAgent::scriptExecutionContext(ErrorString& errorString, const String& frameId)
</span><span class="cx"> {
</span><del>-    auto* frame = m_pageAgent->assertFrame(errorString, frameId);
</del><ins>+    auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
+    if (!pageAgent) {
+        errorString = "Missing Page agent"_s;
+        return nullptr;
+    }
+
+    auto* frame = pageAgent->assertFrame(errorString, frameId);
</ins><span class="cx">     if (!frame)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentspagePageNetworkAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.h (243302 => 243303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.h    2019-03-21 18:14:57 UTC (rev 243302)
+++ trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.h       2019-03-21 18:22:08 UTC (rev 243303)
</span><span class="lines">@@ -29,11 +29,13 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class Page;
+
</ins><span class="cx"> class PageNetworkAgent final : public InspectorNetworkAgent {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(PageNetworkAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    PageNetworkAgent(PageAgentContext&, InspectorPageAgent*);
</del><ins>+    PageNetworkAgent(PageAgentContext&);
</ins><span class="cx">     virtual ~PageNetworkAgent() = default;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -44,7 +46,7 @@
</span><span class="cx">     ScriptExecutionContext* scriptExecutionContext(ErrorString&, const String& frameId) final;
</span><span class="cx">     bool shouldForceBufferingNetworkResourceData() const final { return false; }
</span><span class="cx"> 
</span><del>-    InspectorPageAgent* m_pageAgent { nullptr };
</del><ins>+    Page& m_inspectedPage;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>

</body>
</html>