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