Changeset 178137 in webkit
- Timestamp:
- Jan 8, 2015 3:16:48 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r178128 r178137 1 2015-01-08 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Pause Reason Improvements (Breakpoint, Debugger Statement, Pause on Next Statement) 4 https://bugs.webkit.org/show_bug.cgi?id=138991 5 6 Reviewed by Timothy Hatcher. 7 8 Test that the frontend receives expected pause reasons for different kinds of pauses. 9 10 * inspector/debugger/pause-reason-expected.txt: Added. 11 * inspector/debugger/pause-reason.html: Added. 12 * inspector/debugger/resources/pause-reasons.js: Added. 13 (triggerBreakpoint): 14 (triggerException): 15 (triggerDebuggerStatement): 16 (triggerAssert): 17 1 18 2015-01-08 Darin Adler <darin@apple.com> 2 19 -
trunk/Source/JavaScriptCore/ChangeLog
r178127 r178137 1 2015-01-08 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Pause Reason Improvements (Breakpoint, Debugger Statement, Pause on Next Statement) 4 https://bugs.webkit.org/show_bug.cgi?id=138991 5 6 Reviewed by Timothy Hatcher. 7 8 * debugger/Debugger.cpp: 9 (JSC::Debugger::Debugger): 10 (JSC::Debugger::pauseIfNeeded): 11 (JSC::Debugger::didReachBreakpoint): 12 When actually pausing, if we hit a breakpoint ensure the reason 13 is PausedForBreakpoint, otherwise use the current reason. 14 15 * debugger/Debugger.h: 16 Make pause reason and pausing breakpoint ID public. 17 18 * inspector/agents/InspectorDebuggerAgent.h: 19 * inspector/agents/InspectorDebuggerAgent.cpp: 20 (Inspector::buildAssertPauseReason): 21 (Inspector::buildCSPViolationPauseReason): 22 (Inspector::InspectorDebuggerAgent::buildBreakpointPauseReason): 23 (Inspector::InspectorDebuggerAgent::buildExceptionPauseReason): 24 (Inspector::InspectorDebuggerAgent::handleConsoleAssert): 25 (Inspector::buildObjectForBreakpointCookie): 26 (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): 27 (Inspector::InspectorDebuggerAgent::removeBreakpoint): 28 (Inspector::InspectorDebuggerAgent::resolveBreakpoint): 29 (Inspector::InspectorDebuggerAgent::pause): 30 (Inspector::InspectorDebuggerAgent::scriptExecutionBlockedByCSP): 31 (Inspector::InspectorDebuggerAgent::currentCallFrames): 32 (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState): 33 Clean up creation of pause reason objects and other cleanup 34 of PassRefPtr use and InjectedScript use. 35 36 (Inspector::InspectorDebuggerAgent::didPause): 37 Clean up so that we first check for an Exception, and then fall 38 back to including a Pause Reason derived from the Debugger. 39 40 * inspector/protocol/Debugger.json: 41 Add new DebuggerStatement, Breakpoint, and PauseOnNextStatement reasons. 42 1 43 2015-01-08 Joseph Pecoraro <pecoraro@apple.com> 2 44 -
trunk/Source/JavaScriptCore/debugger/Debugger.cpp
r177585 r178137 161 161 , m_lastExecutedSourceID(noSourceID) 162 162 , m_topBreakpointID(noBreakpointID) 163 , m_pausingBreakpointID(noBreakpointID) 163 164 { 164 165 } … … 671 672 if (breakpoint.autoContinue || !m_currentCallFrame) 672 673 return; 673 } 674 675 handlePause(vmEntryGlobalObject, m_reasonForPause); 674 m_pausingBreakpointID = breakpoint.id; 675 } 676 677 { 678 PauseReasonDeclaration reason(*this, didHitBreakpoint ? PausedForBreakpoint : m_reasonForPause); 679 handlePause(vmEntryGlobalObject, m_reasonForPause); 680 } 681 682 m_pausingBreakpointID = noBreakpointID; 676 683 677 684 if (!m_pauseOnNextStatement && !m_pauseOnCallFrame) { … … 780 787 return; 781 788 782 PauseReasonDeclaration reason(*this, PausedFor Breakpoint);789 PauseReasonDeclaration reason(*this, PausedForDebuggerStatement); 783 790 m_pauseOnNextStatement = true; 784 791 setSteppingMode(SteppingModeEnabled); -
trunk/Source/JavaScriptCore/debugger/Debugger.h
r177585 r178137 84 84 void setPauseOnExceptionsState(PauseOnExceptionsState); 85 85 86 void setPauseOnNextStatement(bool);87 void breakProgram();88 void continueProgram();89 void stepIntoStatement();90 void stepOverStatement();91 void stepOutOfFunction();92 93 bool isPaused() const { return m_isPaused; }94 bool isStepping() const { return m_steppingMode == SteppingModeEnabled; }95 96 virtual void sourceParsed(ExecState*, SourceProvider*, int errorLineNumber, const WTF::String& errorMessage) = 0;97 98 void exception(CallFrame*, JSValue exceptionValue, bool hasHandler);99 void atStatement(CallFrame*);100 void callEvent(CallFrame*);101 void returnEvent(CallFrame*);102 void willExecuteProgram(CallFrame*);103 void didExecuteProgram(CallFrame*);104 void didReachBreakpoint(CallFrame*);105 106 void recompileAllJSFunctions(VM*);107 108 void registerCodeBlock(CodeBlock*);109 110 protected:111 virtual bool needPauseHandling(JSGlobalObject*) { return false; }112 virtual void handleBreakpointHit(JSGlobalObject*, const Breakpoint&) { }113 virtual void handleExceptionInBreakpointCondition(ExecState*, JSValue exception) const { UNUSED_PARAM(exception); }114 115 86 enum ReasonForPause { 116 87 NotPaused, … … 121 92 PausedAtStartOfProgram, 122 93 PausedAtEndOfProgram, 123 PausedForBreakpoint 124 };125 94 PausedForBreakpoint, 95 PausedForDebuggerStatement, 96 }; 126 97 ReasonForPause reasonForPause() const { return m_reasonForPause; } 127 98 BreakpointID pausingBreakpointID() const { return m_pausingBreakpointID; } 99 100 void setPauseOnNextStatement(bool); 101 void breakProgram(); 102 void continueProgram(); 103 void stepIntoStatement(); 104 void stepOverStatement(); 105 void stepOutOfFunction(); 106 107 bool isPaused() const { return m_isPaused; } 108 bool isStepping() const { return m_steppingMode == SteppingModeEnabled; } 109 110 virtual void sourceParsed(ExecState*, SourceProvider*, int errorLineNumber, const WTF::String& errorMessage) = 0; 111 112 void exception(CallFrame*, JSValue exceptionValue, bool hasHandler); 113 void atStatement(CallFrame*); 114 void callEvent(CallFrame*); 115 void returnEvent(CallFrame*); 116 void willExecuteProgram(CallFrame*); 117 void didExecuteProgram(CallFrame*); 118 void didReachBreakpoint(CallFrame*); 119 120 void recompileAllJSFunctions(VM*); 121 122 void registerCodeBlock(CodeBlock*); 123 124 protected: 125 virtual bool needPauseHandling(JSGlobalObject*) { return false; } 126 virtual void handleBreakpointHit(JSGlobalObject*, const Breakpoint&) { } 127 virtual void handleExceptionInBreakpointCondition(ExecState*, JSValue exception) const { UNUSED_PARAM(exception); } 128 128 virtual void handlePause(JSGlobalObject*, ReasonForPause) { } 129 129 virtual void notifyDoneProcessingDebuggerEvents() { } … … 206 206 207 207 BreakpointID m_topBreakpointID; 208 BreakpointID m_pausingBreakpointID; 208 209 BreakpointIDToBreakpointMap m_breakpointIDToBreakpoint; 209 210 SourceIDToBreakpointsMap m_sourceIDToBreakpoints; -
trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
r178060 r178137 139 139 } 140 140 141 static RefPtr<InspectorObject> buildAssertPauseReason(const String& message) 142 { 143 auto reason = Inspector::Protocol::Debugger::AssertPauseReason::create().release(); 144 if (!message.isNull()) 145 reason->setMessage(message); 146 return reason->openAccessors(); 147 } 148 149 static RefPtr<InspectorObject> buildCSPViolationPauseReason(const String& directiveText) 150 { 151 auto reason = Inspector::Protocol::Debugger::CSPViolationPauseReason::create() 152 .setDirective(directiveText) 153 .release(); 154 return reason->openAccessors(); 155 } 156 157 RefPtr<InspectorObject> InspectorDebuggerAgent::buildBreakpointPauseReason(JSC::BreakpointID debuggerBreakpointIdentifier) 158 { 159 ASSERT(debuggerBreakpointIdentifier != JSC::noBreakpointID); 160 auto it = m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier.find(debuggerBreakpointIdentifier); 161 if (it == m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier.end()) 162 return nullptr; 163 164 auto reason = Inspector::Protocol::Debugger::BreakpointPauseReason::create() 165 .setBreakpointId(it->value) 166 .release(); 167 return reason->openAccessors(); 168 } 169 170 RefPtr<InspectorObject> InspectorDebuggerAgent::buildExceptionPauseReason(const Deprecated::ScriptValue& exception, const InjectedScript& injectedScript) 171 { 172 ASSERT(!exception.hasNoValue()); 173 if (exception.hasNoValue()) 174 return nullptr; 175 176 ASSERT(!injectedScript.hasNoValue()); 177 if (injectedScript.hasNoValue()) 178 return nullptr; 179 180 return injectedScript.wrapObject(exception, InspectorDebuggerAgent::backtraceObjectGroup)->openAccessors(); 181 } 182 141 183 void InspectorDebuggerAgent::handleConsoleAssert(const String& message) 142 184 { 143 if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions) { 144 Ref<Inspector::Protocol::Debugger::AssertPauseReason> reason = Inspector::Protocol::Debugger::AssertPauseReason::create().release(); 145 if (!message.isNull()) 146 reason->setMessage(message); 147 breakProgram(InspectorDebuggerFrontendDispatcher::Reason::Assert, reason->openAccessors()); 148 } 185 if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions) 186 breakProgram(InspectorDebuggerFrontendDispatcher::Reason::Assert, buildAssertPauseReason(message)); 149 187 } 150 188 … … 343 381 344 382 for (JSC::BreakpointID breakpointID : m_breakpointIdentifierToDebugServerBreakpointIDs.take(breakpointIdentifier)) { 383 m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier.remove(breakpointID); 384 345 385 const BreakpointActions& breakpointActions = scriptDebugServer().getActionsForBreakpoint(breakpointID); 346 386 for (auto& action : breakpointActions) … … 388 428 debugServerBreakpointIDsIterator = m_breakpointIdentifierToDebugServerBreakpointIDs.set(breakpointIdentifier, Vector<JSC::BreakpointID>()).iterator; 389 429 debugServerBreakpointIDsIterator->value.append(debugServerBreakpointID); 430 431 m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier.set(debugServerBreakpointID, breakpointIdentifier); 390 432 391 433 auto location = Inspector::Protocol::Debugger::Location::create() … … 453 495 void InspectorDebuggerAgent::pause(ErrorString&) 454 496 { 455 if (m_javaScriptPauseScheduled) 456 return; 457 458 clearBreakDetails(); 459 scriptDebugServer().setPauseOnNextStatement(true); 497 schedulePauseOnNextStatement(InspectorDebuggerFrontendDispatcher::Reason::PauseOnNextStatement, nullptr); 498 460 499 m_javaScriptPauseScheduled = true; 461 500 } … … 545 584 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directiveText) 546 585 { 547 if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions) { 548 auto reason = Inspector::Protocol::Debugger::CSPViolationPauseReason::create() 549 .setDirective(directiveText) 550 .release(); 551 breakProgram(InspectorDebuggerFrontendDispatcher::Reason::CSPViolation, reason->openAccessors()); 552 } 553 } 554 555 Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames() 556 { 557 if (!m_pausedScriptState) 586 if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions) 587 breakProgram(InspectorDebuggerFrontendDispatcher::Reason::CSPViolation, buildCSPViolationPauseReason(directiveText)); 588 } 589 590 Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames(InjectedScript injectedScript) 591 { 592 ASSERT(!injectedScript.hasNoValue()); 593 if (injectedScript.hasNoValue()) 558 594 return Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>::create(); 559 560 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m_pausedScriptState);561 if (injectedScript.hasNoValue()) {562 ASSERT_NOT_REACHED();563 return Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>::create();564 }565 595 566 596 return injectedScript.wrapCallFrames(m_currentCallStack); … … 628 658 } 629 659 630 void InspectorDebuggerAgent::didPause(JSC::ExecState* scriptState, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exception )660 void InspectorDebuggerAgent::didPause(JSC::ExecState* scriptState, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exceptionOrCaughtValue) 631 661 { 632 662 ASSERT(scriptState && !m_pausedScriptState); … … 634 664 m_currentCallStack = callFrames; 635 665 636 if (!exception.hasNoValue()) { 637 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); 638 if (!injectedScript.hasNoValue()) { 666 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); 667 668 // If a high level pause pause reason is not already set, try to infer a reason from the debugger. 669 if (m_breakReason == InspectorDebuggerFrontendDispatcher::Reason::Other) { 670 switch (scriptDebugServer().reasonForPause()) { 671 case JSC::Debugger::PausedForBreakpoint: { 672 JSC::BreakpointID debuggerBreakpointId = scriptDebugServer().pausingBreakpointID(); 673 if (debuggerBreakpointId != m_continueToLocationBreakpointID) { 674 m_breakReason = InspectorDebuggerFrontendDispatcher::Reason::Breakpoint; 675 m_breakAuxData = buildBreakpointPauseReason(debuggerBreakpointId); 676 } 677 break; 678 } 679 case JSC::Debugger::PausedForDebuggerStatement: 680 m_breakReason = InspectorDebuggerFrontendDispatcher::Reason::DebuggerStatement; 681 m_breakAuxData = nullptr; 682 break; 683 case JSC::Debugger::PausedForException: 639 684 m_breakReason = InspectorDebuggerFrontendDispatcher::Reason::Exception; 640 m_breakAuxData = injectedScript.wrapObject(exception, InspectorDebuggerAgent::backtraceObjectGroup)->openAccessors(); 641 // m_breakAuxData might be null after this. 642 injectedScript.setExceptionValue(exception); 643 m_hasExceptionValue = true; 685 m_breakAuxData = buildExceptionPauseReason(exceptionOrCaughtValue, injectedScript); 686 break; 687 case JSC::Debugger::PausedAtStatement: 688 case JSC::Debugger::PausedAfterCall: 689 case JSC::Debugger::PausedBeforeReturn: 690 case JSC::Debugger::PausedAtStartOfProgram: 691 case JSC::Debugger::PausedAtEndOfProgram: 692 // Pause was just stepping. Nothing to report. 693 break; 694 case JSC::Debugger::NotPaused: 695 ASSERT_NOT_REACHED(); 696 break; 644 697 } 645 698 } 646 699 647 m_frontendDispatcher->paused(currentCallFrames(), m_breakReason, m_breakAuxData); 700 // Set $exception to the exception or caught value. 701 if (!exceptionOrCaughtValue.hasNoValue() && !injectedScript.hasNoValue()) { 702 injectedScript.setExceptionValue(exceptionOrCaughtValue); 703 m_hasExceptionValue = true; 704 } 705 706 m_frontendDispatcher->paused(currentCallFrames(injectedScript), m_breakReason, m_breakAuxData); 648 707 m_javaScriptPauseScheduled = false; 649 708 … … 721 780 m_scripts.clear(); 722 781 m_breakpointIdentifierToDebugServerBreakpointIDs.clear(); 782 m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier.clear(); 723 783 m_continueToLocationBreakpointID = JSC::noBreakpointID; 724 784 clearBreakDetails(); -
trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
r178060 r178137 124 124 virtual void enable(); 125 125 virtual void disable(bool skipRecompile); 126 virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exception ) override;126 virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exceptionOrCaughtValue) override; 127 127 virtual void didContinue() override; 128 128 … … 132 132 133 133 private: 134 Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> currentCallFrames( );134 Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> currentCallFrames(InjectedScript); 135 135 136 136 virtual void didParseSource(JSC::SourceID, const Script&) override final; … … 147 147 void clearExceptionValue(); 148 148 149 RefPtr<InspectorObject> buildBreakpointPauseReason(JSC::BreakpointID); 150 RefPtr<InspectorObject> buildExceptionPauseReason(const Deprecated::ScriptValue& exception, const InjectedScript&); 151 149 152 bool breakpointActionsFromProtocol(ErrorString&, RefPtr<InspectorArray>& actions, BreakpointActions* result); 150 153 … … 152 155 typedef HashMap<String, Vector<JSC::BreakpointID>> BreakpointIdentifierToDebugServerBreakpointIDsMap; 153 156 typedef HashMap<String, RefPtr<InspectorObject>> BreakpointIdentifierToBreakpointMap; 157 typedef HashMap<JSC::BreakpointID, String> DebugServerBreakpointIDToBreakpointIdentifier; 154 158 155 159 InjectedScriptManager* m_injectedScriptManager; … … 162 166 BreakpointIdentifierToDebugServerBreakpointIDsMap m_breakpointIdentifierToDebugServerBreakpointIDs; 163 167 BreakpointIdentifierToBreakpointMap m_javaScriptBreakpoints; 168 DebugServerBreakpointIDToBreakpointIdentifier m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier; 164 169 JSC::BreakpointID m_continueToLocationBreakpointID; 165 170 InspectorDebuggerFrontendDispatcher::Reason m_breakReason; -
trunk/Source/JavaScriptCore/inspector/protocol/Debugger.json
r176358 r178137 104 104 "properties": [ 105 105 { "name": "message", "type": "string", "optional": true, "description": "The console.assert message string if provided." } 106 ] 107 }, 108 { 109 "id": "BreakpointPauseReason", 110 "description": "The pause reason auxiliary data when paused because of hitting a breakpoint.", 111 "type": "object", 112 "properties": [ 113 { "name": "breakpointId", "type": "string", "description": "The identifier of the breakpoint causing the pause." } 106 114 ] 107 115 }, … … 300 308 "parameters": [ 301 309 { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "Call stack the virtual machine stopped on." }, 302 { "name": "reason", "type": "string", "enum": [ "XHR", "DOM", "EventListener", "exception", "assert", "CSPViolation", "other"], "description": "Pause reason." },310 { "name": "reason", "type": "string", "enum": ["XHR", "DOM", "EventListener", "exception", "assert", "CSPViolation", "DebuggerStatement", "Breakpoint", "PauseOnNextStatement", "other"], "description": "Pause reason." }, 303 311 { "name": "data", "type": "object", "optional": true, "description": "Object containing break-specific auxiliary properties." } 304 312 ], -
trunk/Source/WebInspectorUI/ChangeLog
r178110 r178137 1 2015-01-08 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Pause Reason Improvements (Breakpoint, Debugger Statement, Pause on Next Statement) 4 https://bugs.webkit.org/show_bug.cgi?id=138991 5 6 Reviewed by Timothy Hatcher. 7 8 * Localizations/en.lproj/localizedStrings.js: 9 New UI strings for Pause Reasons. 10 11 * UserInterface/Controllers/DebuggerManager.js: 12 (WebInspector.DebuggerManager.prototype.breakpointForIdentifier): 13 Provide a way to get the breakpoint with an identifier. 14 15 * UserInterface/Images/PausedBreakpoint.svg: Added. 16 * UserInterface/Images/gtk/PausedBreakpoint.svg: Added. 17 Copy PseudoElement.svg icon and give it a new name. 18 19 * UserInterface/Views/BreakpointTreeElement.css: 20 (.breakpoint-paused-icon .icon): 21 New icon for a breakpoint causing a pause. 22 23 * UserInterface/Views/BreakpointTreeElement.js: 24 (WebInspector.BreakpointTreeElement.prototype.removeStatusImage): 25 (WebInspector.BreakpointTreeElement.prototype._updateStatus): 26 Give API to remove the breakpoint status icon from a BreakpointTreeElement. 27 28 * UserInterface/Views/DebuggerSidebarPanel.js: 29 (WebInspector.DebuggerSidebarPanel): 30 (WebInspector.DebuggerSidebarPanel.prototype.get hasSelectedElement): 31 (WebInspector.DebuggerSidebarPanel.prototype.deselectBreakpointContentTreeElements): 32 (WebInspector.DebuggerSidebarPanel.prototype.deselectPauseReasonContentTreeElements): 33 (WebInspector.DebuggerSidebarPanel.prototype._treeElementSelected): 34 Give DebuggerSidebarPanel an optional pause reason tree outline. When available 35 include it in the pattern of ensuring a single exclusive selection. 36 37 (WebInspector.DebuggerSidebarPanel.prototype._breakpointRemoved): 38 When a breakpoint is removed, check if we should update the pause reason tree outline. 39 40 (WebInspector.DebuggerSidebarPanel.prototype._updatePauseReason): 41 (WebInspector.DebuggerSidebarPanel.prototype._updatePauseReasonSection): 42 Update Pause Reason section contents depending on the reason. 43 44 (WebInspector.DebuggerSidebarPanel.prototype._updatePauseReasonGotoArrow): 45 Always try to include a goto arrow to jump to the original pause location 46 if it is available at the time of pausing. 47 1 48 2015-01-08 Joseph Pecoraro <pecoraro@apple.com> 2 49 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r175588 r178137 48 48 localizedStrings["All Uncaught Exceptions"] = "All Uncaught Exceptions"; 49 49 localizedStrings["An error occured trying to\nread the “%s” table."] = "An error occured trying to\nread the “%s” table."; 50 localizedStrings["An error occurred trying to load the resource."] = "An error occurred trying to load the resource.";51 50 localizedStrings["An unexpected error %s occurred."] = "An unexpected error %s occurred."; 52 51 localizedStrings["An unexpected error occurred."] = "An unexpected error occurred."; … … 59 58 localizedStrings["Anonymous StyleSheet %d"] = "Anonymous StyleSheet %d"; 60 59 localizedStrings["Application Cache"] = "Application Cache"; 61 localizedStrings["Assertion "] = "Assertion";60 localizedStrings["Assertion Failed"] = "Assertion Failed"; 62 61 localizedStrings["Assertion failed:"] = "Assertion failed:"; 62 localizedStrings["Assertion with message: %s"] = "Assertion with message: %s"; 63 63 localizedStrings["Assertive"] = "Assertive"; 64 64 localizedStrings["Attribute"] = "Attribute"; … … 110 110 localizedStrings["Content"] = "Content"; 111 111 localizedStrings["Content Flow"] = "Content Flow"; 112 localizedStrings["Content Security Policy Violation"] = "Content Security Policy Violation";112 localizedStrings["Content Security Policy violation of directive: %s"] = "Content Security Policy violation of directive: %s"; 113 113 localizedStrings["Continue script execution (%s or %s)"] = "Continue script execution (%s or %s)"; 114 114 localizedStrings["Continue to Here"] = "Continue to Here"; … … 125 125 localizedStrings["Debugger"] = "Debugger"; 126 126 localizedStrings["Debugger Paused"] = "Debugger Paused"; 127 localizedStrings["Debugger Statement"] = "Debugger Statement"; 127 128 localizedStrings["Decoded"] = "Decoded"; 128 129 localizedStrings["Delete"] = "Delete"; … … 193 194 localizedStrings["Event Dispatched"] = "Event Dispatched"; 194 195 localizedStrings["Event Listeners"] = "Event Listeners"; 195 localizedStrings["Exception "] = "Exception";196 localizedStrings["Exception with thrown value: %s"] = "Exception with thrown value: %s"; 196 197 localizedStrings["Expand columns"] = "Expand columns"; 197 198 localizedStrings["Expanded"] = "Expanded"; … … 242 243 localizedStrings["Image Size"] = "Image Size"; 243 244 localizedStrings["Images"] = "Images"; 245 localizedStrings["Immediate Pause Requested"] = "Immediate Pause Requested"; 244 246 localizedStrings["Index Key \u2014 %s"] = "Index Key \u2014 %s"; 245 247 localizedStrings["Indexed Databases"] = "Indexed Databases"; … … 322 324 localizedStrings["Path"] = "Path"; 323 325 localizedStrings["Pause Playback"] = "Pause Playback"; 326 localizedStrings["Pause Reason"] = "Pause Reason"; 324 327 localizedStrings["Pause script execution (%s or %s)"] = "Pause script execution (%s or %s)"; 325 328 localizedStrings["Play Sound"] = "Play Sound"; … … 445 448 localizedStrings["Total size of all resources, click to show the Network Requests timeline"] = "Total size of all resources, click to show the Network Requests timeline"; 446 449 localizedStrings["Transfered"] = "Transfered"; 450 localizedStrings["Triggered Breakpoint"] = "Triggered Breakpoint"; 447 451 localizedStrings["Type"] = "Type"; 448 452 localizedStrings["Type Issue"] = "Type Issue"; -
trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
r175588 r178137 97 97 98 98 WebInspector.DebuggerManager.PauseReason = { 99 Assertion: "assertion", 100 Breakpoint: "breakpoint", 101 CSPViolation: "CSP-violation", 102 DebuggerStatement: "debugger-statement", 99 103 Exception: "exception", 100 Assertion: "assertion", 101 CSPViolation: "CSP-violation", 104 PauseOnNextStatement: "pause-on-next-statement", 102 105 Other: "other", 103 106 } … … 307 310 308 311 return []; 312 }, 313 314 breakpointForIdentifier: function(id) 315 { 316 return this._breakpointIdMap[id]; 309 317 }, 310 318 … … 615 623 // FIXME: Handle other backend pause seasons. 616 624 switch (payload) { 625 case DebuggerAgent.PausedReason.Assert: 626 return WebInspector.DebuggerManager.PauseReason.Assertion; 627 case DebuggerAgent.PausedReason.Breakpoint: 628 return WebInspector.DebuggerManager.PauseReason.Breakpoint; 629 case DebuggerAgent.PausedReason.CSPViolation: 630 return WebInspector.DebuggerManager.PauseReason.CSPViolation; 631 case DebuggerAgent.PausedReason.DebuggerStatement: 632 return WebInspector.DebuggerManager.PauseReason.DebuggerStatement; 617 633 case DebuggerAgent.PausedReason.Exception: 618 634 return WebInspector.DebuggerManager.PauseReason.Exception; 619 case DebuggerAgent.PausedReason.Assert: 620 return WebInspector.DebuggerManager.PauseReason.Assertion; 621 case DebuggerAgent.PausedReason.CSPViolation: 622 return WebInspector.DebuggerManager.PauseReason.CSPViolation; 635 case DebuggerAgent.PausedReason.PauseOnNextStatement: 636 return WebInspector.DebuggerManager.PauseReason.PauseOnNextStatement; 623 637 default: 624 638 return WebInspector.DebuggerManager.PauseReason.Other; -
trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.css
r173715 r178137 51 51 } 52 52 53 .breakpoint-paused-icon .icon { 54 content: url(../Images/PausedBreakpoint.svg); 55 } 56 53 57 /* When animating a layer on top of a tree element's icon, move the main 54 58 icon to the icon element's background so animations are layered on top. */ -
trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js
r172204 r178137 133 133 }, 134 134 135 removeStatusImage: function() 136 { 137 this._statusImageElement.remove(); 138 this._statusImageElement = null; 139 }, 140 135 141 // Private 136 142 … … 160 166 _updateStatus: function() 161 167 { 168 if (!this._statusImageElement) 169 return; 170 162 171 if (this._breakpoint.disabled) 163 172 this._statusImageElement.classList.add(WebInspector.BreakpointTreeElement.StatusImageDisabledStyleClassName); -
trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
r175588 r178137 133 133 this._callStackSection = new WebInspector.DetailsSection("call-stack", WebInspector.UIString("Call Stack"), [callStackGroup]); 134 134 135 this._pauseReasonRow = new WebInspector.DetailsSectionTextRow; 136 this._pauseReasonGroup = new WebInspector.DetailsSectionGroup([this._pauseReasonRow]); 137 this._pauseReasonSection = new WebInspector.DetailsSection("paused-reason", null, [this._pauseReasonGroup]); 135 this._pauseReasonTreeOutline = null; 136 137 this._pauseReasonLinkContainerElement = document.createElement("span"); 138 this._pauseReasonTextRow = new WebInspector.DetailsSectionTextRow; 139 this._pauseReasonGroup = new WebInspector.DetailsSectionGroup([this._pauseReasonTextRow]); 140 this._pauseReasonSection = new WebInspector.DetailsSection("paused-reason", null, [this._pauseReasonGroup], this._pauseReasonLinkContainerElement); 141 this._pauseReasonSection.title = WebInspector.UIString("Pause Reason"); 138 142 139 143 WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisplayLocationDidChange, this._breakpointDisplayLocationDidChange, this); … … 142 146 WebInspector.DebuggerSidebarPanel.OffsetSectionsStyleClassName = "offset-sections"; 143 147 WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName = "breakpoint-exception-icon"; 148 WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName = "breakpoint-paused-icon"; 144 149 145 150 WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey = "debugger-sidebar-panel-all-exceptions-breakpoint"; … … 153 158 get hasSelectedElement() 154 159 { 155 return !!this._breakpointsContentTreeOutline.selectedTreeElement || !!this._callStackContentTreeOutline.selectedTreeElement; 160 return !!this._breakpointsContentTreeOutline.selectedTreeElement 161 || !!this._callStackContentTreeOutline.selectedTreeElement 162 || (this._pauseReasonTreeOutline && !!this._pauseReasonTreeOutline.selectedTreeElement); 156 163 }, 157 164 … … 352 359 var breakpoint = event.data.breakpoint; 353 360 361 if (this._pauseReasonTreeOutline) { 362 var pauseReasonBreakpointTreeElement = this._pauseReasonTreeOutline.getCachedTreeElement(breakpoint); 363 if (pauseReasonBreakpointTreeElement) 364 pauseReasonBreakpointTreeElement.removeStatusImage(); 365 } 366 354 367 var breakpointTreeElement = this._breakpointsContentTreeOutline.getCachedTreeElement(breakpoint); 355 368 console.assert(breakpointTreeElement); … … 524 537 function deselectCallStackContentTreeElements() 525 538 { 526 // Deselect any tree element in the call stack content tree outline to prevent two selections in the sidebar.527 539 var selectedTreeElement = this._callStackContentTreeOutline.selectedTreeElement; 540 if (selectedTreeElement) 541 selectedTreeElement.deselect(); 542 } 543 544 function deselectBreakpointContentTreeElements() 545 { 546 var selectedTreeElement = this._breakpointsContentTreeOutline.selectedTreeElement; 547 if (selectedTreeElement) 548 selectedTreeElement.deselect(); 549 } 550 551 function deselectPauseReasonContentTreeElements() 552 { 553 if (!this._pauseReasonTreeOutline) 554 return; 555 556 var selectedTreeElement = this._pauseReasonTreeOutline.selectedTreeElement; 528 557 if (selectedTreeElement) 529 558 selectedTreeElement.deselect(); … … 535 564 return; 536 565 deselectCallStackContentTreeElements.call(this); 566 deselectPauseReasonContentTreeElements.call(this); 537 567 WebInspector.resourceSidebarPanel.showSourceCode(treeElement.representedObject); 538 568 return; … … 540 570 541 571 if (treeElement instanceof WebInspector.CallFrameTreeElement) { 542 // Deselect any tree element in the breakpoints content tree outline to prevent two selections in the sidebar. 543 var selectedTreeElement = this._breakpointsContentTreeOutline.selectedTreeElement; 544 if (selectedTreeElement) 545 selectedTreeElement.deselect(); 572 // Deselect any tree element in the breakpoint / pause reason content tree outlines to prevent two selections in the sidebar. 573 deselectBreakpointContentTreeElements.call(this); 574 deselectPauseReasonContentTreeElements.call(this); 546 575 547 576 var callFrame = treeElement.callFrame; … … 554 583 return; 555 584 585 // Deselect any other tree elements to prevent two selections in the sidebar. 556 586 deselectCallStackContentTreeElements.call(this); 587 588 if (treeElement.treeOutline === this._pauseReasonTreeOutline) 589 deselectBreakpointContentTreeElements.call(this); 590 else 591 deselectPauseReasonContentTreeElements.call(this); 592 593 var breakpoint = treeElement.breakpoint; 594 if (treeElement.treeOutline === this._pauseReasonTreeOutline) { 595 WebInspector.resourceSidebarPanel.showSourceCodeLocation(breakpoint.sourceCodeLocation); 596 return; 597 } 557 598 558 599 if (!treeElement.parent.representedObject) … … 563 604 return; 564 605 565 var breakpoint = treeElement.breakpoint;566 606 WebInspector.resourceSidebarPanel.showSourceCodeLocation(breakpoint.sourceCodeLocation); 567 607 }, … … 596 636 _updatePauseReason: function() 597 637 { 638 this._pauseReasonTreeOutline = null; 639 640 this._updatePauseReasonGotoArrow(); 641 return this._updatePauseReasonSection(); 642 }, 643 644 _updatePauseReasonSection: function() 645 { 598 646 var pauseData = WebInspector.debuggerManager.pauseData; 599 647 600 648 switch (WebInspector.debuggerManager.pauseReason) { 649 case WebInspector.DebuggerManager.PauseReason.Assertion: 650 // FIXME: We should include the assertion condition string. 651 console.assert(pauseData, "Expected data with an assertion, but found none."); 652 if (pauseData && pauseData.message) { 653 this._pauseReasonTextRow.text = WebInspector.UIString("Assertion with message: %s").format(pauseData.message); 654 return true; 655 } 656 657 this._pauseReasonTextRow.text = WebInspector.UIString("Assertion Failed"); 658 this._pauseReasonGroup.rows = [this._pauseReasonTextRow]; 659 return true; 660 661 case WebInspector.DebuggerManager.PauseReason.Breakpoint: 662 console.assert(pauseData, "Expected breakpoint identifier, but found none."); 663 if (pauseData && pauseData.breakpointId) { 664 var breakpoint = WebInspector.debuggerManager.breakpointForIdentifier(pauseData.breakpointId); 665 var breakpointTreeOutline = this.createContentTreeOutline(true, true); 666 breakpointTreeOutline.onselect = this._treeElementSelected.bind(this); 667 var breakpointTreeElement = new WebInspector.BreakpointTreeElement(breakpoint, WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName, WebInspector.UIString("Triggered Breakpoint")); 668 var breakpointDetailsSection = new WebInspector.DetailsSectionRow; 669 breakpointTreeOutline.appendChild(breakpointTreeElement); 670 breakpointDetailsSection.element.appendChild(breakpointTreeOutline.element); 671 672 this._pauseReasonGroup.rows = [breakpointDetailsSection]; 673 this._pauseReasonTreeOutline = breakpointTreeOutline; 674 return true; 675 } 676 break; 677 678 case WebInspector.DebuggerManager.PauseReason.CSPViolation: 679 console.assert(pauseData, "Expected data with a CSP Violation, but found none."); 680 if (pauseData) { 681 // COMPATIBILITY (iOS 8): 'directive' was 'directiveText'. 682 this._pauseReasonTextRow.text = WebInspector.UIString("Content Security Policy violation of directive: %s").format(pauseData.directive || pauseData.directiveText); 683 this._pauseReasonGroup.rows = [this._pauseReasonTextRow]; 684 return true; 685 } 686 break; 687 688 case WebInspector.DebuggerManager.PauseReason.DebuggerStatement: 689 this._pauseReasonTextRow.text = WebInspector.UIString("Debugger Statement"); 690 this._pauseReasonGroup.rows = [this._pauseReasonTextRow]; 691 return true; 692 601 693 case WebInspector.DebuggerManager.PauseReason.Exception: 602 694 console.assert(pauseData, "Expected data with an exception, but found none."); … … 604 696 // FIXME: We should improve the appearance of thrown objects. This works well for exception strings. 605 697 var data = WebInspector.RemoteObject.fromPayload(pauseData); 606 this._pauseReason Row.text = data.description;607 this._pauseReason Section.title = WebInspector.UIString("Exception");698 this._pauseReasonTextRow.text = WebInspector.UIString("Exception with thrown value: %s").format(data.description); 699 this._pauseReasonGroup.rows = [this._pauseReasonTextRow]; 608 700 return true; 609 701 } 610 702 break; 611 703 612 case WebInspector.DebuggerManager.PauseReason.Assertion: 613 console.assert(pauseData, "Expected data with an assertion, but found none."); 614 if (pauseData && pauseData.message) { 615 // FIXME: We should include the assertion condition string. 616 this._pauseReasonRow.text = pauseData.message; 617 this._pauseReasonSection.title = WebInspector.UIString("Assertion"); 618 return true; 619 } 620 break; 621 622 case WebInspector.DebuggerManager.PauseReason.CSPViolation: 623 console.assert(pauseData, "Expected data with a CSP Violation, but found none."); 624 if (pauseData) { 625 // COMPATIBILITY (iOS 8): 'directive' was 'directiveText'. 626 this._pauseReasonRow.text = pauseData.directive || pauseData.directiveText; 627 this._pauseReasonSection.title = WebInspector.UIString("Content Security Policy Violation"); 628 return true; 629 } 630 break; 704 case WebInspector.DebuggerManager.PauseReason.PauseOnNextStatement: 705 this._pauseReasonTextRow.text = WebInspector.UIString("Immediate Pause Requested"); 706 this._pauseReasonGroup.rows = [this._pauseReasonTextRow]; 707 return true; 631 708 632 709 case WebInspector.DebuggerManager.PauseReason.Other: … … 636 713 637 714 return false; 715 }, 716 717 _updatePauseReasonGotoArrow: function() 718 { 719 this._pauseReasonLinkContainerElement.removeChildren(); 720 721 var activeCallFrame = WebInspector.debuggerManager.activeCallFrame; 722 if (!activeCallFrame) 723 return; 724 725 var sourceCodeLocation = activeCallFrame.sourceCodeLocation; 726 if (!sourceCodeLocation) 727 return; 728 729 var linkElement = WebInspector.createSourceCodeLocationLink(sourceCodeLocation, false, true); 730 this._pauseReasonLinkContainerElement.appendChild(linkElement); 638 731 } 639 732 };
Note: See TracChangeset
for help on using the changeset viewer.