Changeset 91839 in webkit
- Timestamp:
- Jul 27, 2011 6:37:03 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r91837 r91839 1 2011-07-27 Yury Semikhatsky <yurys@chromium.org> 2 3 Inspector should support cd(window) in the command line 4 https://bugs.webkit.org/show_bug.cgi?id=19872 5 6 Added a test for console evaluation in an iframe. 7 8 Reviewed by Pavel Feldman. 9 10 * http/tests/inspector/console-cd-expected.txt: Added. 11 * http/tests/inspector/console-cd.html: Added. 12 * http/tests/inspector/resources/console-cd-iframe.html: Added. 13 1 14 2011-07-27 Shinya Kawanaka <shinyak@google.com> 2 15 -
trunk/LayoutTests/http/tests/inspector/console-test.js
r82713 r91839 1 1 var initialize_ConsoleTest = function() { 2 3 InspectorTest.showConsolePanel = function() 4 { 5 WebInspector.showPanel("console"); 6 WebInspector.drawer.immediatelyFinishAnimation(); 7 } 2 8 3 9 InspectorTest.dumpConsoleMessages = function() -
trunk/Source/WebCore/ChangeLog
r91837 r91839 1 2011-07-27 Yury Semikhatsky <yurys@chromium.org> 2 3 Inspector should support cd(window) in the command line 4 https://bugs.webkit.org/show_bug.cgi?id=19872 5 6 Added dropdown list with all iframes to allow selecting current evaluation context for console expressions. 7 8 Reviewed by Pavel Feldman. 9 10 Test: http/tests/inspector/console-cd.html 11 12 * WebCore.gypi: 13 * inspector/Inspector.json: 14 * inspector/InspectorController.cpp: 15 (WebCore::InspectorController::InspectorController): 16 * inspector/InspectorRuntimeAgent.cpp: 17 (WebCore::InspectorRuntimeAgent::InspectorRuntimeAgent): 18 (WebCore::InspectorRuntimeAgent::evaluate): 19 * inspector/InspectorRuntimeAgent.h: 20 * inspector/WorkerInspectorController.cpp: 21 * inspector/front-end/ConsoleView.js: 22 (WebInspector.ConsoleView.prototype.addContext): 23 (WebInspector.ConsoleView.prototype.removeContext): 24 (WebInspector.ConsoleView.prototype._contextUpdated): 25 (WebInspector.ConsoleView.prototype.get _currentEvaluationContextId): 26 (WebInspector.ConsoleView.prototype.evalInInspectedWindow): 27 * inspector/front-end/ContextManager.js: Added. 28 (WebInspector.ContextManager): 29 (WebInspector.ContextManager.prototype._frameAdded): 30 (WebInspector.ContextManager.prototype._frameNavigated): 31 (WebInspector.ContextManager.prototype._frameDetached): 32 (WebInspector.FrameEvaluationContext): 33 (WebInspector.FrameEvaluationContext.prototype._frameNavigated): 34 (WebInspector.FrameEvaluationContext.prototype.get id): 35 (WebInspector.FrameEvaluationContext.prototype.get url): 36 (WebInspector.FrameEvaluationContext.prototype.get displayName): 37 * inspector/front-end/ResourceTreeModel.js: 38 (WebInspector.ResourceTreeModel.prototype._cleanupFramesAfterNavigation): 39 (WebInspector.ResourceTreeModel.prototype._addFramesRecursively): 40 * inspector/front-end/WebKit.qrc: 41 * inspector/front-end/inspector.html: 42 * inspector/front-end/inspector.js: 43 1 44 2011-07-27 Shinya Kawanaka <shinyak@google.com> 2 45 -
trunk/Source/WebCore/WebCore.gypi
r91811 r91839 6322 6322 'inspector/front-end/ConsolePanel.js', 6323 6323 'inspector/front-end/ConsoleView.js', 6324 'inspector/front-end/JavaScriptContextManager.js', 6324 6325 'inspector/front-end/ContextMenu.js', 6325 6326 'inspector/front-end/CookieItemsView.js', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r91811 r91839 68630 68630 </File> 68631 68631 <File 68632 RelativePath="..\inspector\front-end\JavaScriptContextManager.js" 68633 > 68634 </File> 68635 <File 68632 68636 RelativePath="..\inspector\front-end\JavaScriptFormatter.js" 68633 68637 > -
trunk/Source/WebCore/inspector/Inspector.json
r91754 r91839 263 263 { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }, 264 264 { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Determines whether Command Line API should be available during the evaluation." }, 265 { "name": "doNotPauseOnExceptions", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions. Overrides setPauseOnException state." } 265 { "name": "doNotPauseOnExceptions", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions. Overrides setPauseOnException state." }, 266 { "name": "frameId", "type": "string", "optional": true, "description": "Specifies in which frame to perform evaluation." } 266 267 ], 267 268 "returns": [ -
trunk/Source/WebCore/inspector/InspectorController.cpp
r91565 r91839 73 73 class PageRuntimeAgent : public InspectorRuntimeAgent { 74 74 public: 75 PageRuntimeAgent(InjectedScriptManager* injectedScriptManager, Page* page )75 PageRuntimeAgent(InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent) 76 76 : InspectorRuntimeAgent(injectedScriptManager) 77 , m_inspectedPage(page) { } 77 , m_inspectedPage(page) 78 , m_pageAgent(pageAgent) { } 78 79 virtual ~PageRuntimeAgent() { } 79 80 80 81 private: 82 virtual ScriptState* scriptStateForFrameId(ErrorString* errorString, const String& frameId) 83 { 84 Frame* frame = m_pageAgent->frameForId(frameId); 85 if (!frame) { 86 *errorString = "Frame not found"; 87 return 0; 88 } 89 return mainWorldScriptState(frame); 90 } 81 91 virtual ScriptState* getDefaultInspectedState() { return mainWorldScriptState(m_inspectedPage->mainFrame()); } 82 92 Page* m_inspectedPage; 93 InspectorPageAgent* m_pageAgent; 83 94 }; 84 95 … … 104 115 #endif 105 116 , m_resourceAgent(InspectorResourceAgent::create(m_instrumentingAgents.get(), m_pageAgent.get(), inspectorClient, m_state.get())) 106 , m_runtimeAgent(adoptPtr(new PageRuntimeAgent(m_injectedScriptManager.get(), page )))117 , m_runtimeAgent(adoptPtr(new PageRuntimeAgent(m_injectedScriptManager.get(), page, m_pageAgent.get()))) 107 118 , m_consoleAgent(adoptPtr(new InspectorConsoleAgent(m_instrumentingAgents.get(), m_inspectorAgent.get(), m_state.get(), m_injectedScriptManager.get(), m_domAgent.get()))) 108 119 #if ENABLE(JAVASCRIPT_DEBUGGER) -
trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp
r91750 r91839 58 58 } 59 59 60 void InspectorRuntimeAgent::evaluate(ErrorString* errorString, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptions, RefPtr<InspectorObject>* result, bool* wasThrown)60 void InspectorRuntimeAgent::evaluate(ErrorString* errorString, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptions, const String* const frameId, RefPtr<InspectorObject>* result, bool* wasThrown) 61 61 { 62 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(getDefaultInspectedState()); 62 ScriptState* scriptState = 0; 63 if (frameId) 64 scriptState = scriptStateForFrameId(errorString, *frameId); 65 else 66 scriptState = getDefaultInspectedState(); 67 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); 63 68 if (injectedScript.hasNoValue()) { 64 69 *errorString = "Inspected frame has gone"; -
trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h
r91750 r91839 54 54 55 55 // Part of the protocol. 56 void evaluate(ErrorString*, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptions, RefPtr<InspectorObject>* result, bool* wasThrown);56 void evaluate(ErrorString*, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptions, const String* const frameId, RefPtr<InspectorObject>* result, bool* wasThrown); 57 57 void callFunctionOn(ErrorString*, const String& objectId, const String& expression, const RefPtr<InspectorArray>* const optionalArguments, RefPtr<InspectorObject>* result, bool* wasThrown); 58 58 void releaseObject(ErrorString*, const String& objectId); … … 66 66 protected: 67 67 explicit InspectorRuntimeAgent(InjectedScriptManager*); 68 virtual ScriptState* scriptStateForFrameId(ErrorString*, const String& frameId) = 0; 68 69 virtual ScriptState* getDefaultInspectedState() = 0; 69 70 -
trunk/Source/WebCore/inspector/WorkerInspectorController.cpp
r91176 r91839 62 62 63 63 private: 64 virtual ScriptState* scriptStateForFrameId(ErrorString*, const String&) 65 { 66 return 0; 67 } 68 64 69 virtual ScriptState* getDefaultInspectedState() 65 70 { -
trunk/Source/WebCore/inspector/front-end/ConsoleView.js
r91749 r91839 41 41 this.clearButton.addEventListener("click", this._clearButtonClicked.bind(this), false); 42 42 43 this._contextSelectElement = document.getElementById("console-context"); 44 if (WebInspector.WorkerManager.isWorkerFrontend()) 45 this._contextSelectElement.addStyleClass("hidden"); 46 43 47 this.messagesElement = document.getElementById("console-messages"); 44 48 this.messagesElement.addEventListener("selectstart", this._messagesSelectStart.bind(this), false); … … 165 169 }, 166 170 171 addContext: function(context) 172 { 173 var option = document.createElement("option"); 174 option.text = context.displayName; 175 option.title = context.url; 176 option._context = context; 177 context._consoleOption = option; 178 this._contextSelectElement.appendChild(option); 179 context.addEventListener(WebInspector.FrameEvaluationContext.EventTypes.Updated, this._contextUpdated, this); 180 }, 181 182 removeContext: function(context) 183 { 184 this._contextSelectElement.removeChild(context._consoleOption); 185 }, 186 187 _contextUpdated: function(event) 188 { 189 var context = event.data; 190 var option= context._consoleOption; 191 option.text = context.displayName; 192 option.title = context.url; 193 }, 194 195 _currentEvaluationContextId: function() 196 { 197 if (this._contextSelectElement.selectedIndex === -1) 198 return undefined; 199 return this._contextSelectElement[this._contextSelectElement.selectedIndex]._context.frameId; 200 }, 201 167 202 _updateFilter: function(e) 168 203 { … … 578 613 callback(WebInspector.RemoteObject.fromPayload(result), wasThrown); 579 614 } 580 RuntimeAgent.evaluate(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptions, evalCallback);615 RuntimeAgent.evaluate(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptions, this._currentEvaluationContextId(), evalCallback); 581 616 }, 582 617 -
trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js
r90364 r91839 153 153 _cleanupFramesAfterNavigation: function(newMainFrame) 154 154 { 155 for (var frameId in this._frameIds) { 156 if (frameId !== newMainFrame.id) 157 this._frameDetached(frameId); 158 } 155 if (this._currentMainFrameId) 156 this._frameDetached(this._currentMainFrameId); 157 this._currentMainFrameId = newMainFrame.id; 159 158 }, 160 159 … … 324 323 frameResource.finished = true; 325 324 326 if (!framePayload.parentId) 325 if (!framePayload.parentId) { 327 326 WebInspector.mainResource = frameResource; 327 this._currentMainFrameId = framePayload.id; 328 } 328 329 this._addFrame(framePayload); 329 330 this._addResourceToFrame(frameResource); -
trunk/Source/WebCore/inspector/front-end/WebKit.qrc
r91359 r91839 17 17 <file>ConsolePanel.js</file> 18 18 <file>ConsoleView.js</file> 19 <file>JavaScriptContextManager.js</file> 19 20 <file>ContextMenu.js</file> 20 21 <file>CookieItemsView.js</file> -
trunk/Source/WebCore/inspector/front-end/inspector.html
r91359 r91839 171 171 <script type="text/javascript" src="WorkerManager.js"></script> 172 172 <script type="text/javascript" src="UserMetrics.js"></script> 173 <script type="text/javascript" src="JavaScriptContextManager.js"></script> 173 174 </head> 174 175 <body class="detached"> … … 188 189 <div id="drawer"> 189 190 <div id="console-view"><div id="console-messages" class="monospace"><div id="console-prompt" spellcheck="false"><br></div></div></div> 190 <div id="drawer-status-bar" class="status-bar"><div id="other-drawer-status-bar-items"><button id="clear-console-status-bar-item" class="status-bar-item clear-status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button>< div id="console-filter" class="scope-bar status-bar-item"></div></div></div>191 <div id="drawer-status-bar" class="status-bar"><div id="other-drawer-status-bar-items"><button id="clear-console-status-bar-item" class="status-bar-item clear-status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><select id="console-context" class="status-bar-item"></select><div id="console-filter" class="scope-bar status-bar-item"></div></div></div> 191 192 </div> 192 193 </body> -
trunk/Source/WebCore/inspector/front-end/inspector.js
r91749 r91839 503 503 this.networkLog = new WebInspector.NetworkLog(); 504 504 this.domAgent = new WebInspector.DOMAgent(); 505 new WebInspector.JavaScriptContextManager(this.resourceTreeModel, this.console); 505 506 506 507 InspectorBackend.registerDomainDispatcher("Inspector", this);
Note: See TracChangeset
for help on using the changeset viewer.