Changeset 207267 in webkit


Ignore:
Timestamp:
Oct 12, 2016 7:05:44 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: step-into console.log(o) should not step through inspector javascript
https://bugs.webkit.org/show_bug.cgi?id=161656
<rdar://problem/28181123>

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-10-12
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

  • debugger/Debugger.h:
  • debugger/Debugger.cpp:

(JSC::Debugger::pauseIfNeeded):
If the Script is blacklisted skip checking if we need to pause.

(JSC::Debugger::isBlacklisted):
(JSC::Debugger::addToBlacklist):
(JSC::Debugger::clearBlacklist):
Add the ability to add a Script to a blacklist. Currently the blacklist
only prevents pausing in the Script.

  • inspector/agents/InspectorDebuggerAgent.cpp:

(Inspector::isWebKitInjectedScript):
(Inspector::InspectorDebuggerAgent::didParseSource):
Always add Internal InjectedScripts to the Debugger's blacklist.

(Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState):
Clear blacklists when clearing debugger state.

LayoutTests:

  • inspector/debugger/stepping/stepping-internal-scripts-expected.txt: Added.
  • inspector/debugger/stepping/stepping-internal-scripts.html: Added.

Ensure step-into a console.log statement steps past it, and doesn't pause
inside the non-visible internal script.

Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207261 r207267  
     12016-10-12  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: step-into `console.log(o)` should not step through inspector javascript
     4        https://bugs.webkit.org/show_bug.cgi?id=161656
     5        <rdar://problem/28181123>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * inspector/debugger/stepping/stepping-internal-scripts-expected.txt: Added.
     10        * inspector/debugger/stepping/stepping-internal-scripts.html: Added.
     11        Ensure step-into a console.log statement steps past it, and doesn't pause
     12        inside the non-visible internal script.
     13
    1142016-10-12  Yusuke Suzuki  <utatane.tea@gmail.com>
    215
  • trunk/LayoutTests/inspector/debugger/breakpoint-syntax-error-top-level.html

    r201473 r207267  
    2222        description: "Make sure exceptions from top-level syntax errors don't cause us to crash.",
    2323        test: (resolve, reject) => {
    24             InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject) { 
     24            InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject) {
    2525                InspectorProtocol.sendCommand("Debugger.resume");
    2626
     
    3838</head>
    3939<body onload="runTest()">
    40 <p> Making sure we don't crash when having a top-level syntax error. </p>
     40<p>Making sure we don't crash when having a top-level syntax error.</p>
    4141</body>
    4242</html>
  • trunk/Source/JavaScriptCore/ChangeLog

    r207266 r207267  
     12016-10-12  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: step-into `console.log(o)` should not step through inspector javascript
     4        https://bugs.webkit.org/show_bug.cgi?id=161656
     5        <rdar://problem/28181123>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * debugger/Debugger.h:
     10        * debugger/Debugger.cpp:
     11        (JSC::Debugger::pauseIfNeeded):
     12        If the Script is blacklisted skip checking if we need to pause.
     13
     14        (JSC::Debugger::isBlacklisted):
     15        (JSC::Debugger::addToBlacklist):
     16        (JSC::Debugger::clearBlacklist):
     17        Add the ability to add a Script to a blacklist. Currently the blacklist
     18        only prevents pausing in the Script.
     19
     20        * inspector/agents/InspectorDebuggerAgent.cpp:
     21        (Inspector::isWebKitInjectedScript):
     22        (Inspector::InspectorDebuggerAgent::didParseSource):
     23        Always add Internal InjectedScripts to the Debugger's blacklist.
     24
     25        (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState):
     26        Clear blacklists when clearing debugger state.
     27
    1282016-10-12  Keith Miller  <keith_miller@apple.com>
    229
  • trunk/Source/JavaScriptCore/debugger/Debugger.cpp

    r206698 r207267  
    692692        return;
    693693
     694    intptr_t sourceID = DebuggerCallFrame::sourceIDForCallFrame(m_currentCallFrame);
     695    if (isBlacklisted(sourceID))
     696        return;
     697
    694698    DebuggerPausedScope debuggerPausedScope(*this);
    695699
     
    701705
    702706    Breakpoint breakpoint;
    703     intptr_t sourceID = DebuggerCallFrame::sourceIDForCallFrame(m_currentCallFrame);
    704707    TextPosition position = DebuggerCallFrame::positionForCallFrame(m_currentCallFrame);
    705708    pauseNow |= didHitBreakpoint = hasBreakpoint(sourceID, position, &breakpoint);
     
    913916}
    914917
     918bool Debugger::isBlacklisted(SourceID sourceID) const
     919{
     920    return m_blacklistedScripts.contains(sourceID);
     921}
     922
     923void Debugger::addToBlacklist(SourceID sourceID)
     924{
     925    m_blacklistedScripts.add(sourceID);
     926}
     927
     928void Debugger::clearBlacklist()
     929{
     930    m_blacklistedScripts.clear();
     931}
     932
    915933} // namespace JSC
  • trunk/Source/JavaScriptCore/debugger/Debugger.h

    r206653 r207267  
    111111    void stepOutOfFunction();
    112112
     113    bool isBlacklisted(SourceID) const;
     114    void addToBlacklist(SourceID);
     115    void clearBlacklist();
     116
    113117    bool isPaused() const { return m_isPaused; }
    114118    bool isStepping() const { return m_steppingMode == SteppingModeEnabled; }
     
    217221    VM& m_vm;
    218222    HashSet<JSGlobalObject*> m_globalObjects;
    219     HashMap<SourceID, DebuggerParseData> m_parseDataMap;
     223    HashMap<SourceID, DebuggerParseData, WTF::IntHash<SourceID>, WTF::UnsignedWithZeroKeyHashTraits<SourceID>> m_parseDataMap;
     224    HashSet<SourceID, WTF::IntHash<SourceID>, WTF::UnsignedWithZeroKeyHashTraits<SourceID>> m_blacklistedScripts;
    220225
    221226    PauseOnExceptionsState m_pauseOnExceptionsState;
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp

    r206653 r207267  
    682682}
    683683
     684static bool isWebKitInjectedScript(const String& sourceURL)
     685{
     686    return sourceURL.startsWith("__InjectedScript_") && sourceURL.endsWith(".js");
     687}
     688
    684689void InspectorDebuggerAgent::didParseSource(JSC::SourceID sourceID, const Script& script)
    685690{
     
    696701
    697702    m_scripts.set(sourceID, script);
     703
     704    if (hasSourceURL && isWebKitInjectedScript(sourceURL))
     705        m_scriptDebugServer.addToBlacklist(sourceID);
    698706
    699707    String scriptURLForBreakpoints = hasSourceURL ? script.sourceURL : script.url;
     
    869877    m_scriptDebugServer.clearBreakpointActions();
    870878    m_scriptDebugServer.clearBreakpoints();
     879    m_scriptDebugServer.clearBlacklist();
    871880
    872881    m_pausedScriptState = nullptr;
Note: See TracChangeset for help on using the changeset viewer.