Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f3095ecef1bbcc787d22562981f86360ff1ff13e
      
https://github.com/WebKit/WebKit/commit/f3095ecef1bbcc787d22562981f86360ff1ff13e
  Author: Devin Rousso <[email protected]>
  Date:   2025-04-17 (Thu, 17 Apr 2025)

  Changed paths:
    M LayoutTests/inspector/debugger/stepping/stepNext-await-expected.txt
    M LayoutTests/inspector/debugger/stepping/stepOver-await-expected.txt
    M Source/JavaScriptCore/debugger/Debugger.cpp
    M Source/JavaScriptCore/debugger/Debugger.h
    M Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
    M Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h

  Log Message:
  -----------
  Web Inspector: Debugger: preserve the pause reason and data when stepping 
over `await`
https://bugs.webkit.org/show_bug.cgi?id=291670

Reviewed by BJ Burg.

Currently the pause reason section of the navigation sidebar in the Sources Tab 
is empty when stepping over the `await` in code like
```js
(async function() {
    debugger;
    console.log("before");
    await (async function() { return 42; })();
    console.log("after");
})()
```
It should show "Debugger Statement" as the pause reason with the debugger 
breakpoint next to it so that the developer can see why the pause happened in 
the first place.

* Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h:
* Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::updatePauseReasonAndData):
(Inspector::InspectorDebuggerAgent::didPause):
Only override the cached last `DebuggerFrontendDispatcher::Reason` and pause 
data when the current `DebuggerFrontendDispatcher::Reason` is not invalid so as 
to preserve why Web Inspector paused even over an async boundary, which 
normally would clear that information.

* Source/JavaScriptCore/debugger/Debugger.h:
* Source/JavaScriptCore/debugger/Debugger.cpp:
(JSC::Debugger::~Debugger):
(JSC::Debugger::pauseIfNeeded):
(JSC::Debugger::willAwait):
(JSC::Debugger::didAwait):
(JSC::Debugger::resetAsyncPauseState):
(JSC::Debugger::AbandonPauseInAwaitTimer::AbandonPauseInAwaitTimer): Added.
(JSC::Debugger::AbandonPauseInAwaitTimer::doWork): Added.
Drive-by: only try to pause when stepping over an `await` so long as it's not 
been more than 1s as any longer could be confusing (e.g. "why is Web Inspector 
suddenly pausing?").

* LayoutTests/inspector/debugger/stepping/stepNext-await-expected.txt:
* LayoutTests/inspector/debugger/stepping/stepOver-await-expected.txt:

Canonical link: https://commits.webkit.org/293844@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to