Changeset 248454 in webkit
- Timestamp:
- Aug 8, 2019 6:10:41 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r248448 r248454 1 2019-08-08 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Page: don't allow the domain to be disabled 4 https://bugs.webkit.org/show_bug.cgi?id=200109 5 6 Reviewed by Brian Burg. 7 8 * http/tests/inspector/page/loading-iframe-document-node.html: 9 * inspector/page/archive.html: 10 * inspector/page/frameScheduledNavigation.html: 11 * inspector/page/frameScheduledNavigation-async-delegates.html: 12 * inspector/page/frameStartedLoading.html: 13 * inspector/page/media-query-list-listener-exception.html: 14 * inspector/timeline/line-column.html: 15 1 16 2019-08-08 Chris Lord <chrislord.net@gmail.com> 2 17 -
trunk/LayoutTests/http/tests/inspector/page/loading-iframe-document-node.html
r188267 r248454 36 36 function step1_bootstrap() { 37 37 ProtocolTest.log("step1_bootstrap"); 38 // Enable the frame events. 39 InspectorProtocol.sendCommand("Page.enable", {}, function() { 40 // Enable the Runtime.executionContextCreated event. 41 InspectorProtocol.sendCommand("Runtime.enable", {}, function() { 42 // Initialize the DOM agent. 43 InspectorProtocol.sendCommand("DOM.getDocument", {}, function() { 44 ProtocolTest.log("Main document loaded"); 45 46 // Add the iframe to the DOM. 47 InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "appendIframe()" }); 48 }); 38 // Enable the Runtime.executionContextCreated event. 39 InspectorProtocol.sendCommand("Runtime.enable", {}, function() { 40 // Initialize the DOM agent. 41 InspectorProtocol.sendCommand("DOM.getDocument", {}, function() { 42 ProtocolTest.log("Main document loaded"); 43 44 // Add the iframe to the DOM. 45 InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "appendIframe()" }); 49 46 }); 50 47 }); -
trunk/LayoutTests/inspector/page/archive.html
r210062 r248454 5 5 function test() 6 6 { 7 InspectorProtocol.sendCommand("Page.enable", {});8 7 InspectorProtocol.sendCommand("Page.archive", {}, function(event) { 9 8 var data = event.result.data; -
trunk/LayoutTests/inspector/page/frameScheduledNavigation-async-delegates.html
r229502 r248454 17 17 InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStarted; 18 18 InspectorProtocol.eventHandler["Page.frameClearedScheduledNavigation"] = onCleared; 19 InspectorProtocol.sendCommand("Page.enable", {});20 19 21 20 function onScheduled(msg) -
trunk/LayoutTests/inspector/page/frameScheduledNavigation.html
r229502 r248454 14 14 InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStarted; 15 15 InspectorProtocol.eventHandler["Page.frameClearedScheduledNavigation"] = onCleared; 16 InspectorProtocol.sendCommand("Page.enable", {});17 16 18 17 function onScheduled(msg) -
trunk/LayoutTests/inspector/page/frameStartedLoading.html
r210062 r248454 15 15 InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStart; 16 16 InspectorProtocol.eventHandler["Page.frameStoppedLoading"] = onStop; 17 InspectorProtocol.sendCommand("Page.enable", {});18 17 19 18 function onStart() -
trunk/LayoutTests/inspector/page/media-query-list-listener-exception.html
r208779 r248454 11 11 function test() 12 12 { 13 InspectorProtocol.sendCommand("Page.enable", {});14 13 InspectorProtocol.sendCommand("Page.setEmulatedMedia", {"media": "print"}, function(messageObject) { 15 14 if (messageObject.error) -
trunk/LayoutTests/inspector/timeline/line-column.html
r248286 r248454 38 38 let suite = ProtocolTest.createAsyncSuite("Timeline.LineColumn"); 39 39 40 InspectorProtocol.sendCommand("Page.enable");41 40 InspectorProtocol.sendCommand("Timeline.enable"); 42 41 -
trunk/Source/JavaScriptCore/ChangeLog
r248441 r248454 1 2019-08-08 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Page: don't allow the domain to be disabled 4 https://bugs.webkit.org/show_bug.cgi?id=200109 5 6 Reviewed by Brian Burg. 7 8 The `PageAgent` is relied on by many of the other agents, so much so that it doesn't make 9 sense to support the ability to "disable" (as well as "enable") the agent. 10 11 When the first frontend connects, we should treat the `PageAgent` as active and available. 12 13 * inspector/protocol/Page.json: 14 Remove `enable`/`disable`. 15 1 16 2019-08-08 Michael Saboff <msaboff@apple.com> 2 17 -
trunk/Source/JavaScriptCore/inspector/protocol/Page.json
r248274 r248454 112 112 "commands": [ 113 113 { 114 "name": "enable",115 "description": "Enables page domain notifications."116 },117 {118 "name": "disable",119 "description": "Disables page domain notifications."120 },121 {122 114 "name": "reload", 123 115 "description": "Reloads the main frame of the inspected page.", -
trunk/Source/WebCore/ChangeLog
r248448 r248454 1 2019-08-08 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Page: don't allow the domain to be disabled 4 https://bugs.webkit.org/show_bug.cgi?id=200109 5 6 Reviewed by Brian Burg. 7 8 The `PageAgent` is relied on by many of the other agents, so much so that it doesn't make 9 sense to support the ability to "disable" (as well as "enable") the agent. 10 11 When the first frontend connects, we should treat the `PageAgent` as active and available. 12 13 * inspector/agents/InspectorPageAgent.h: 14 * inspector/agents/InspectorPageAgent.cpp: 15 (WebCore::InspectorPageAgent::didCreateFrontendAndBackend): 16 (WebCore::InspectorPageAgent::willDestroyFrontendAndBackend): 17 (WebCore::InspectorPageAgent::timestamp): 18 (WebCore::InspectorPageAgent::enable): Deleted. 19 (WebCore::InspectorPageAgent::disable): Deleted. 20 21 * inspector/agents/InspectorApplicationCacheAgent.cpp: 22 (WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus): 23 (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests): 24 (WebCore::InspectorApplicationCacheAgent::assertFrameWithDocumentLoader): 25 * inspector/agents/InspectorCSSAgent.cpp: 26 (WebCore::InspectorCSSAgent::createStyleSheet): 27 * inspector/agents/InspectorDOMAgent.cpp: 28 (WebCore::InspectorDOMAgent::highlightSelector): 29 (WebCore::InspectorDOMAgent::highlightFrame): 30 (WebCore::InspectorDOMAgent::buildObjectForNode): 31 * inspector/agents/InspectorTimelineAgent.cpp: 32 (WebCore::InspectorTimelineAgent::setFrameIdentifier): 33 * inspector/agents/page/PageNetworkAgent.cpp: 34 (WebCore::PageNetworkAgent::loaderIdentifier): 35 (WebCore::PageNetworkAgent::frameIdentifier): 36 (WebCore::PageNetworkAgent::scriptExecutionContext): 37 * inspector/agents/page/PageRuntimeAgent.cpp: 38 (WebCore::PageRuntimeAgent::didCreateMainWorldContext): 39 (WebCore::PageRuntimeAgent::reportExecutionContextCreation): 40 41 * testing/Internals.cpp: 42 (WebCore::InspectorStubFrontend::InspectorStubFrontend): 43 (WebCore::InspectorStubFrontend::frontendLoaded): Added. 44 (WebCore::InspectorStubFrontend::closeWindow): 45 (WebCore::InspectorStubFrontend::sendMessageToFrontend): 46 (WebCore::InspectorStubFrontend::frontendPage): Deleted. 47 Ensure that the backend always gets notified via `InspectorFrontendHost.loaded` so that 48 messages being sent to the frontend are batched. 49 1 50 2019-08-08 Chris Lord <clord@igalia.com> 2 51 -
trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.cpp
r248179 r248454 86 86 void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame) 87 87 { 88 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();89 if (!pageAgent)90 return;91 92 88 if (!frame) 93 89 return; … … 101 97 auto manifestURL = host.applicationCacheInfo().manifest.string(); 102 98 103 m_frontendDispatcher->applicationCacheStatusUpdated( pageAgent->frameId(frame), manifestURL, status);99 m_frontendDispatcher->applicationCacheStatusUpdated(m_instrumentingAgents.inspectorPageAgent()->frameId(frame), manifestURL, status); 104 100 } 105 101 … … 112 108 { 113 109 result = JSON::ArrayOf<Inspector::Protocol::ApplicationCache::FrameWithManifest>::create(); 114 115 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();116 110 117 111 for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) { … … 124 118 if (!manifestURL.isEmpty()) { 125 119 result->addItem(Inspector::Protocol::ApplicationCache::FrameWithManifest::create() 126 .setFrameId( pageAgent->frameId(frame))120 .setFrameId(m_instrumentingAgents.inspectorPageAgent()->frameId(frame)) 127 121 .setManifestURL(manifestURL) 128 122 .setStatus(static_cast<int>(host.status())) … … 134 128 DocumentLoader* InspectorApplicationCacheAgent::assertFrameWithDocumentLoader(ErrorString& errorString, const String& frameId) 135 129 { 136 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 137 if (!pageAgent) { 138 errorString = "Missing Page agent"_s; 139 return nullptr; 140 } 141 142 Frame* frame = pageAgent->assertFrame(errorString, frameId); 130 Frame* frame = m_instrumentingAgents.inspectorPageAgent()->assertFrame(errorString, frameId); 143 131 if (!frame) 144 132 return nullptr; -
trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
r246490 r248454 682 682 void InspectorCSSAgent::createStyleSheet(ErrorString& errorString, const String& frameId, String* styleSheetId) 683 683 { 684 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 685 if (!pageAgent) { 686 errorString = "Missing Page agent"_s; 687 return; 688 } 689 690 Frame* frame = pageAgent->frameForId(frameId); 684 Frame* frame = m_instrumentingAgents.inspectorPageAgent()->frameForId(frameId); 691 685 if (!frame) { 692 686 errorString = "No frame for given id found"_s; -
trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
r248175 r248454 1225 1225 1226 1226 if (frameId) { 1227 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 1228 if (!pageAgent) { 1229 errorString = "Missing Page agent"_s; 1230 return; 1231 } 1232 1233 Frame* frame = pageAgent->frameForId(*frameId); 1227 Frame* frame = m_instrumentingAgents.inspectorPageAgent()->frameForId(*frameId); 1234 1228 if (!frame) { 1235 1229 errorString = "No frame for given id found"_s; … … 1318 1312 void InspectorDOMAgent::highlightFrame(ErrorString& errorString, const String& frameId, const JSON::Object* color, const JSON::Object* outlineColor) 1319 1313 { 1320 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 1321 if (!pageAgent) { 1322 errorString = "Missing Page agent"_s; 1323 return; 1324 } 1325 1326 Frame* frame = pageAgent->assertFrame(errorString, frameId); 1314 Frame* frame = m_instrumentingAgents.inspectorPageAgent()->assertFrame(errorString, frameId); 1327 1315 if (!frame) 1328 1316 return; … … 1564 1552 } 1565 1553 1566 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 1567 if (pageAgent) { 1568 if (auto* frameView = node->document().view()) 1569 value->setFrameId(pageAgent->frameId(&frameView->frame())); 1570 } 1554 if (auto* frameView = node->document().view()) 1555 value->setFrameId(m_instrumentingAgents.inspectorPageAgent()->frameId(&frameView->frame())); 1571 1556 1572 1557 if (is<Element>(*node)) { … … 1604 1589 } else if (is<Document>(*node)) { 1605 1590 Document& document = downcast<Document>(*node); 1606 if (pageAgent) 1607 value->setFrameId(pageAgent->frameId(document.frame())); 1591 value->setFrameId(m_instrumentingAgents.inspectorPageAgent()->frameId(document.frame())); 1608 1592 value->setDocumentURL(documentURLString(&document)); 1609 1593 value->setBaseURL(documentBaseURLString(&document)); -
trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
r248274 r248454 344 344 void InspectorPageAgent::didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) 345 345 { 346 }347 348 void InspectorPageAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason)349 {350 ErrorString unused;351 disable(unused);352 }353 354 double InspectorPageAgent::timestamp()355 {356 return m_environment.executionStopwatch()->elapsedTime().seconds();357 }358 359 void InspectorPageAgent::enable(ErrorString&)360 {361 if (m_instrumentingAgents.inspectorPageAgent() == this)362 return;363 364 346 m_instrumentingAgents.setInspectorPageAgent(this); 365 347 … … 373 355 } 374 356 375 void InspectorPageAgent:: disable(ErrorString&)357 void InspectorPageAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason) 376 358 { 377 359 ErrorString unused; … … 392 374 393 375 m_instrumentingAgents.setInspectorPageAgent(nullptr); 376 } 377 378 double InspectorPageAgent::timestamp() 379 { 380 return m_environment.executionStopwatch()->elapsedTime().seconds(); 394 381 } 395 382 -
trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h
r248274 r248454 88 88 static DocumentLoader* assertDocumentLoader(ErrorString&, Frame*); 89 89 90 // Page API for InspectorFrontend 91 void enable(ErrorString&) final; 92 void disable(ErrorString&) final; 90 // PageBackendDispatcherHandler 93 91 void reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources) final; 94 92 void navigate(ErrorString&, const String& url) final; -
trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp
r248389 r248454 741 741 return; 742 742 743 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 744 if (!pageAgent) 745 return; 746 747 record->setString("frameId"_s, pageAgent->frameId(frame)); 743 record->setString("frameId"_s, m_instrumentingAgents.inspectorPageAgent()->frameId(frame)); 748 744 } 749 745 -
trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp
r245508 r248454 49 49 String PageNetworkAgent::loaderIdentifier(DocumentLoader* loader) 50 50 { 51 if (loader) { 52 if (auto* pageAgent = m_instrumentingAgents.inspectorPageAgent()) 53 return pageAgent->loaderId(loader); 54 } 51 if (loader) 52 return m_instrumentingAgents.inspectorPageAgent()->loaderId(loader); 55 53 return { }; 56 54 } … … 58 56 String PageNetworkAgent::frameIdentifier(DocumentLoader* loader) 59 57 { 60 if (loader) { 61 if (auto* pageAgent = m_instrumentingAgents.inspectorPageAgent()) 62 return pageAgent->frameId(loader->frame()); 63 } 58 if (loader) 59 return m_instrumentingAgents.inspectorPageAgent()->frameId(loader->frame()); 64 60 return { }; 65 61 } … … 101 97 ScriptExecutionContext* PageNetworkAgent::scriptExecutionContext(ErrorString& errorString, const String& frameId) 102 98 { 103 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 104 if (!pageAgent) { 105 errorString = "Missing Page agent"_s; 106 return nullptr; 107 } 108 109 auto* frame = pageAgent->assertFrame(errorString, frameId); 99 auto* frame = m_instrumentingAgents.inspectorPageAgent()->assertFrame(errorString, frameId); 110 100 if (!frame) 111 101 return nullptr; -
trunk/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp
r245366 r248454 86 86 void PageRuntimeAgent::didCreateMainWorldContext(Frame& frame) 87 87 { 88 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 89 if (!pageAgent) 90 return; 91 92 auto frameId = pageAgent->frameId(&frame); 88 auto frameId = m_instrumentingAgents.inspectorPageAgent()->frameId(&frame); 93 89 auto* scriptState = mainWorldExecState(&frame); 94 90 notifyContextCreated(frameId, scriptState, nullptr, true); … … 123 119 void PageRuntimeAgent::reportExecutionContextCreation() 124 120 { 125 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();126 if (!pageAgent)127 return;128 129 121 Vector<std::pair<JSC::ExecState*, SecurityOrigin*>> isolatedContexts; 130 122 for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) { 131 123 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) 132 124 continue; 133 String frameId = pageAgent->frameId(frame);125 String frameId = m_instrumentingAgents.inspectorPageAgent()->frameId(frame); 134 126 135 127 JSC::ExecState* scriptState = mainWorldExecState(frame); -
trunk/Source/WebCore/testing/Internals.cpp
r248373 r248454 323 323 324 324 private: 325 void frontendLoaded() final; 325 326 void attachWindow(DockSide) final { } 326 327 void detachWindow() final { } … … 338 339 ConnectionType connectionType() const final { return ConnectionType::Local; } 339 340 340 Page* frontendPage() const341 {342 if (!m_frontendWindow || !m_frontendWindow->document())343 return nullptr;344 345 return m_frontendWindow->document()->page();346 }347 348 341 RefPtr<DOMWindow> m_frontendWindow; 349 InspectorController& m_frontendController; 342 Vector<String> m_messages; 343 bool m_loaded { false }; 350 344 }; 351 345 … … 353 347 : InspectorFrontendClientLocal(&inspectedPage.inspectorController(), frontendWindow->document()->page(), std::make_unique<InspectorFrontendClientLocal::Settings>()) 354 348 , m_frontendWindow(frontendWindow.copyRef()) 355 , m_frontendController(frontendPage()->inspectorController())356 349 { 357 350 ASSERT_ARG(frontendWindow, frontendWindow); 358 351 359 m_frontendController.setInspectorFrontendClient(this);352 frontendPage()->inspectorController().setInspectorFrontendClient(this); 360 353 inspectedPage.inspectorController().connectFrontend(*this); 361 354 } … … 366 359 } 367 360 361 void InspectorStubFrontend::frontendLoaded() 362 { 363 m_loaded = true; 364 365 for (auto& message : m_messages) 366 sendMessageToFrontend(message); 367 m_messages.clear(); 368 } 369 368 370 void InspectorStubFrontend::closeWindow() 369 371 { … … 371 373 return; 372 374 373 m_frontendController.setInspectorFrontendClient(nullptr);375 frontendPage()->inspectorController().setInspectorFrontendClient(nullptr); 374 376 inspectedPage()->inspectorController().disconnectFrontend(*this); 375 377 … … 381 383 { 382 384 ASSERT_ARG(message, !message.isEmpty()); 385 386 if (!m_loaded) { 387 m_messages.append(message); 388 return; 389 } 383 390 384 391 InspectorClient::doDispatchMessageOnFrontendPage(frontendPage(), message); -
trunk/Source/WebInspectorUI/ChangeLog
r248434 r248454 1 2019-08-08 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Page: don't allow the domain to be disabled 4 https://bugs.webkit.org/show_bug.cgi?id=200109 5 6 Reviewed by Brian Burg. 7 8 The `PageAgent` is relied on by many of the other agents, so much so that it doesn't make 9 sense to support the ability to "disable" (as well as "enable") the agent. 10 11 When the first frontend connects, we should treat the `PageAgent` as active and available. 12 13 * UserInterface/Controllers/NetworkManager.js: 14 (WI.NetworkManager.prototype.initializeTarget): 15 16 * Test/Test.js: 17 (WI.loaded): 18 (WI.initializeBackendTarget): 19 (WI.contentLoaded): 20 (WI.targetsAvailable): Added. 21 (WI.whenTargetsAvailable): Added. 22 * Test/TestStub.js: 23 Ensure that the backend always gets notified via `InspectorFrontendHost.loaded` so that 24 messages being sent to the frontend are batched. 25 1 26 2019-08-08 Devin Rousso <drousso@apple.com> 2 27 -
trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js
r246953 r248454 77 77 { 78 78 if (target.PageAgent) { 79 target.PageAgent.enable(); 79 // COMPATIBILITY (iOS 13): Page.enable was removed. 80 if (target.PageAgent.enable) 81 target.PageAgent.enable(); 82 80 83 target.PageAgent.getResourceTree(this._processMainFrameResourceTreePayload.bind(this)); 81 84 } -
trunk/Source/WebInspectorUI/UserInterface/Test/Test.js
r248286 r248454 78 78 WI.backendTarget = null; 79 79 WI.pageTarget = null; 80 WI._targetsAvailablePromise = new WI.WrappedPromise; 80 81 81 82 // FIXME: Eliminate `TargetAgent.exists`. … … 91 92 92 93 WI.resetMainExecutionContext(); 94 95 WI._targetsAvailablePromise.resolve(); 93 96 }; 94 97 … … 143 146 144 147 // Signal that the frontend is now ready to receive messages. 145 InspectorFrontendAPI.loadCompleted(); 148 WI.whenTargetsAvailable().then(() => { 149 InspectorFrontendAPI.loadCompleted(); 150 }); 146 151 147 152 // Tell the InspectorFrontendHost we loaded, which causes the window to display … … 168 173 }; 169 174 175 WI.targetsAvailable = function() 176 { 177 return WI._targetsAvailablePromise.settled; 178 }; 179 180 WI.whenTargetsAvailable = function() 181 { 182 return WI._targetsAvailablePromise.promise; 183 }; 184 170 185 Object.defineProperty(WI, "mainTarget", 171 186 { -
trunk/Source/WebInspectorUI/UserInterface/Test/TestStub.js
r188639 r248454 30 30 window.ProtocolTest = new ProtocolTestHarness(); 31 31 32 document.addEventListener("DOMContentLoaded", (event) => { 33 InspectorFrontendHost.loaded(); 34 }); 35 32 36 window.addEventListener("message", (event) => { 33 37 try {
Note: See TracChangeset
for help on using the changeset viewer.