Changeset 86959 in webkit
- Timestamp:
- May 20, 2011 9:15:08 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r86954 r86959 1 2011-05-19 Sergey Vorobyev <sergeyvorobyev@google.com> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: Background network events collection - add GUI to Inspector. 6 https://bugs.webkit.org/show_bug.cgi?id=58652 7 8 Move reopenFrontend() to inspector-test.js 9 Add first test for background events collection. 10 11 * http/tests/inspector/inspector-test.js: 12 (): 13 * http/tests/inspector/network-test.js: Added. 14 (initialize_NetworkTest.InspectorTest.enableBackgroundEventCollection): 15 (initialize_NetworkTest.InspectorTest.disableBackgroundEventCollection): 16 * http/tests/inspector/network/network-clear-after-disabled-expected.txt: Added. 17 * http/tests/inspector/network/network-clear-after-disabled.html: Added. 18 * http/tests/inspector/network/network-close-load-open-expected.txt: Added. 19 * http/tests/inspector/network/network-close-load-open.html: Added. 20 * http/tests/inspector/network/network-open-load-reopen-expected.txt: Added. 21 * http/tests/inspector/network/network-open-load-reopen.html: Added. 22 * inspector/debugger/open-close-open-expected.txt: 23 * inspector/debugger/open-close-open.html: 24 * platform/qt/Skipped: 25 1 26 2011-05-20 Csaba Osztrogonác <ossy@webkit.org> 2 27 -
trunk/LayoutTests/http/tests/inspector/inspector-test.js
r86672 r86959 325 325 var runTestCallId = 0; 326 326 var completeTestCallId = 1; 327 var frontendReopeningCount = 0; 328 329 function reopenFrontend() 330 { 331 closeFrontend(openFrontendAndIncrement); 332 } 333 334 function closeFrontend(callback) 335 { 336 // Do this asynchronously to allow InspectorBackendDispatcher to send response 337 // back to the frontend before it's destroyed. 338 setTimeout(function() { 339 layoutTestController.closeWebInspector(); 340 callback(); 341 }, 0); 342 } 343 344 function openFrontendAndIncrement() 345 { 346 frontendReopeningCount++; 347 layoutTestController.showWebInspector(); 348 runTest(); 349 } 327 350 328 351 function runAfterIframeIsLoaded() -
trunk/LayoutTests/inspector/debugger/open-close-open-expected.txt
r82435 r86959 11 11 <script> 12 12 13 function reopenFrontend() {14 // Do this asynchronously to allow InspectorBackendDispatcher to send response15 // back to the frontend before it's destroyed.16 setTimeout(function() {17 window._frontendReopened = true;18 layoutTestController.closeWebInspector();19 layoutTestController.showWebInspector();20 runTest();21 }, 0);22 }23 24 13 function test() 25 14 { 26 InspectorTest.evaluateInPage(" window._frontendReopened", function(result) {27 if (result._description === " undefined")15 InspectorTest.evaluateInPage("frontendReopeningCount", function(result) { 16 if (result._description === "0") 28 17 InspectorTest.evaluateInPage("reopenFrontend()") 29 18 else { -
trunk/LayoutTests/inspector/debugger/open-close-open.html
r82435 r86959 5 5 <script> 6 6 7 function reopenFrontend() {8 // Do this asynchronously to allow InspectorBackendDispatcher to send response9 // back to the frontend before it's destroyed.10 setTimeout(function() {11 window._frontendReopened = true;12 layoutTestController.closeWebInspector();13 layoutTestController.showWebInspector();14 runTest();15 }, 0);16 }17 18 7 function test() 19 8 { 20 InspectorTest.evaluateInPage(" window._frontendReopened", function(result) {21 if (result._description === " undefined")9 InspectorTest.evaluateInPage("frontendReopeningCount", function(result) { 10 if (result._description === "0") 22 11 InspectorTest.evaluateInPage("reopenFrontend()") 23 12 else { -
trunk/LayoutTests/platform/qt/Skipped
r86938 r86959 450 450 http/tests/inspector/change-iframe-src.html 451 451 inspector/debugger/open-close-open.html 452 453 # [Qt] This tests' fails probably has same reason as test inspector/debugger/open-close-open.html. 454 http/tests/inspector/network/network-open-load-reopen.html 455 http/tests/inspector/network/network-close-load-open.html 456 http/tests/inspector/network/network-clear-after-disabled.html 452 457 453 458 # [Qt] fast/frames/flattening/frameset-flattening-subframesets.html fails intermittently on Qt bot -
trunk/Source/WebCore/ChangeLog
r86958 r86959 1 2011-05-19 Sergey Vorobyev <sergeyvorobyev@google.com> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: Background network events collection - add GUI to Inspector. 6 https://bugs.webkit.org/show_bug.cgi?id=58652 7 8 Now in WebInspector Network panel avalaible new checkbox item in context menu: 9 "Background events collection". It allows to save all network events when inspector 10 frontend closed. Events that occur before collection enabling are not preserved after 11 frontend reopening. Property unique for each page. Disabled by default. 12 13 14 Tests: http/tests/inspector/network/network-clear-after-disabled.html 15 http/tests/inspector/network/network-close-load-open.html 16 http/tests/inspector/network/network-open-load-reopen.html 17 18 * inspector/EventsCollector.cpp: 19 (WebCore::EventsCollector::clear): 20 * inspector/EventsCollector.h: 21 * inspector/Inspector.json: 22 * inspector/InspectorFrontendProxy.cpp: 23 (WebCore::InspectorFrontendProxy::inspectorFrontendChannel): 24 * inspector/InspectorFrontendProxy.h: 25 * inspector/InspectorResourceAgent.cpp: 26 (WebCore::InspectorResourceAgent::setFrontend): 27 (WebCore::InspectorResourceAgent::clearFrontend): 28 (WebCore::InspectorResourceAgent::isBackgroundEventsCollectionEnabled): 29 (WebCore::InspectorResourceAgent::setBackgroundEventsCollectionEnabled): 30 (WebCore::InspectorResourceAgent::initializeBackgroundCollection): 31 (WebCore::InspectorResourceAgent::InspectorResourceAgent): 32 * inspector/InspectorResourceAgent.h: 33 * inspector/front-end/NetworkPanel.js: 34 (WebInspector.NetworkPanel): 35 (WebInspector.NetworkPanel.prototype._contextMenu): 36 (WebInspector.NetworkPanel.prototype._toggleBackgroundEventsCollection): 37 1 38 2011-05-20 Pavel Podivilov <podivilov@chromium.org> 2 39 -
trunk/Source/WebCore/inspector/EventsCollector.cpp
r83975 r86959 49 49 } 50 50 51 void EventsCollector::clear() 52 { 53 m_events.clear(); 54 } 55 51 56 void EventsCollector::sendCollectedEvents(InspectorFrontendChannel* receiver) 52 57 { -
trunk/Source/WebCore/inspector/EventsCollector.h
r83975 r86959 41 41 ~EventsCollector() { } 42 42 void addEvent(const String& message); 43 void clear(); 43 44 void sendCollectedEvents(InspectorFrontendChannel*); 44 45 private: -
trunk/Source/WebCore/inspector/Inspector.json
r86836 r86959 472 472 "parameters": [ 473 473 { "name": "headers", "type": "object", "description": "Map with extra HTTP headers." } 474 ] 475 }, 476 { 477 "name": "setBackgroundEventsCollectionEnabled", 478 "description": "Toggles background network event collection.", 479 "parameters": [ 480 { "name": "enabled", "type": "boolean", "description": "true - enable collection, false - disable" } 481 ] 482 }, 483 { 484 "name": "isBackgroundEventsCollectionEnabled", 485 "returns": [ 486 { "name": "enabled", "type": "boolean" } 474 487 ] 475 488 } -
trunk/Source/WebCore/inspector/InspectorFrontendProxy.cpp
r83975 r86959 56 56 } 57 57 58 InspectorFrontendChannel* InspectorFrontendProxy::inspectorFrontendChannel() 59 { 60 return m_receiver; 61 } 62 58 63 void InspectorFrontendProxy::setEventsCollector(EventsCollector* collector) 59 64 { -
trunk/Source/WebCore/inspector/InspectorFrontendProxy.h
r83975 r86959 43 43 44 44 void setInspectorFrontendChannel(InspectorFrontendChannel*); 45 InspectorFrontendChannel* inspectorFrontendChannel(); 45 46 void setEventsCollector(EventsCollector*); 46 47 virtual bool sendMessageToFrontend(const String& message); -
trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp
r86752 r86959 69 69 static const char resourceAgentEnabled[] = "resourceAgentEnabled"; 70 70 static const char extraRequestHeaders[] = "extraRequestHeaders"; 71 static const char backgroundEventsCollectionEnabled[] = "backgroundEventsCollectionEnabled"; 71 72 } 72 73 … … 74 75 { 75 76 m_frontend = frontend->network(); 76 if ( backgroundEventsCollectionEnabled()) {77 if (isBackgroundEventsCollectionEnabled()) { 77 78 // Insert Message Proxy in receiver chain. 78 79 InspectorFrontendChannel* client = m_frontend->getInspectorFrontendChannel(); … … 85 86 void InspectorResourceAgent::clearFrontend() 86 87 { 87 if (backgroundEventsCollectionEnabled()) { 88 if (isBackgroundEventsCollectionEnabled()) { 89 m_frontend = m_mockFrontend.get(); 88 90 m_inspectorFrontendProxy->setInspectorFrontendChannel(0); 89 m_frontend = m_mockFrontend.get();90 } else 91 m_frontend->setInspectorFrontendChannel(m_inspectorFrontendProxy.get()); 92 } else { 91 93 m_frontend = 0; 92 94 ErrorString error; 95 disable(&error); 96 } 93 97 m_userAgentOverride = ""; 94 disable(0);95 98 } 96 99 … … 332 335 #endif // ENABLE(WEB_SOCKETS) 333 336 334 bool InspectorResourceAgent::backgroundEventsCollectionEnabled() 335 { 336 // FIXME (https://bugs.webkit.org/show_bug.cgi?id=58652) 337 // Add here condition to enable background events collection. 338 // Now this function is disable. 339 return false; 337 void InspectorResourceAgent::isBackgroundEventsCollectionEnabled(ErrorString*, bool* enabled) 338 { 339 (*enabled) = isBackgroundEventsCollectionEnabled(); 340 } 341 342 bool InspectorResourceAgent::isBackgroundEventsCollectionEnabled() 343 { 344 return m_state->getBoolean(ResourceAgentState::backgroundEventsCollectionEnabled); 345 } 346 347 void InspectorResourceAgent::setBackgroundEventsCollectionEnabled(ErrorString*, bool enabled) 348 { 349 if (enabled == isBackgroundEventsCollectionEnabled()) 350 return; 351 if (enabled) { 352 if (!m_eventsCollector) 353 initializeBackgroundCollection(); 354 // Insert Message Proxy in receiver chain. 355 ASSERT(m_frontend); 356 InspectorFrontendChannel* client = m_frontend->getInspectorFrontendChannel(); 357 m_inspectorFrontendProxy->setInspectorFrontendChannel(client); 358 m_frontend->setInspectorFrontendChannel(m_inspectorFrontendProxy.get()); 359 } else { 360 // Take out Message Proxy from receiver chain. 361 m_frontend->setInspectorFrontendChannel(m_inspectorFrontendProxy->inspectorFrontendChannel()); 362 m_inspectorFrontendProxy->setInspectorFrontendChannel(0); 363 m_eventsCollector->clear(); 364 } 365 return m_state->setBoolean(ResourceAgentState::backgroundEventsCollectionEnabled, enabled); 340 366 } 341 367 … … 369 395 } 370 396 397 void InspectorResourceAgent::initializeBackgroundCollection() 398 { 399 m_eventsCollector = adoptPtr(new EventsCollector()); 400 m_inspectorFrontendProxy = adoptPtr(new InspectorFrontendProxy(m_eventsCollector.get())); 401 // Create mock frontend, so we can collect network events. 402 m_mockFrontend = adoptPtr(new InspectorFrontend::Network(m_inspectorFrontendProxy.get())); 403 } 404 371 405 InspectorResourceAgent::InspectorResourceAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorState* state) 372 406 : m_instrumentingAgents(instrumentingAgents) … … 374 408 , m_state(state) 375 409 { 376 if (backgroundEventsCollectionEnabled()) { 377 m_eventsCollector = adoptPtr(new EventsCollector); 378 m_inspectorFrontendProxy = adoptPtr(new InspectorFrontendProxy(m_eventsCollector.get())); 410 if (isBackgroundEventsCollectionEnabled()) { 411 initializeBackgroundCollection(); 379 412 // Create mock frontend, so we can collect network events. 380 m_mockFrontend = adoptPtr(new InspectorFrontend::Network(m_inspectorFrontendProxy.get()));381 413 m_frontend = m_mockFrontend.get(); 382 414 enable(); -
trunk/Source/WebCore/inspector/InspectorResourceAgent.h
r84774 r86959 106 106 #endif 107 107 108 bool backgroundEventsCollectionEnabled(); 108 void isBackgroundEventsCollectionEnabled(ErrorString*, bool* enabled); 109 void setBackgroundEventsCollectionEnabled(ErrorString*, bool enabled); 109 110 110 // Called from frontend 111 // Called from frontend 111 112 void enable(ErrorString*); 112 113 void disable(ErrorString*); … … 118 119 InspectorResourceAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorState*); 119 120 121 bool isBackgroundEventsCollectionEnabled(); 120 122 void enable(); 123 void initializeBackgroundCollection(); 121 124 122 125 InstrumentingAgents* m_instrumentingAgents; 123 126 InspectorPageAgent* m_pageAgent; 124 127 InspectorState* m_state; 128 InspectorFrontend::Network* m_frontend; 125 129 OwnPtr<EventsCollector> m_eventsCollector; 126 InspectorFrontend::Network* m_frontend;130 OwnPtr<InspectorFrontendProxy> m_inspectorFrontendProxy; 127 131 OwnPtr<InspectorFrontend::Network> m_mockFrontend; 128 OwnPtr<InspectorFrontendProxy> m_inspectorFrontendProxy;129 132 String m_userAgentOverride; 130 133 }; -
trunk/Source/WebCore/inspector/front-end/NetworkPanel.js
r86855 r86959 31 31 WebInspector.NetworkPanel = function() 32 32 { 33 function eventsCollectionEnabled(error, enabled) 34 { 35 this._backgroundCollectionEnabled = enabled; 36 } 37 NetworkAgent.isBackgroundEventsCollectionEnabled(eventsCollectionEnabled.bind(this)); 38 33 39 WebInspector.Panel.call(this, "network"); 34 40 … … 1021 1027 } 1022 1028 1029 contextMenu.appendSeparator(); 1030 contextMenu.appendCheckboxItem(WebInspector.UIString("Enabled background events collection"), this._toggleBackgroundEventsCollection.bind(this), this._backgroundCollectionEnabled); 1031 1023 1032 contextMenu.show(event); 1024 1033 }, … … 1065 1074 var har = (new WebInspector.HAREntry(resource)).build(); 1066 1075 InspectorFrontendHost.saveAs(resource.displayName + ".har", JSON.stringify(har)); 1076 }, 1077 1078 _toggleBackgroundEventsCollection: function(resource) 1079 { 1080 this._backgroundCollectionEnabled = !this._backgroundCollectionEnabled; 1081 NetworkAgent.setBackgroundEventsCollectionEnabled(this._backgroundCollectionEnabled); 1067 1082 }, 1068 1083
Note: See TracChangeset
for help on using the changeset viewer.