Changeset 55537 in webkit
- Timestamp:
- Mar 4, 2010 10:56:44 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r55536 r55537 1 1 2010-03-04 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: Remove two last synchronous calls from front-end to InspectorBackend. 6 7 https://bugs.webkit.org/show_bug.cgi?id=35720 8 9 * inspector/InspectorBackend.cpp: 10 (WebCore::InspectorBackend::enableSearchingForNode): 11 (WebCore::InspectorBackend::disableSearchingForNode): 12 (WebCore::InspectorBackend::setPauseOnExceptionsState): 13 * inspector/InspectorBackend.h: 14 * inspector/InspectorBackend.idl: 15 * inspector/InspectorController.cpp: 16 (WebCore::InspectorController::setWindowVisible): 17 (WebCore::InspectorContorller::setSearchingForNode): 18 (WebCore::InspectorController::populateScriptObjects): 19 * inspector/InspectorController.h: 20 * inspector/InspectorFrontend.cpp: 21 (WebCore::InspectorFrontend::searchingForNodeWasEnabled): 22 (WebCore::InspectorFrontend::searchingForNodeWasDisabled): 23 (WebCore::InspectorFrontend::updatePauseOnExceptionsState): 24 * inspector/InspectorFrontend.h: 25 * inspector/front-end/ElementsPanel.js: 26 (WebInspector.ElementsPanel): 27 (WebInspector.ElementsPanel.prototype.get statusBarItems): 28 (WebInspector.ElementsPanel.prototype.hide): 29 (WebInspector.ElementsPanel.prototype.reset): 30 (WebInspector.ElementsPanel.prototype.searchingForNodeWasEnabled): 31 (WebInspector.ElementsPanel.prototype.searchingForNodeWasDisabled): 32 (WebInspector.ElementsPanel.prototype._nodeSearchButtonClicked): 33 * inspector/front-end/InspectorBackendStub.js: 34 (.WebInspector.InspectorBackendStub.prototype.enableSearchingForNode): 35 (.WebInspector.InspectorBackendStub.prototype.disableSearchingForNode): 36 (.WebInspector.InspectorBackendStub.prototype.setPauseOnExceptionsState): 37 * inspector/front-end/ScriptsPanel.js: 38 (WebInspector.ScriptsPanel): 39 (WebInspector.ScriptsPanel.prototype.get statusBarItems): 40 (WebInspector.ScriptsPanel.prototype.updatePauseOnExceptionsState): 41 (WebInspector.ScriptsPanel.prototype._updateDebuggerButtons): 42 (WebInspector.ScriptsPanel.prototype._togglePauseOnExceptions): 43 * inspector/front-end/inspector.js: 44 (WebInspector.searchingForNodeWasEnabled): 45 (WebInspector.searchingForNodeWasDisabled): 46 (WebInspector.updatePauseOnExceptionsState): 47 48 2010-03-03 Pavel Feldman <pfeldman@chromium.org> 2 49 3 50 Reviewed by Timothy Hatcher. -
trunk/WebCore/inspector/InspectorBackend.cpp
r55535 r55537 92 92 } 93 93 94 void InspectorBackend::toggleNodeSearch() 95 { 96 if (m_inspectorController) 97 m_inspectorController->toggleSearchForNodeInPage(); 98 } 99 100 bool InspectorBackend::searchingForNode() 101 { 102 if (m_inspectorController) 103 return m_inspectorController->searchingForNodeInPage(); 104 return false; 94 void InspectorBackend::enableSearchingForNode() 95 { 96 if (m_inspectorController) 97 m_inspectorController->setSearchingForNode(true); 98 } 99 100 void InspectorBackend::disableSearchingForNode() 101 { 102 if (m_inspectorController) 103 m_inspectorController->setSearchingForNode(false); 105 104 } 106 105 … … 210 209 } 211 210 212 long InspectorBackend::pauseOnExceptionsState()213 {214 return ScriptDebugServer::shared().pauseOnExceptionsState();215 }216 217 211 void InspectorBackend::setPauseOnExceptionsState(long pauseState) 218 212 { 219 213 ScriptDebugServer::shared().setPauseOnExceptionsState(static_cast<ScriptDebugServer::PauseOnExceptionsState>(pauseState)); 214 if (InspectorFrontend* frontend = inspectorFrontend()) 215 frontend->updatePauseOnExceptionsState(ScriptDebugServer::shared().pauseOnExceptionsState()); 220 216 } 221 217 -
trunk/WebCore/inspector/InspectorBackend.h
r55535 r55537 62 62 void storeLastActivePanel(const String& panelName); 63 63 64 void toggleNodeSearch();65 bool searchingForNode();64 void enableSearchingForNode(); 65 void disableSearchingForNode(); 66 66 67 67 void enableResourceTracking(bool always); … … 85 85 void resumeDebugger(); 86 86 87 long pauseOnExceptionsState();88 87 void setPauseOnExceptionsState(long pauseState); 89 88 -
trunk/WebCore/inspector/InspectorBackend.idl
r55535 r55537 37 37 void saveFrontendSettings(in DOMString settings); 38 38 39 void toggleNodeSearch();40 boolean searchingForNode();39 void enableSearchingForNode(); 40 void disableSearchingForNode(); 41 41 42 42 void enableResourceTracking(in boolean always); … … 64 64 void stepOutOfFunctionInDebugger(); 65 65 66 long pauseOnExceptionsState();67 66 void setPauseOnExceptionsState(in long pauseOnExceptionsState); 68 67 -
trunk/WebCore/inspector/InspectorController.cpp
r55535 r55537 323 323 m_attachDebuggerWhenShown = true; 324 324 #endif 325 if (m_searchingForNode) 326 toggleSearchForNodeInPage(); 325 setSearchingForNode(false); 327 326 resetScriptObjects(); 328 327 stopTimelineProfiler(); … … 477 476 } 478 477 479 void InspectorController::toggleSearchForNodeInPage()480 {481 if (!enabled())482 return;483 484 m_searchingForNode = !m_searchingForNode;485 if (!m_searchingForNode)486 hideHighlight();487 }488 489 478 void InspectorController::mouseDidMoveOverElement(const HitTestResult& result, unsigned) 490 479 { … … 507 496 return; 508 497 509 // inspect() will implicitly call ElementsPanel's focusedNodeChanged() and the hover feedback will be stopped there.498 setSearchingForNode(false); 510 499 inspect(node); 511 500 } … … 528 517 ScriptGlobalObject::set(m_frontendScriptState, "InspectorBackend", m_inspectorBackend.get()); 529 518 ScriptGlobalObject::set(m_frontendScriptState, "InspectorFrontendHost", m_inspectorFrontendHost.get()); 519 } 520 521 void InspectorController::setSearchingForNode(bool enabled) 522 { 523 if (m_searchingForNode == enabled) 524 return; 525 m_searchingForNode = enabled; 526 if (!m_searchingForNode) 527 hideHighlight(); 528 if (m_frontend) { 529 if (enabled) 530 m_frontend->searchingForNodeWasEnabled(); 531 else 532 m_frontend->searchingForNodeWasDisabled(); 533 } 530 534 } 531 535 … … 671 675 if (m_resourceTrackingEnabled) 672 676 m_frontend->resourceTrackingWasEnabled(); 677 678 if (m_searchingForNode) 679 m_frontend->searchingForNodeWasEnabled(); 680 else 681 m_frontend->searchingForNodeWasDisabled(); 682 673 683 #if ENABLE(JAVASCRIPT_DEBUGGER) 674 684 if (m_profilerEnabled) … … 688 698 m_consoleMessages[i]->addToConsole(m_frontend.get()); 689 699 700 #if ENABLE(JAVASCRIPT_DEBUGGER) 701 if (m_debuggerEnabled) 702 m_frontend->updatePauseOnExceptionsState(ScriptDebugServer::shared().pauseOnExceptionsState()); 703 #endif 690 704 #if ENABLE(DATABASE) 691 705 DatabaseResourcesMap::iterator databasesEnd = m_databaseResources.end(); -
trunk/WebCore/inspector/InspectorController.h
r55522 r55537 149 149 void detachWindow(); 150 150 151 void toggleSearchForNodeInPage();152 151 bool searchingForNodeInPage() const { return m_searchingForNode; } 153 152 void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); … … 263 262 friend class InspectorFrontendHost; 264 263 friend class InjectedScriptHost; 264 265 265 // Following are used from InspectorBackend and internally. 266 267 void setSearchingForNode(bool enabled); 268 266 269 void scriptObjectReady(); 267 270 void moveWindowBy(float x, float y) const; -
trunk/WebCore/inspector/InspectorFrontend.cpp
r55522 r55537 228 228 } 229 229 230 231 void InspectorFrontend::searchingForNodeWasEnabled() 232 { 233 callSimpleFunction("searchingForNodeWasEnabled"); 234 } 235 236 void InspectorFrontend::searchingForNodeWasDisabled() 237 { 238 callSimpleFunction("searchingForNodeWasDisabled"); 239 } 240 241 void InspectorFrontend::updatePauseOnExceptionsState(long state) 242 { 243 ScriptFunctionCall function(m_webInspector, "dispatch"); 244 function.appendArgument("updatePauseOnExceptionsState"); 245 function.appendArgument(state); 246 function.call(); 247 } 248 230 249 void InspectorFrontend::timelineProfilerWasStarted() 231 250 { -
trunk/WebCore/inspector/InspectorFrontend.h
r55522 r55537 78 78 void resourceTrackingWasDisabled(); 79 79 80 void searchingForNodeWasEnabled(); 81 void searchingForNodeWasDisabled(); 82 83 void updatePauseOnExceptionsState(long state); 84 80 85 #if ENABLE(JAVASCRIPT_DEBUGGER) 81 86 void attachDebuggerWhenShown(); -
trunk/WebCore/inspector/front-end/ElementsPanel.js
r54819 r55537 59 59 this.panel.updateEventListeners(); 60 60 61 if (InspectorBackend.searchingForNode()) {62 InspectorBackend.toggleNodeSearch();63 this.panel.nodeSearchButton.toggled = false;64 }65 61 if (this._focusedDOMNode) 66 62 InjectedScriptAccess.get(this._focusedDOMNode.injectedScriptId).addInspectedNode(this._focusedDOMNode.id, function() {}); … … 103 99 this.sidebarResizeElement.addEventListener("mousedown", this.rightSidebarResizerDragStart.bind(this), false); 104 100 105 this.nodeSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item"); 106 this.nodeSearchButton.addEventListener("click", this._nodeSearchButtonClicked.bind(this), false); 107 108 this.searchingForNode = false; 101 this._nodeSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item"); 102 this._nodeSearchButton.addEventListener("click", this._nodeSearchButtonClicked.bind(this), false); 109 103 110 104 this.element.appendChild(this.contentElement); … … 127 121 get statusBarItems() 128 122 { 129 return [this. nodeSearchButton.element, this.crumbsElement];123 return [this._nodeSearchButton.element, this.crumbsElement]; 130 124 }, 131 125 … … 155 149 156 150 WebInspector.hoveredDOMNode = null; 157 158 if (InspectorBackend.searchingForNode()) { 159 InspectorBackend.toggleNodeSearch(); 160 this.nodeSearchButton.toggled = false; 161 } 151 InspectorBackend.disableSearchingForNode(); 162 152 }, 163 153 … … 186 176 WebInspector.hoveredDOMNode = null; 187 177 188 if (InspectorBackend.searchingForNode()) {189 InspectorBackend.toggleNodeSearch();190 this.nodeSearchButton.toggled = false;191 }192 193 178 this.recentlyModifiedNodes = []; 194 179 … … 270 255 271 256 InjectedScriptAccess.getDefault().performSearch(whitespaceTrimmedQuery, function() {}); 257 }, 258 259 searchingForNodeWasEnabled: function() 260 { 261 this._nodeSearchButton.toggled = true; 262 }, 263 264 searchingForNodeWasDisabled: function() 265 { 266 this._nodeSearchButton.toggled = false; 272 267 }, 273 268 … … 1109 1104 _nodeSearchButtonClicked: function(event) 1110 1105 { 1111 InspectorBackend.toggleNodeSearch(); 1112 1113 this.nodeSearchButton.toggled = InspectorBackend.searchingForNode(); 1106 if (!this._nodeSearchButton.toggled) 1107 InspectorBackend.enableSearchingForNode(); 1108 else 1109 InspectorBackend.disableSearchingForNode(); 1114 1110 } 1115 1111 } -
trunk/WebCore/inspector/front-end/InspectorBackendStub.js
r55535 r55537 134 134 }, 135 135 136 137 enableSearchingForNode: function() 138 { 139 WebInspector.searchingForNodeWasEnabled(); 140 }, 141 142 disableSearchingForNode: function() 143 { 144 WebInspector.searchingForNodeWasDisabled(); 145 }, 146 136 147 reloadPage: function() 137 148 { … … 170 181 }, 171 182 172 pauseOnExceptionsState: function()173 {174 return 0;175 },176 177 183 setPauseOnExceptionsState: function(value) 178 184 { 185 WebInspector.updatePauseOnExceptionsState(value); 179 186 }, 180 187 -
trunk/WebCore/inspector/front-end/ScriptsPanel.js
r55522 r55537 162 162 this.enableToggleButton.addEventListener("click", this._toggleDebugging.bind(this), false); 163 163 164 this.pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3); 165 this.pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false); 164 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3); 165 this._pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false); 166 this._pauseOnExceptionButton.state = WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions; 166 167 167 168 this._shortcuts = {}; … … 218 219 get statusBarItems() 219 220 { 220 return [this.enableToggleButton.element, this. pauseOnExceptionButton.element];221 return [this.enableToggleButton.element, this._pauseOnExceptionButton.element]; 221 222 }, 222 223 … … 795 796 }, 796 797 797 _updatePauseOnExceptionsButton: function() 798 { 799 if (InspectorBackend.pauseOnExceptionsState() == WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions) 800 this.pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions."); 801 else if (InspectorBackend.pauseOnExceptionsState() == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnAllExceptions) 802 this.pauseOnExceptionButton.title = WebInspector.UIString("Pause on all exceptions.\nClick to Pause on uncaught exceptions."); 803 else if (InspectorBackend.pauseOnExceptionsState() == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions) 804 this.pauseOnExceptionButton.title = WebInspector.UIString("Pause on uncaught exceptions.\nClick to Not pause on exceptions."); 805 806 this.pauseOnExceptionButton.state = InspectorBackend.pauseOnExceptionsState(); 807 798 updatePauseOnExceptionsState: function(pauseOnExceptionsState) 799 { 800 if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions) 801 this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions."); 802 else if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnAllExceptions) 803 this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on all exceptions.\nClick to Pause on uncaught exceptions."); 804 else if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions) 805 this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on uncaught exceptions.\nClick to Not pause on exceptions."); 806 807 this._pauseOnExceptionButton.state = pauseOnExceptionsState; 808 808 }, 809 809 … … 813 813 this.enableToggleButton.title = WebInspector.UIString("Debugging enabled. Click to disable."); 814 814 this.enableToggleButton.toggled = true; 815 this. pauseOnExceptionButton.visible = true;815 this._pauseOnExceptionButton.visible = true; 816 816 this.panelEnablerView.visible = false; 817 817 } else { 818 818 this.enableToggleButton.title = WebInspector.UIString("Debugging disabled. Click to enable."); 819 819 this.enableToggleButton.toggled = false; 820 this. pauseOnExceptionButton.visible = false;820 this._pauseOnExceptionButton.visible = false; 821 821 this.panelEnablerView.visible = true; 822 822 } 823 824 this._updatePauseOnExceptionsButton();825 823 826 824 if (this._paused) { … … 908 906 _togglePauseOnExceptions: function() 909 907 { 910 InspectorBackend.setPauseOnExceptionsState((InspectorBackend.pauseOnExceptionsState() + 1) % this.pauseOnExceptionButton.states); 911 this._updatePauseOnExceptionsButton(); 908 InspectorBackend.setPauseOnExceptionsState((this._pauseOnExceptionButton.state + 1) % this._pauseOnExceptionButton.states); 912 909 }, 913 910 -
trunk/WebCore/inspector/front-end/inspector.js
r55517 r55537 1310 1310 } 1311 1311 1312 1313 WebInspector.searchingForNodeWasEnabled = function() 1314 { 1315 this.panels.elements.searchingForNodeWasEnabled(); 1316 } 1317 1318 WebInspector.searchingForNodeWasDisabled = function() 1319 { 1320 this.panels.elements.searchingForNodeWasDisabled(); 1321 } 1322 1312 1323 WebInspector.attachDebuggerWhenShown = function() 1313 1324 { … … 1318 1329 { 1319 1330 this.panels.scripts.debuggerWasEnabled(); 1331 } 1332 1333 WebInspector.updatePauseOnExceptionsState = function(pauseOnExceptionsState) 1334 { 1335 this.panels.scripts.updatePauseOnExceptionsState(pauseOnExceptionsState); 1320 1336 } 1321 1337 -
trunk/WebKit/chromium/ChangeLog
r55535 r55537 1 2010-03-03 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: Remove two last synchronous calls from front-end to InspectorBackend. 6 7 https://bugs.webkit.org/show_bug.cgi?id=35720 8 9 * src/js/InspectorControllerImpl.js: 10 (devtools.InspectorBackendImpl): 11 (devtools.InspectorBackendImpl.prototype.setPauseOnExceptionsState): 12 1 13 2010-03-03 Pavel Feldman <pfeldman@chromium.org> 2 14 -
trunk/WebKit/chromium/src/js/DevTools.js
r55535 r55537 157 157 */ 158 158 function debugPrint(text) { 159 var console = WebInspector.console; 160 if (console) { 161 console.addMessage(new WebInspector.ConsoleMessage( 162 WebInspector.ConsoleMessage.MessageSource.JS, 163 WebInspector.ConsoleMessage.MessageType.Log, 164 WebInspector.ConsoleMessage.MessageLevel.Log, 165 1, "chrome://devtools/<internal>", undefined, -1, text)); 166 } else 167 alert(text); 159 WebInspector.log(text); 168 160 } 169 161 … … 369 361 (function() 370 362 { 371 var orig = WebInspector.ConsoleMessage.prototype.setMessageBody;372 WebInspector.ConsoleMessage.prototype.setMessageBody = function(args)373 {374 for (var i = 0; i < args.length; ++i) {375 if (typeof args[i] === "string")376 args[i] = WebInspector.ObjectProxy.wrapPrimitiveValue(args[i]);377 }378 orig.call(this, args);379 };380 })();381 382 383 (function()384 {385 363 var orig = InjectedScriptAccess.prototype.getCompletions; 386 364 InjectedScriptAccess.prototype.getCompletions = function(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions) … … 394 372 395 373 396 (function()397 {398 WebInspector.ElementsPanel.prototype._nodeSearchButtonClicked = function( event)399 {400 InspectorBackend.toggleNodeSearch();401 this.nodeSearchButton.toggled = !this.nodeSearchButton.toggled;402 };403 })();404 405 406 374 // We need to have a place for postponed tasks 407 375 // which should be executed when all the messages between agent and frontend -
trunk/WebKit/chromium/src/js/InspectorControllerImpl.js
r55522 r55537 45 45 this.installInspectorControllerDelegate_("didEvaluateForTestInFrontend"); 46 46 this.installInspectorControllerDelegate_("disableResourceTracking"); 47 this.installInspectorControllerDelegate_("disableSearchingForNode"); 47 48 this.installInspectorControllerDelegate_("disableTimeline"); 48 49 this.installInspectorControllerDelegate_("enableResourceTracking"); 50 this.installInspectorControllerDelegate_("enableSearchingForNode"); 49 51 this.installInspectorControllerDelegate_("enableTimeline"); 50 52 this.installInspectorControllerDelegate_("getChildNodes"); … … 75 77 76 78 /** 77 * {@inheritDoc}.78 */79 devtools.InspectorBackendImpl.prototype.toggleNodeSearch = function()80 {81 WebInspector.InspectorBackendStub.prototype.toggleNodeSearch.call(this);82 this.callInspectorController_.call(this, "toggleNodeSearch");83 if (!this.searchingForNode()) {84 // This is called from ElementsPanel treeOutline's focusNodeChanged().85 InspectorFrontendHost.activateWindow();86 }87 };88 89 90 /**91 79 * @override 92 80 */ … … 169 157 // TODO(yurys): support all three states. See http://crbug.com/32877 170 158 var enabled = (state !== WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions); 171 return devtools.tools.getDebuggerAgent().setPauseOnExceptions(enabled); 172 }; 173 174 /** 175 * @override 176 */ 177 devtools.InspectorBackendImpl.prototype.pauseOnExceptionsState = function() 178 { 179 return (this._setPauseOnExceptionsState || WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions); 180 }; 159 WebInspector.updatePauseOnExceptionsState(enabled ? WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions : WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions); 160 devtools.tools.getDebuggerAgent().setPauseOnExceptions(enabled); 161 }; 162 181 163 182 164 /**
Note: See TracChangeset
for help on using the changeset viewer.