Changeset 76013 in webkit
- Timestamp:
- Jan 18, 2011 3:04:57 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76012 r76013 1 2011-01-17 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: add source column field to debugger call frames. 6 https://bugs.webkit.org/show_bug.cgi?id=52443 7 8 * bindings/js/JavaScriptCallFrame.cpp: 9 (WebCore::JavaScriptCallFrame::JavaScriptCallFrame): 10 * bindings/js/JavaScriptCallFrame.h: 11 (WebCore::JavaScriptCallFrame::create): 12 (WebCore::JavaScriptCallFrame::line): 13 (WebCore::JavaScriptCallFrame::column): 14 (WebCore::JavaScriptCallFrame::update): 15 * bindings/js/ScriptDebugServer.cpp: 16 (WebCore::ScriptDebugServer::createCallFrameAndPauseIfNeeded): 17 (WebCore::ScriptDebugServer::updateCallFrameAndPauseIfNeeded): 18 (WebCore::ScriptDebugServer::callEvent): 19 (WebCore::ScriptDebugServer::atStatement): 20 (WebCore::ScriptDebugServer::returnEvent): 21 (WebCore::ScriptDebugServer::exception): 22 (WebCore::ScriptDebugServer::willExecuteProgram): 23 (WebCore::ScriptDebugServer::didExecuteProgram): 24 (WebCore::ScriptDebugServer::didReachBreakpoint): 25 * bindings/js/ScriptDebugServer.h: 26 * bindings/v8/DebuggerScript.js: 27 (): 28 * bindings/v8/JavaScriptCallFrame.cpp: 29 (WebCore::JavaScriptCallFrame::column): 30 * bindings/v8/JavaScriptCallFrame.h: 31 * inspector/InjectedScriptSource.js: 32 (): 33 * inspector/JavaScriptCallFrame.idl: 34 1 35 2011-01-18 Antti Koivisto <antti@apple.com> 2 36 -
trunk/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp
r57784 r76013 43 43 namespace WebCore { 44 44 45 JavaScriptCallFrame::JavaScriptCallFrame(const DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, int line)45 JavaScriptCallFrame::JavaScriptCallFrame(const DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, const TextPosition1& textPosition) 46 46 : m_debuggerCallFrame(debuggerCallFrame) 47 47 , m_caller(caller) 48 48 , m_sourceID(sourceID) 49 , m_ line(line)49 , m_textPosition(textPosition) 50 50 , m_isValid(true) 51 51 { -
trunk/Source/WebCore/bindings/js/JavaScriptCallFrame.h
r65021 r76013 34 34 #include <wtf/PassRefPtr.h> 35 35 #include <wtf/RefCounted.h> 36 #include <wtf/text/TextPosition.h> 36 37 37 38 namespace WebCore { … … 39 40 class JavaScriptCallFrame : public RefCounted<JavaScriptCallFrame> { 40 41 public: 41 static PassRefPtr<JavaScriptCallFrame> create(const JSC::DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, int line)42 static PassRefPtr<JavaScriptCallFrame> create(const JSC::DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, const TextPosition1& textPosition) 42 43 { 43 return adoptRef(new JavaScriptCallFrame(debuggerCallFrame, caller, sourceID, line));44 return adoptRef(new JavaScriptCallFrame(debuggerCallFrame, caller, sourceID, textPosition)); 44 45 } 45 46 … … 55 56 56 57 intptr_t sourceID() const { return m_sourceID; } 57 int line() const { return m_line; } 58 void update(const JSC::DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int line) 58 int line() const { return m_textPosition.m_line.oneBasedInt(); } 59 int column() const { return m_textPosition.m_column.oneBasedInt(); } 60 61 void update(const JSC::DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, const TextPosition1& textPosition) 59 62 { 60 63 m_debuggerCallFrame = debuggerCallFrame; 61 m_ line = line;64 m_textPosition = textPosition; 62 65 m_sourceID = sourceID; 63 66 m_isValid = true; … … 73 76 74 77 private: 75 JavaScriptCallFrame(const JSC::DebuggerCallFrame&, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, int line);78 JavaScriptCallFrame(const JSC::DebuggerCallFrame&, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, const TextPosition1&); 76 79 77 80 JSC::DebuggerCallFrame m_debuggerCallFrame; 78 81 RefPtr<JavaScriptCallFrame> m_caller; 79 82 intptr_t m_sourceID; 80 int m_line;83 TextPosition1 m_textPosition; 81 84 bool m_isValid; 82 85 }; -
trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp
r75794 r76013 441 441 } 442 442 443 void ScriptDebugServer::createCallFrameAndPauseIfNeeded(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) 444 { 445 TextPosition1 textPosition(WTF::OneBasedNumber::fromOneBasedInt(lineNumber), WTF::OneBasedNumber::base()); 446 m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, textPosition); 447 pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); 448 } 449 450 void ScriptDebugServer::updateCallFrameAndPauseIfNeeded(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) 451 { 452 ASSERT(m_currentCallFrame); 453 if (!m_currentCallFrame) 454 return; 455 456 TextPosition1 textPosition(WTF::OneBasedNumber::fromOneBasedInt(lineNumber), WTF::OneBasedNumber::base()); 457 m_currentCallFrame->update(debuggerCallFrame, sourceID, textPosition); 458 pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); 459 } 460 443 461 void ScriptDebugServer::pauseIfNeeded(Page* page) 444 462 { … … 481 499 void ScriptDebugServer::callEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) 482 500 { 501 if (!m_paused) 502 createCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); 503 } 504 505 void ScriptDebugServer::atStatement(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) 506 { 507 if (!m_paused) 508 updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); 509 } 510 511 void ScriptDebugServer::returnEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) 512 { 483 513 if (m_paused) 484 514 return; 485 515 486 m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, lineNumber); 487 pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); 488 } 489 490 void ScriptDebugServer::atStatement(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) 491 { 492 if (m_paused) 493 return; 494 495 ASSERT(m_currentCallFrame); 496 if (!m_currentCallFrame) 497 return; 498 499 m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber); 500 pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); 501 } 502 503 void ScriptDebugServer::returnEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) 504 { 505 if (m_paused) 506 return; 507 508 ASSERT(m_currentCallFrame); 509 if (!m_currentCallFrame) 510 return; 511 512 m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber); 513 pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); 516 updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); 514 517 515 518 // detach may have been called during pauseIfNeeded … … 528 531 return; 529 532 530 ASSERT(m_currentCallFrame);531 if (!m_currentCallFrame)532 return;533 534 533 if (m_pauseOnExceptionsState == PauseOnAllExceptions || (m_pauseOnExceptionsState == PauseOnUncaughtExceptions && !hasHandler)) 535 534 m_pauseOnNextStatement = true; 536 535 537 m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber); 538 pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); 536 updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); 539 537 } 540 538 541 539 void ScriptDebugServer::willExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) 542 540 { 541 if (!m_paused) 542 createCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); 543 } 544 545 void ScriptDebugServer::didExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) 546 { 543 547 if (m_paused) 544 548 return; 545 549 546 m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, lineNumber); 547 pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); 548 } 549 550 void ScriptDebugServer::didExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) 551 { 552 if (m_paused) 553 return; 554 555 ASSERT(m_currentCallFrame); 556 if (!m_currentCallFrame) 557 return; 558 559 m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber); 560 pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); 550 updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); 561 551 562 552 // Treat stepping over the end of a program like stepping out. … … 571 561 return; 572 562 573 ASSERT(m_currentCallFrame);574 if (!m_currentCallFrame)575 return;576 577 563 m_pauseOnNextStatement = true; 578 m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber); 579 pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); 564 updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); 580 565 } 581 566 -
trunk/Source/WebCore/bindings/js/ScriptDebugServer.h
r74477 r76013 119 119 void dispatchFailedToParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, int errorLine, const String& errorMessage); 120 120 121 void createCallFrameAndPauseIfNeeded(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber); 122 void updateCallFrameAndPauseIfNeeded(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber); 121 123 void pauseIfNeeded(Page*); 122 124 -
trunk/Source/WebCore/bindings/v8/DebuggerScript.js
r75794 r76013 202 202 var sourceID = script && script.id(); 203 203 204 // Get line number. 205 var line = DebuggerScript._v8ToWebkitLineNumber(frameMirror.sourceLine()); 204 // Get location. 205 var location = frameMirror.sourceLocation(); 206 var line = DebuggerScript._v8ToWebkitLineNumber(location.line); 207 var column = DebuggerScript._v8ToWebkitLineNumber(location.column); 206 208 207 209 // Get this object. … … 251 253 "sourceID": sourceID, 252 254 "line": line, 255 "column": column, 253 256 "functionName": functionName, 254 257 "type": "function", -
trunk/Source/WebCore/bindings/v8/JavaScriptCallFrame.cpp
r61198 r76013 81 81 } 82 82 83 int JavaScriptCallFrame::column() const 84 { 85 v8::HandleScope handleScope; 86 v8::Context::Scope contextScope(m_debuggerContext.get()); 87 v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8String("column")); 88 if (result->IsInt32()) 89 return result->Int32Value(); 90 return 0; 91 } 92 83 93 String JavaScriptCallFrame::functionName() const 84 94 { -
trunk/Source/WebCore/bindings/v8/JavaScriptCallFrame.h
r57813 r76013 52 52 int sourceID() const; 53 53 int line() const; 54 int column() const; 54 55 String functionName() const; 55 56 -
trunk/Source/WebCore/inspector/InjectedScriptSource.js
r75715 r76013 544 544 this.sourceID = callFrame.sourceID; 545 545 this.line = callFrame.line; 546 this.column = callFrame.column; 546 547 this.scopeChain = this._wrapScopeChain(callFrame); 547 548 this.worldId = injectedScriptId; -
trunk/Source/WebCore/inspector/JavaScriptCallFrame.idl
r63331 r76013 44 44 readonly attribute long sourceID; 45 45 readonly attribute long line; 46 readonly attribute long column; 46 47 readonly attribute [CustomGetter] Array scopeChain; 47 48 [Custom] unsigned short scopeType(in int scopeIndex);
Note: See TracChangeset
for help on using the changeset viewer.