Changeset 248943 in webkit
- Timestamp:
- Aug 21, 2019 9:50:14 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r248942 r248943 1 2019-08-21 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Page: re-add enable/disable after r248454 4 https://bugs.webkit.org/show_bug.cgi?id=200947 5 6 Reviewed by Joseph Pecoraro. 7 8 * http/tests/inspector/page/loading-iframe-document-node.html: 9 * inspector/css/getMatchedStylesForNode.html: 10 * inspector/css/getMatchedStylesForNode-expected.txt: 11 * inspector/page/archive.html: 12 * inspector/page/frameScheduledNavigation.html: 13 * inspector/page/frameScheduledNavigation-async-delegates.html: 14 * inspector/page/frameStartedLoading.html: 15 * inspector/page/media-query-list-listener-exception.html: 16 * inspector/timeline/line-column.html: 17 1 18 2019-08-21 Rob Buis <rbuis@igalia.com> 2 19 -
trunk/LayoutTests/http/tests/inspector/page/loading-iframe-document-node.html
r248454 r248943 36 36 function step1_bootstrap() { 37 37 ProtocolTest.log("step1_bootstrap"); 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()" }); 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 }); 46 49 }); 47 50 }); -
trunk/LayoutTests/inspector/css/getMatchedStylesForNode-expected.txt
r248602 r248943 1 1 Testing CSS.getMatchedStylesForNode. 2 2 3 Enabling Page domain... 3 4 Requesting document... 4 5 Querying for "div#x"... -
trunk/LayoutTests/inspector/css/getMatchedStylesForNode.html
r248602 r248943 36 36 { 37 37 Promise.resolve() 38 .then(() => { 39 ProtocolTest.log("Enabling Page domain..."); 40 return InspectorProtocol.awaitCommand({ 41 method: "Page.enable", 42 params: {}, 43 }); 44 }) 38 45 .then(() => { 39 46 ProtocolTest.log("Requesting document..."); -
trunk/LayoutTests/inspector/page/archive.html
r248454 r248943 5 5 function test() 6 6 { 7 InspectorProtocol.sendCommand("Page.enable", {}); 7 8 InspectorProtocol.sendCommand("Page.archive", {}, function(event) { 8 9 var data = event.result.data; -
trunk/LayoutTests/inspector/page/frameScheduledNavigation-async-delegates.html
r248454 r248943 17 17 InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStarted; 18 18 InspectorProtocol.eventHandler["Page.frameClearedScheduledNavigation"] = onCleared; 19 InspectorProtocol.sendCommand("Page.enable", {}); 19 20 20 21 function onScheduled(msg) -
trunk/LayoutTests/inspector/page/frameScheduledNavigation.html
r248454 r248943 14 14 InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStarted; 15 15 InspectorProtocol.eventHandler["Page.frameClearedScheduledNavigation"] = onCleared; 16 InspectorProtocol.sendCommand("Page.enable", {}); 16 17 17 18 function onScheduled(msg) -
trunk/LayoutTests/inspector/page/frameStartedLoading.html
r248454 r248943 15 15 InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStart; 16 16 InspectorProtocol.eventHandler["Page.frameStoppedLoading"] = onStop; 17 InspectorProtocol.sendCommand("Page.enable", {}); 17 18 18 19 function onStart() -
trunk/LayoutTests/inspector/page/media-query-list-listener-exception.html
r248454 r248943 11 11 function test() 12 12 { 13 InspectorProtocol.sendCommand("Page.enable", {}); 13 14 InspectorProtocol.sendCommand("Page.setEmulatedMedia", {"media": "print"}, function(messageObject) { 14 15 if (messageObject.error) -
trunk/LayoutTests/inspector/timeline/line-column.html
r248454 r248943 38 38 let suite = ProtocolTest.createAsyncSuite("Timeline.LineColumn"); 39 39 40 InspectorProtocol.sendCommand("Page.enable", {}); 40 41 InspectorProtocol.sendCommand("Timeline.enable"); 41 42 -
trunk/Source/JavaScriptCore/ChangeLog
r248938 r248943 1 2019-08-21 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Page: re-add enable/disable after r248454 4 https://bugs.webkit.org/show_bug.cgi?id=200947 5 6 Reviewed by Joseph Pecoraro. 7 8 We shouldn't design the agent system with only Web Inspector in mind. Other clients may want 9 to have different functionality, not being told about frames creation/updates/destruction. 10 In these cases, we should have graceful error message failures for other agents that rely on 11 the Page agent. 12 13 * inspector/protocol/Page.json: 14 1 15 2019-08-20 Justin Michaud <justin_michaud@apple.com> 2 16 -
trunk/Source/JavaScriptCore/inspector/protocol/Page.json
r248454 r248943 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 { 114 122 "name": "reload", 115 123 "description": "Reloads the main frame of the inspected page.", -
trunk/Source/WebCore/ChangeLog
r248932 r248943 1 2019-08-21 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Page: re-add enable/disable after r248454 4 https://bugs.webkit.org/show_bug.cgi?id=200947 5 6 Reviewed by Joseph Pecoraro. 7 8 We shouldn't design the agent system with only Web Inspector in mind. Other clients may want 9 to have different functionality, not being told about frames creation/updates/destruction. 10 In these cases, we should have graceful error message failures for other agents that rely on 11 the Page agent. 12 13 * inspector/agents/InspectorPageAgent.h: 14 * inspector/agents/InspectorPageAgent.cpp: 15 (WebCore::InspectorPageAgent::didCreateFrontendAndBackend): 16 (WebCore::InspectorPageAgent::willDestroyFrontendAndBackend): 17 (WebCore::InspectorPageAgent::enable): Added. 18 (WebCore::InspectorPageAgent::disable): Added. 19 20 * inspector/agents/InspectorApplicationCacheAgent.cpp: 21 (WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus): 22 (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests): 23 (WebCore::InspectorApplicationCacheAgent::assertFrameWithDocumentLoader): 24 * inspector/agents/InspectorCSSAgent.cpp: 25 (WebCore::InspectorCSSAgent::createStyleSheet): 26 * inspector/agents/InspectorDOMAgent.cpp: 27 (WebCore::InspectorDOMAgent::highlightSelector): 28 (WebCore::InspectorDOMAgent::highlightFrame): 29 (WebCore::InspectorDOMAgent::buildObjectForNode): 30 * inspector/agents/InspectorTimelineAgent.cpp: 31 (WebCore::InspectorTimelineAgent::setFrameIdentifier): 32 * inspector/agents/page/PageNetworkAgent.cpp: 33 (WebCore::PageNetworkAgent::loaderIdentifier): 34 (WebCore::PageNetworkAgent::frameIdentifier): 35 (WebCore::PageNetworkAgent::scriptExecutionContext): 36 * inspector/agents/page/PageRuntimeAgent.cpp: 37 (WebCore::PageRuntimeAgent::didCreateMainWorldContext): 38 (WebCore::PageRuntimeAgent::reportExecutionContextCreation): 39 1 40 2019-08-20 Ryosuke Niwa <rniwa@webkit.org> 2 41 -
trunk/Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.cpp
r248846 r248943 86 86 void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame) 87 87 { 88 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 89 if (!pageAgent) 90 return; 91 88 92 if (!frame) 89 93 return; … … 97 101 auto manifestURL = host.applicationCacheInfo().manifest.string(); 98 102 99 m_frontendDispatcher->applicationCacheStatusUpdated( m_instrumentingAgents.inspectorPageAgent()->frameId(frame), manifestURL, status);103 m_frontendDispatcher->applicationCacheStatusUpdated(pageAgent->frameId(frame), manifestURL, status); 100 104 } 101 105 … … 105 109 } 106 110 107 void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::ApplicationCache::FrameWithManifest>>& result) 108 { 111 void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString& errorString, RefPtr<JSON::ArrayOf<Inspector::Protocol::ApplicationCache::FrameWithManifest>>& result) 112 { 113 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 114 if (!pageAgent) { 115 errorString = "Page domain must be enabled"_s; 116 return; 117 } 118 109 119 result = JSON::ArrayOf<Inspector::Protocol::ApplicationCache::FrameWithManifest>::create(); 110 120 … … 118 128 if (!manifestURL.isEmpty()) { 119 129 result->addItem(Inspector::Protocol::ApplicationCache::FrameWithManifest::create() 120 .setFrameId( m_instrumentingAgents.inspectorPageAgent()->frameId(frame))130 .setFrameId(pageAgent->frameId(frame)) 121 131 .setManifestURL(manifestURL) 122 132 .setStatus(static_cast<int>(host.status())) … … 128 138 DocumentLoader* InspectorApplicationCacheAgent::assertFrameWithDocumentLoader(ErrorString& errorString, const String& frameId) 129 139 { 130 Frame* frame = m_instrumentingAgents.inspectorPageAgent()->assertFrame(errorString, frameId); 140 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 141 if (!pageAgent) { 142 errorString = "Page domain must be enabled"_s; 143 return nullptr; 144 } 145 146 auto* frame = pageAgent->assertFrame(errorString, frameId); 131 147 if (!frame) 132 148 return nullptr; -
trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
r248846 r248943 682 682 void InspectorCSSAgent::createStyleSheet(ErrorString& errorString, const String& frameId, String* styleSheetId) 683 683 { 684 Frame* frame = m_instrumentingAgents.inspectorPageAgent()->frameForId(frameId); 685 if (!frame) { 686 errorString = "No frame for given id found"_s; 687 return; 688 } 684 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 685 if (!pageAgent) { 686 errorString = "Page domain must be enabled"_s; 687 return; 688 } 689 690 auto* frame = pageAgent->assertFrame(errorString, frameId); 691 if (!frame) 692 return; 689 693 690 694 Document* document = frame->document(); -
trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
r248846 r248943 1225 1225 1226 1226 if (frameId) { 1227 Frame* frame = m_instrumentingAgents.inspectorPageAgent()->frameForId(*frameId);1228 if (! frame) {1229 errorString = " No frame for given id found"_s;1227 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 1228 if (!pageAgent) { 1229 errorString = "Page domain must be enabled"_s; 1230 1230 return; 1231 1231 } 1232 1233 auto* frame = pageAgent->assertFrame(errorString, *frameId); 1234 if (!frame) 1235 return; 1232 1236 1233 1237 document = frame->document(); … … 1312 1316 void InspectorDOMAgent::highlightFrame(ErrorString& errorString, const String& frameId, const JSON::Object* color, const JSON::Object* outlineColor) 1313 1317 { 1314 Frame* frame = m_instrumentingAgents.inspectorPageAgent()->assertFrame(errorString, frameId); 1318 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 1319 if (!pageAgent) { 1320 errorString = "Page domain must be enabled"_s; 1321 return; 1322 } 1323 1324 auto* frame = pageAgent->assertFrame(errorString, frameId); 1315 1325 if (!frame) 1316 1326 return; … … 1552 1562 } 1553 1563 1554 if (auto* frameView = node->document().view()) 1555 value->setFrameId(m_instrumentingAgents.inspectorPageAgent()->frameId(&frameView->frame())); 1564 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 1565 if (pageAgent) { 1566 if (auto* frameView = node->document().view()) 1567 value->setFrameId(pageAgent->frameId(&frameView->frame())); 1568 } 1556 1569 1557 1570 if (is<Element>(*node)) { … … 1589 1602 } else if (is<Document>(*node)) { 1590 1603 Document& document = downcast<Document>(*node); 1591 value->setFrameId(m_instrumentingAgents.inspectorPageAgent()->frameId(document.frame())); 1604 if (pageAgent) 1605 value->setFrameId(pageAgent->frameId(document.frame())); 1592 1606 value->setDocumentURL(documentURLString(&document)); 1593 1607 value->setBaseURL(documentBaseURLString(&document)); -
trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
r248846 r248943 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 void InspectorPageAgent::enable(ErrorString& errorString) 355 { 356 if (m_instrumentingAgents.inspectorPageAgent() == this) { 357 errorString = "Page domain already enabled"_s; 358 return; 359 } 360 346 361 m_instrumentingAgents.setInspectorPageAgent(this); 347 362 … … 355 370 } 356 371 357 void InspectorPageAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason) 358 { 372 void InspectorPageAgent::disable(ErrorString&) 373 { 374 m_instrumentingAgents.setInspectorPageAgent(nullptr); 375 359 376 ErrorString unused; 360 377 setShowPaintRects(unused, false); … … 372 389 373 390 m_client->setMockCaptureDevicesEnabledOverride(WTF::nullopt); 374 375 m_instrumentingAgents.setInspectorPageAgent(nullptr);376 391 } 377 392 -
trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h
r248454 r248943 89 89 90 90 // PageBackendDispatcherHandler 91 void enable(ErrorString&) final; 92 void disable(ErrorString&) final; 91 93 void reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources) final; 92 94 void navigate(ErrorString&, const String& url) final; -
trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp
r248846 r248943 742 742 return; 743 743 744 record->setString("frameId"_s, m_instrumentingAgents.inspectorPageAgent()->frameId(frame)); 744 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 745 if (!pageAgent) 746 return; 747 748 record->setString("frameId"_s, pageAgent->frameId(frame)); 745 749 } 746 750 -
trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp
r248454 r248943 49 49 String PageNetworkAgent::loaderIdentifier(DocumentLoader* loader) 50 50 { 51 if (loader) 52 return m_instrumentingAgents.inspectorPageAgent()->loaderId(loader); 51 if (loader) { 52 if (auto* pageAgent = m_instrumentingAgents.inspectorPageAgent()) 53 return pageAgent->loaderId(loader); 54 } 53 55 return { }; 54 56 } … … 56 58 String PageNetworkAgent::frameIdentifier(DocumentLoader* loader) 57 59 { 58 if (loader) 59 return m_instrumentingAgents.inspectorPageAgent()->frameId(loader->frame()); 60 if (loader) { 61 if (auto* pageAgent = m_instrumentingAgents.inspectorPageAgent()) 62 return pageAgent->frameId(loader->frame()); 63 } 60 64 return { }; 61 65 } … … 97 101 ScriptExecutionContext* PageNetworkAgent::scriptExecutionContext(ErrorString& errorString, const String& frameId) 98 102 { 99 auto* frame = m_instrumentingAgents.inspectorPageAgent()->assertFrame(errorString, frameId); 103 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 104 if (!pageAgent) { 105 errorString = "Page domain must be enabled"_s; 106 return nullptr; 107 } 108 109 auto* frame = pageAgent->assertFrame(errorString, frameId); 100 110 if (!frame) 101 111 return nullptr; -
trunk/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp
r248846 r248943 86 86 void PageRuntimeAgent::didCreateMainWorldContext(Frame& frame) 87 87 { 88 auto frameId = m_instrumentingAgents.inspectorPageAgent()->frameId(&frame); 88 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 89 if (!pageAgent) 90 return; 91 92 auto frameId = pageAgent->frameId(&frame); 89 93 auto* scriptState = mainWorldExecState(&frame); 90 94 notifyContextCreated(frameId, scriptState, nullptr, true); … … 119 123 void PageRuntimeAgent::reportExecutionContextCreation() 120 124 { 125 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 126 if (!pageAgent) 127 return; 128 121 129 Vector<std::pair<JSC::ExecState*, SecurityOrigin*>> isolatedContexts; 122 130 for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) { 123 131 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) 124 132 continue; 125 String frameId = m_instrumentingAgents.inspectorPageAgent()->frameId(frame); 133 134 String frameId = pageAgent->frameId(frame); 126 135 127 136 JSC::ExecState* scriptState = mainWorldExecState(frame); -
trunk/Source/WebInspectorUI/ChangeLog
r248940 r248943 1 2019-08-21 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Page: re-add enable/disable after r248454 4 https://bugs.webkit.org/show_bug.cgi?id=200947 5 6 Reviewed by Joseph Pecoraro. 7 8 We shouldn't design the agent system with only Web Inspector in mind. Other clients may want 9 to have different functionality, not being told about frames creation/updates/destruction. 10 In these cases, we should have graceful error message failures for other agents that rely on 11 the Page agent. 12 13 * UserInterface/Controllers/NetworkManager.js: 14 (WI.NetworkManager.prototype.initializeTarget): 15 1 16 2019-08-21 Devin Rousso <drousso@apple.com> 2 17 -
trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js
r248753 r248943 77 77 { 78 78 if (target.PageAgent) { 79 // COMPATIBILITY (iOS 13): Page.enable was removed. 80 if (target.PageAgent.enable) 81 target.PageAgent.enable(); 82 79 target.PageAgent.enable(); 83 80 target.PageAgent.getResourceTree(this._processMainFrameResourceTreePayload.bind(this)); 84 81 }
Note: See TracChangeset
for help on using the changeset viewer.