Diff
Modified: trunk/LayoutTests/ChangeLog (248453 => 248454)
--- trunk/LayoutTests/ChangeLog 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/LayoutTests/ChangeLog 2019-08-09 01:10:41 UTC (rev 248454)
@@ -1,3 +1,18 @@
+2019-08-08 Devin Rousso <[email protected]>
+
+ Web Inspector: Page: don't allow the domain to be disabled
+ https://bugs.webkit.org/show_bug.cgi?id=200109
+
+ Reviewed by Brian Burg.
+
+ * http/tests/inspector/page/loading-iframe-document-node.html:
+ * inspector/page/archive.html:
+ * inspector/page/frameScheduledNavigation.html:
+ * inspector/page/frameScheduledNavigation-async-delegates.html:
+ * inspector/page/frameStartedLoading.html:
+ * inspector/page/media-query-list-listener-exception.html:
+ * inspector/timeline/line-column.html:
+
2019-08-08 Chris Lord <[email protected]>
Short-cut WebGLRenderingContext::getParameter() for ALPHA_BITS when alpha channel is disabled
Modified: trunk/LayoutTests/http/tests/inspector/page/loading-iframe-document-node.html (248453 => 248454)
--- trunk/LayoutTests/http/tests/inspector/page/loading-iframe-document-node.html 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/LayoutTests/http/tests/inspector/page/loading-iframe-document-node.html 2019-08-09 01:10:41 UTC (rev 248454)
@@ -35,17 +35,14 @@
function step1_bootstrap() {
ProtocolTest.log("step1_bootstrap");
- // Enable the frame events.
- InspectorProtocol.sendCommand("Page.enable", {}, function() {
- // Enable the Runtime.executionContextCreated event.
- InspectorProtocol.sendCommand("Runtime.enable", {}, function() {
- // Initialize the DOM agent.
- InspectorProtocol.sendCommand("DOM.getDocument", {}, function() {
- ProtocolTest.log("Main document loaded");
-
- // Add the iframe to the DOM.
- InspectorProtocol.sendCommand("Runtime.evaluate", { "_expression_": "appendIframe()" });
- });
+ // Enable the Runtime.executionContextCreated event.
+ InspectorProtocol.sendCommand("Runtime.enable", {}, function() {
+ // Initialize the DOM agent.
+ InspectorProtocol.sendCommand("DOM.getDocument", {}, function() {
+ ProtocolTest.log("Main document loaded");
+
+ // Add the iframe to the DOM.
+ InspectorProtocol.sendCommand("Runtime.evaluate", { "_expression_": "appendIframe()" });
});
});
}
Modified: trunk/LayoutTests/inspector/page/archive.html (248453 => 248454)
--- trunk/LayoutTests/inspector/page/archive.html 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/LayoutTests/inspector/page/archive.html 2019-08-09 01:10:41 UTC (rev 248454)
@@ -4,7 +4,6 @@
<script>
function test()
{
- InspectorProtocol.sendCommand("Page.enable", {});
InspectorProtocol.sendCommand("Page.archive", {}, function(event) {
var data = ""
if (!data)
Modified: trunk/LayoutTests/inspector/page/frameScheduledNavigation-async-delegates.html (248453 => 248454)
--- trunk/LayoutTests/inspector/page/frameScheduledNavigation-async-delegates.html 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/LayoutTests/inspector/page/frameScheduledNavigation-async-delegates.html 2019-08-09 01:10:41 UTC (rev 248454)
@@ -16,7 +16,6 @@
InspectorProtocol.eventHandler["Page.frameScheduledNavigation"] = onScheduled;
InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStarted;
InspectorProtocol.eventHandler["Page.frameClearedScheduledNavigation"] = onCleared;
- InspectorProtocol.sendCommand("Page.enable", {});
function onScheduled(msg)
{
Modified: trunk/LayoutTests/inspector/page/frameScheduledNavigation.html (248453 => 248454)
--- trunk/LayoutTests/inspector/page/frameScheduledNavigation.html 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/LayoutTests/inspector/page/frameScheduledNavigation.html 2019-08-09 01:10:41 UTC (rev 248454)
@@ -13,7 +13,6 @@
InspectorProtocol.eventHandler["Page.frameScheduledNavigation"] = onScheduled;
InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStarted;
InspectorProtocol.eventHandler["Page.frameClearedScheduledNavigation"] = onCleared;
- InspectorProtocol.sendCommand("Page.enable", {});
function onScheduled(msg)
{
Modified: trunk/LayoutTests/inspector/page/frameStartedLoading.html (248453 => 248454)
--- trunk/LayoutTests/inspector/page/frameStartedLoading.html 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/LayoutTests/inspector/page/frameStartedLoading.html 2019-08-09 01:10:41 UTC (rev 248454)
@@ -14,7 +14,6 @@
{
InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStart;
InspectorProtocol.eventHandler["Page.frameStoppedLoading"] = onStop;
- InspectorProtocol.sendCommand("Page.enable", {});
function onStart()
{
Modified: trunk/LayoutTests/inspector/page/media-query-list-listener-exception.html (248453 => 248454)
--- trunk/LayoutTests/inspector/page/media-query-list-listener-exception.html 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/LayoutTests/inspector/page/media-query-list-listener-exception.html 2019-08-09 01:10:41 UTC (rev 248454)
@@ -10,7 +10,6 @@
function test()
{
- InspectorProtocol.sendCommand("Page.enable", {});
InspectorProtocol.sendCommand("Page.setEmulatedMedia", {"media": "print"}, function(messageObject) {
if (messageObject.error)
ProtocolTest.log("FAILED: " + messageObject.error.message);
Modified: trunk/LayoutTests/inspector/timeline/line-column.html (248453 => 248454)
--- trunk/LayoutTests/inspector/timeline/line-column.html 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/LayoutTests/inspector/timeline/line-column.html 2019-08-09 01:10:41 UTC (rev 248454)
@@ -37,7 +37,6 @@
{
let suite = ProtocolTest.createAsyncSuite("Timeline.LineColumn");
- InspectorProtocol.sendCommand("Page.enable");
InspectorProtocol.sendCommand("Timeline.enable");
function replacer(key, value) {
Modified: trunk/Source/_javascript_Core/ChangeLog (248453 => 248454)
--- trunk/Source/_javascript_Core/ChangeLog 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-08-09 01:10:41 UTC (rev 248454)
@@ -1,3 +1,18 @@
+2019-08-08 Devin Rousso <[email protected]>
+
+ Web Inspector: Page: don't allow the domain to be disabled
+ https://bugs.webkit.org/show_bug.cgi?id=200109
+
+ Reviewed by Brian Burg.
+
+ The `PageAgent` is relied on by many of the other agents, so much so that it doesn't make
+ sense to support the ability to "disable" (as well as "enable") the agent.
+
+ When the first frontend connects, we should treat the `PageAgent` as active and available.
+
+ * inspector/protocol/Page.json:
+ Remove `enable`/`disable`.
+
2019-08-08 Michael Saboff <[email protected]>
OpenSource MemoryFootprint API for JSC command line tool
Modified: trunk/Source/_javascript_Core/inspector/protocol/Page.json (248453 => 248454)
--- trunk/Source/_javascript_Core/inspector/protocol/Page.json 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/_javascript_Core/inspector/protocol/Page.json 2019-08-09 01:10:41 UTC (rev 248454)
@@ -111,14 +111,6 @@
],
"commands": [
{
- "name": "enable",
- "description": "Enables page domain notifications."
- },
- {
- "name": "disable",
- "description": "Disables page domain notifications."
- },
- {
"name": "reload",
"description": "Reloads the main frame of the inspected page.",
"parameters": [
Modified: trunk/Source/WebCore/ChangeLog (248453 => 248454)
--- trunk/Source/WebCore/ChangeLog 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebCore/ChangeLog 2019-08-09 01:10:41 UTC (rev 248454)
@@ -1,3 +1,52 @@
+2019-08-08 Devin Rousso <[email protected]>
+
+ Web Inspector: Page: don't allow the domain to be disabled
+ https://bugs.webkit.org/show_bug.cgi?id=200109
+
+ Reviewed by Brian Burg.
+
+ The `PageAgent` is relied on by many of the other agents, so much so that it doesn't make
+ sense to support the ability to "disable" (as well as "enable") the agent.
+
+ When the first frontend connects, we should treat the `PageAgent` as active and available.
+
+ * inspector/agents/InspectorPageAgent.h:
+ * inspector/agents/InspectorPageAgent.cpp:
+ (WebCore::InspectorPageAgent::didCreateFrontendAndBackend):
+ (WebCore::InspectorPageAgent::willDestroyFrontendAndBackend):
+ (WebCore::InspectorPageAgent::timestamp):
+ (WebCore::InspectorPageAgent::enable): Deleted.
+ (WebCore::InspectorPageAgent::disable): Deleted.
+
+ * inspector/agents/InspectorApplicationCacheAgent.cpp:
+ (WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus):
+ (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
+ (WebCore::InspectorApplicationCacheAgent::assertFrameWithDocumentLoader):
+ * inspector/agents/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::createStyleSheet):
+ * inspector/agents/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::highlightSelector):
+ (WebCore::InspectorDOMAgent::highlightFrame):
+ (WebCore::InspectorDOMAgent::buildObjectForNode):
+ * inspector/agents/InspectorTimelineAgent.cpp:
+ (WebCore::InspectorTimelineAgent::setFrameIdentifier):
+ * inspector/agents/page/PageNetworkAgent.cpp:
+ (WebCore::PageNetworkAgent::loaderIdentifier):
+ (WebCore::PageNetworkAgent::frameIdentifier):
+ (WebCore::PageNetworkAgent::scriptExecutionContext):
+ * inspector/agents/page/PageRuntimeAgent.cpp:
+ (WebCore::PageRuntimeAgent::didCreateMainWorldContext):
+ (WebCore::PageRuntimeAgent::reportExecutionContextCreation):
+
+ * testing/Internals.cpp:
+ (WebCore::InspectorStubFrontend::InspectorStubFrontend):
+ (WebCore::InspectorStubFrontend::frontendLoaded): Added.
+ (WebCore::InspectorStubFrontend::closeWindow):
+ (WebCore::InspectorStubFrontend::sendMessageToFrontend):
+ (WebCore::InspectorStubFrontend::frontendPage): Deleted.
+ Ensure that the backend always gets notified via `InspectorFrontendHost.loaded` so that
+ messages being sent to the frontend are batched.
+
2019-08-08 Chris Lord <[email protected]>
Short-cut WebGLRenderingContext::getParameter() for ALPHA_BITS when alpha channel is disabled
Modified: trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.cpp (248453 => 248454)
--- trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.cpp 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.cpp 2019-08-09 01:10:41 UTC (rev 248454)
@@ -85,10 +85,6 @@
void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame)
{
- auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
- if (!pageAgent)
- return;
-
if (!frame)
return;
@@ -100,7 +96,7 @@
int status = host.status();
auto manifestURL = host.applicationCacheInfo().manifest.string();
- m_frontendDispatcher->applicationCacheStatusUpdated(pageAgent->frameId(frame), manifestURL, status);
+ m_frontendDispatcher->applicationCacheStatusUpdated(m_instrumentingAgents.inspectorPageAgent()->frameId(frame), manifestURL, status);
}
void InspectorApplicationCacheAgent::networkStateChanged()
@@ -112,8 +108,6 @@
{
result = JSON::ArrayOf<Inspector::Protocol::ApplicationCache::FrameWithManifest>::create();
- auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
-
for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) {
auto* documentLoader = frame->loader().documentLoader();
if (!documentLoader)
@@ -123,7 +117,7 @@
String manifestURL = host.applicationCacheInfo().manifest.string();
if (!manifestURL.isEmpty()) {
result->addItem(Inspector::Protocol::ApplicationCache::FrameWithManifest::create()
- .setFrameId(pageAgent->frameId(frame))
+ .setFrameId(m_instrumentingAgents.inspectorPageAgent()->frameId(frame))
.setManifestURL(manifestURL)
.setStatus(static_cast<int>(host.status()))
.release());
@@ -133,13 +127,7 @@
DocumentLoader* InspectorApplicationCacheAgent::assertFrameWithDocumentLoader(ErrorString& errorString, const String& frameId)
{
- auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
- if (!pageAgent) {
- errorString = "Missing Page agent"_s;
- return nullptr;
- }
-
- Frame* frame = pageAgent->assertFrame(errorString, frameId);
+ Frame* frame = m_instrumentingAgents.inspectorPageAgent()->assertFrame(errorString, frameId);
if (!frame)
return nullptr;
Modified: trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp (248453 => 248454)
--- trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp 2019-08-09 01:10:41 UTC (rev 248454)
@@ -681,13 +681,7 @@
void InspectorCSSAgent::createStyleSheet(ErrorString& errorString, const String& frameId, String* styleSheetId)
{
- auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
- if (!pageAgent) {
- errorString = "Missing Page agent"_s;
- return;
- }
-
- Frame* frame = pageAgent->frameForId(frameId);
+ Frame* frame = m_instrumentingAgents.inspectorPageAgent()->frameForId(frameId);
if (!frame) {
errorString = "No frame for given id found"_s;
return;
Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp (248453 => 248454)
--- trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2019-08-09 01:10:41 UTC (rev 248454)
@@ -1224,13 +1224,7 @@
RefPtr<Document> document;
if (frameId) {
- auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
- if (!pageAgent) {
- errorString = "Missing Page agent"_s;
- return;
- }
-
- Frame* frame = pageAgent->frameForId(*frameId);
+ Frame* frame = m_instrumentingAgents.inspectorPageAgent()->frameForId(*frameId);
if (!frame) {
errorString = "No frame for given id found"_s;
return;
@@ -1317,13 +1311,7 @@
void InspectorDOMAgent::highlightFrame(ErrorString& errorString, const String& frameId, const JSON::Object* color, const JSON::Object* outlineColor)
{
- auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
- if (!pageAgent) {
- errorString = "Missing Page agent"_s;
- return;
- }
-
- Frame* frame = pageAgent->assertFrame(errorString, frameId);
+ Frame* frame = m_instrumentingAgents.inspectorPageAgent()->assertFrame(errorString, frameId);
if (!frame)
return;
@@ -1563,11 +1551,8 @@
value->setChildren(WTFMove(children));
}
- auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
- if (pageAgent) {
- if (auto* frameView = node->document().view())
- value->setFrameId(pageAgent->frameId(&frameView->frame()));
- }
+ if (auto* frameView = node->document().view())
+ value->setFrameId(m_instrumentingAgents.inspectorPageAgent()->frameId(&frameView->frame()));
if (is<Element>(*node)) {
Element& element = downcast<Element>(*node);
@@ -1603,8 +1588,7 @@
}
} else if (is<Document>(*node)) {
Document& document = downcast<Document>(*node);
- if (pageAgent)
- value->setFrameId(pageAgent->frameId(document.frame()));
+ value->setFrameId(m_instrumentingAgents.inspectorPageAgent()->frameId(document.frame()));
value->setDocumentURL(documentURLString(&document));
value->setBaseURL(documentBaseURLString(&document));
value->setXmlVersion(document.xmlVersion());
Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp (248453 => 248454)
--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp 2019-08-09 01:10:41 UTC (rev 248454)
@@ -343,24 +343,6 @@
void InspectorPageAgent::didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*)
{
-}
-
-void InspectorPageAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason)
-{
- ErrorString unused;
- disable(unused);
-}
-
-double InspectorPageAgent::timestamp()
-{
- return m_environment.executionStopwatch()->elapsedTime().seconds();
-}
-
-void InspectorPageAgent::enable(ErrorString&)
-{
- if (m_instrumentingAgents.inspectorPageAgent() == this)
- return;
-
m_instrumentingAgents.setInspectorPageAgent(this);
auto stopwatch = m_environment.executionStopwatch();
@@ -372,7 +354,7 @@
#endif
}
-void InspectorPageAgent::disable(ErrorString&)
+void InspectorPageAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason)
{
ErrorString unused;
setShowPaintRects(unused, false);
@@ -393,6 +375,11 @@
m_instrumentingAgents.setInspectorPageAgent(nullptr);
}
+double InspectorPageAgent::timestamp()
+{
+ return m_environment.executionStopwatch()->elapsedTime().seconds();
+}
+
void InspectorPageAgent::reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources)
{
bool reloadFromOrigin = optionalReloadFromOrigin && *optionalReloadFromOrigin;
Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h (248453 => 248454)
--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h 2019-08-09 01:10:41 UTC (rev 248454)
@@ -87,9 +87,7 @@
static Frame* findFrameWithSecurityOrigin(Page&, const String& originRawString);
static DocumentLoader* assertDocumentLoader(ErrorString&, Frame*);
- // Page API for InspectorFrontend
- void enable(ErrorString&) final;
- void disable(ErrorString&) final;
+ // PageBackendDispatcherHandler
void reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources) final;
void navigate(ErrorString&, const String& url) final;
void overrideUserAgent(ErrorString&, const String* value) final;
Modified: trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp (248453 => 248454)
--- trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp 2019-08-09 01:10:41 UTC (rev 248454)
@@ -740,11 +740,7 @@
if (!frame)
return;
- auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
- if (!pageAgent)
- return;
-
- record->setString("frameId"_s, pageAgent->frameId(frame));
+ record->setString("frameId"_s, m_instrumentingAgents.inspectorPageAgent()->frameId(frame));
}
void InspectorTimelineAgent::didCompleteRecordEntry(const TimelineRecordEntry& entry)
Modified: trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp (248453 => 248454)
--- trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp 2019-08-09 01:10:41 UTC (rev 248454)
@@ -48,19 +48,15 @@
String PageNetworkAgent::loaderIdentifier(DocumentLoader* loader)
{
- if (loader) {
- if (auto* pageAgent = m_instrumentingAgents.inspectorPageAgent())
- return pageAgent->loaderId(loader);
- }
+ if (loader)
+ return m_instrumentingAgents.inspectorPageAgent()->loaderId(loader);
return { };
}
String PageNetworkAgent::frameIdentifier(DocumentLoader* loader)
{
- if (loader) {
- if (auto* pageAgent = m_instrumentingAgents.inspectorPageAgent())
- return pageAgent->frameId(loader->frame());
- }
+ if (loader)
+ return m_instrumentingAgents.inspectorPageAgent()->frameId(loader->frame());
return { };
}
@@ -100,13 +96,7 @@
ScriptExecutionContext* PageNetworkAgent::scriptExecutionContext(ErrorString& errorString, const String& frameId)
{
- auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
- if (!pageAgent) {
- errorString = "Missing Page agent"_s;
- return nullptr;
- }
-
- auto* frame = pageAgent->assertFrame(errorString, frameId);
+ auto* frame = m_instrumentingAgents.inspectorPageAgent()->assertFrame(errorString, frameId);
if (!frame)
return nullptr;
Modified: trunk/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp (248453 => 248454)
--- trunk/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp 2019-08-09 01:10:41 UTC (rev 248454)
@@ -85,11 +85,7 @@
void PageRuntimeAgent::didCreateMainWorldContext(Frame& frame)
{
- auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
- if (!pageAgent)
- return;
-
- auto frameId = pageAgent->frameId(&frame);
+ auto frameId = m_instrumentingAgents.inspectorPageAgent()->frameId(&frame);
auto* scriptState = mainWorldExecState(&frame);
notifyContextCreated(frameId, scriptState, nullptr, true);
}
@@ -122,15 +118,11 @@
void PageRuntimeAgent::reportExecutionContextCreation()
{
- auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
- if (!pageAgent)
- return;
-
Vector<std::pair<JSC::ExecState*, SecurityOrigin*>> isolatedContexts;
for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) {
if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
continue;
- String frameId = pageAgent->frameId(frame);
+ String frameId = m_instrumentingAgents.inspectorPageAgent()->frameId(frame);
JSC::ExecState* scriptState = mainWorldExecState(frame);
notifyContextCreated(frameId, scriptState, nullptr, true);
Modified: trunk/Source/WebCore/testing/Internals.cpp (248453 => 248454)
--- trunk/Source/WebCore/testing/Internals.cpp 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebCore/testing/Internals.cpp 2019-08-09 01:10:41 UTC (rev 248454)
@@ -322,6 +322,7 @@
virtual ~InspectorStubFrontend();
private:
+ void frontendLoaded() final;
void attachWindow(DockSide) final { }
void detachWindow() final { }
void closeWindow() final;
@@ -337,26 +338,18 @@
void sendMessageToFrontend(const String& message) final;
ConnectionType connectionType() const final { return ConnectionType::Local; }
- Page* frontendPage() const
- {
- if (!m_frontendWindow || !m_frontendWindow->document())
- return nullptr;
-
- return m_frontendWindow->document()->page();
- }
-
RefPtr<DOMWindow> m_frontendWindow;
- InspectorController& m_frontendController;
+ Vector<String> m_messages;
+ bool m_loaded { false };
};
InspectorStubFrontend::InspectorStubFrontend(Page& inspectedPage, RefPtr<DOMWindow>&& frontendWindow)
: InspectorFrontendClientLocal(&inspectedPage.inspectorController(), frontendWindow->document()->page(), std::make_unique<InspectorFrontendClientLocal::Settings>())
, m_frontendWindow(frontendWindow.copyRef())
- , m_frontendController(frontendPage()->inspectorController())
{
ASSERT_ARG(frontendWindow, frontendWindow);
- m_frontendController.setInspectorFrontendClient(this);
+ frontendPage()->inspectorController().setInspectorFrontendClient(this);
inspectedPage.inspectorController().connectFrontend(*this);
}
@@ -365,12 +358,21 @@
closeWindow();
}
+void InspectorStubFrontend::frontendLoaded()
+{
+ m_loaded = true;
+
+ for (auto& message : m_messages)
+ sendMessageToFrontend(message);
+ m_messages.clear();
+}
+
void InspectorStubFrontend::closeWindow()
{
if (!m_frontendWindow)
return;
- m_frontendController.setInspectorFrontendClient(nullptr);
+ frontendPage()->inspectorController().setInspectorFrontendClient(nullptr);
inspectedPage()->inspectorController().disconnectFrontend(*this);
m_frontendWindow->close();
@@ -381,6 +383,11 @@
{
ASSERT_ARG(message, !message.isEmpty());
+ if (!m_loaded) {
+ m_messages.append(message);
+ return;
+ }
+
InspectorClient::doDispatchMessageOnFrontendPage(frontendPage(), message);
}
Modified: trunk/Source/WebInspectorUI/ChangeLog (248453 => 248454)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-08-09 01:10:41 UTC (rev 248454)
@@ -1,5 +1,30 @@
2019-08-08 Devin Rousso <[email protected]>
+ Web Inspector: Page: don't allow the domain to be disabled
+ https://bugs.webkit.org/show_bug.cgi?id=200109
+
+ Reviewed by Brian Burg.
+
+ The `PageAgent` is relied on by many of the other agents, so much so that it doesn't make
+ sense to support the ability to "disable" (as well as "enable") the agent.
+
+ When the first frontend connects, we should treat the `PageAgent` as active and available.
+
+ * UserInterface/Controllers/NetworkManager.js:
+ (WI.NetworkManager.prototype.initializeTarget):
+
+ * Test/Test.js:
+ (WI.loaded):
+ (WI.initializeBackendTarget):
+ (WI.contentLoaded):
+ (WI.targetsAvailable): Added.
+ (WI.whenTargetsAvailable): Added.
+ * Test/TestStub.js:
+ Ensure that the backend always gets notified via `InspectorFrontendHost.loaded` so that
+ messages being sent to the frontend are batched.
+
+2019-08-08 Devin Rousso <[email protected]>
+
Web Inspector: rename `queryObjects` to `queryInstances` for clarity
https://bugs.webkit.org/show_bug.cgi?id=200520
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js (248453 => 248454)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js 2019-08-09 01:10:41 UTC (rev 248454)
@@ -76,7 +76,10 @@
initializeTarget(target)
{
if (target.PageAgent) {
- target.PageAgent.enable();
+ // COMPATIBILITY (iOS 13): Page.enable was removed.
+ if (target.PageAgent.enable)
+ target.PageAgent.enable();
+
target.PageAgent.getResourceTree(this._processMainFrameResourceTreePayload.bind(this));
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Test/Test.js (248453 => 248454)
--- trunk/Source/WebInspectorUI/UserInterface/Test/Test.js 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/Test.js 2019-08-09 01:10:41 UTC (rev 248454)
@@ -77,6 +77,7 @@
// Targets.
WI.backendTarget = null;
WI.pageTarget = null;
+ WI._targetsAvailablePromise = new WI.WrappedPromise;
// FIXME: Eliminate `TargetAgent.exists`.
TargetAgent.exists((error) => {
@@ -90,6 +91,8 @@
WI.backendTarget = target;
WI.resetMainExecutionContext();
+
+ WI._targetsAvailablePromise.resolve();
};
WI.initializePageTarget = function(target)
@@ -142,7 +145,9 @@
WI.timelineManager.enable();
// Signal that the frontend is now ready to receive messages.
- InspectorFrontendAPI.loadCompleted();
+ WI.whenTargetsAvailable().then(() => {
+ InspectorFrontendAPI.loadCompleted();
+ });
// Tell the InspectorFrontendHost we loaded, which causes the window to display
// and pending InspectorFrontendAPI commands to be sent.
@@ -167,6 +172,16 @@
{
};
+WI.targetsAvailable = function()
+{
+ return WI._targetsAvailablePromise.settled;
+};
+
+WI.whenTargetsAvailable = function()
+{
+ return WI._targetsAvailablePromise.promise;
+};
+
Object.defineProperty(WI, "mainTarget",
{
get() { return WI.pageTarget || WI.backendTarget; }
Modified: trunk/Source/WebInspectorUI/UserInterface/Test/TestStub.js (248453 => 248454)
--- trunk/Source/WebInspectorUI/UserInterface/Test/TestStub.js 2019-08-09 01:05:06 UTC (rev 248453)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/TestStub.js 2019-08-09 01:10:41 UTC (rev 248454)
@@ -29,6 +29,10 @@
window.ProtocolTest = new ProtocolTestHarness();
+document.addEventListener("DOMContentLoaded", (event) => {
+ InspectorFrontendHost.loaded();
+});
+
window.addEventListener("message", (event) => {
try {
eval(event.data);