haikuwebkit/LayoutTests/inspector
Devin Rousso 7290e95370 Web Inspector: Debugger: allow breakpoint actions to be evaluated as a user gesture
https://bugs.webkit.org/show_bug.cgi?id=200275

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/Debugger.json:
* debugger/Breakpoint.h:
Add an optional `emulateUserGesture` property to `Debugger.BreakpointAction`.

* debugger/Debugger.h:
(JSC::Debugger::Client::debuggerScopeExtensionObject): Renamed from `scopeExtensionObject`.
(JSC::Debugger::Client::debuggerWillEvaluate): Added.
(JSC::Debugger::Client::debuggerDidEvaluate): Added.
* debugger/Debugger.cpp:
(JSC::Debugger::evaluateBreakpointCondition):
(JSC::Debugger::evaluateBreakpointActions):
Consult the `Debugger::Client` before and after evaluating each `Breakpoint::Action`.
Currently this is used by `WebCore::PageDebuggerAgent` to push onto or pop from a stack of
`WebCore::UserGestureEmulationScope`, each corresponding to a `Breakpoint::Action` that
has been set with `emulateUserGesture`.

* inspector/agents/InspectorDebuggerAgent.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::parseBreakpointOptions):
(Inspector::InspectorDebuggerAgent::debuggerScopeExtensionObject): Renamed from `scopeExtensionObject`.

Source/WebCore:

Tests: inspector/debugger/breakpoint-action-emulateUserGesture.html
       inspector/debugger/breakpoint-action-emulateUserGesture-userIsInteracting.html

* inspector/agents/page/PageDebuggerAgent.cpp:
* inspector/agents/page/PageDebuggerAgent.h:
(WebCore::PageDebuggerAgent::debuggerWillEvaluate): Added.
(WebCore::PageDebuggerAgent::debuggerDidEvaluate): Added.
Maintain a stack of `UserGestureEmulationScope` whenever evaluating breakpoint actions (but
only add/remove items if the current action is set to `emulateUserGesture`).

* inspector/agents/page/UserGestureEmulationScope.h:
Make it fast allocated so it can be used with `UniqueRef`.

Source/WebInspectorUI:

* UserInterface/Models/BreakpointAction.js:
(WI.BreakpointAction.supportsEmulateUserAction): Added.
(WI.BreakpointAction.fromJSON):
(WI.BreakpointAction.prototype.toJSON):
(WI.BreakpointAction.prototype.set type):
(WI.BreakpointAction.prototype.set data):
(WI.BreakpointAction.prototype.get emulateUserGesture): Added.
(WI.BreakpointAction.prototype.set emulateUserGesture): Added.
Add an `_emulateUserGesture` property to match `Debugger.BreakpointAction`.

* UserInterface/Views/BreakpointActionView.js:
(WI.BreakpointActionView):
(WI.BreakpointActionView.prototype._updateBody):
(WI.BreakpointActionView.prototype._handleEmulateUserGestureCheckboxChange): Added.
* UserInterface/Views/BreakpointActionView.css:
(.breakpoint-action-block-body .description): Added.
(.breakpoint-action-block-body > .flex):
(.breakpoint-action-block-body > .description): Deleted.
Add a "[ ] Emulate User Gesture" under the log/evaluate/probe input.

* UserInterface/Models/Breakpoint.js:
(WI.Breakpoint):
(WI.Breakpoint.prototype.addAction):
(WI.Breakpoint.prototype.removeAction):
(WI.Breakpoint.prototype._handleBreakpointActionModified): Renamed from `_handleBreakpointActionChanged`.
Drive-by: combine `TypeChanged` and `DataChanged` into a single `Modified` event since all
the listeners currently have the same callback.

* UserInterface/Views/LogContentView.js:
(WI.LogContentView):
(WI.LogContentView.prototype._handleEmulateInUserGestureSettingChanged):
Drive-by: only show the "Emulate User Gesture" checkbox when it's supported.

* Localizations/en.lproj/localizedStrings.js:

LayoutTests:

* inspector/debugger/breakpoint-action-emulateUserGesture.html: Added.
* inspector/debugger/breakpoint-action-emulateUserGesture-expected.txt: Added.
* inspector/debugger/breakpoint-action-emulateUserGesture-userIsInteracting.html: Added.
* inspector/debugger/breakpoint-action-emulateUserGesture-userIsInteracting-expected.txt: Added.

* TestExpectations:
* platform/wk2/TestExpectations:


Canonical link: https://commits.webkit.org/232935@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271373 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-11 20:13:30 +00:00
..
animation Keyframe animation doesn't 't show up in the Animations timeline 2020-06-23 16:12:36 +00:00
audit Web Inspector: Audit: should be able to create/edit imported audits 2020-08-29 01:39:46 +00:00
canvas Remove support for setting CMYKA fill and stroke colors in 2D canvas 2020-09-27 02:48:39 +00:00
console Web Inspector: REGRESSION(r266885): Controllers/ConsoleManager.js:177:27: CONSOLE ASSERT ERROR 2020-10-17 04:11:10 +00:00
controller Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
cpu-profiler REGRESSION (r268897): [macOS WK1] inspector/cpu-profiler/threads.html is a flaky failure 2020-11-02 19:13:11 +00:00
css Web Inspector: Show current properties for font in new Elements sidebar Font panel 2020-12-10 19:09:00 +00:00
debugger Web Inspector: Debugger: allow breakpoint actions to be evaluated as a user gesture 2021-01-11 20:13:30 +00:00
dom Web Inspector: use weak collections for holding event listeners 2020-11-04 11:30:05 +00:00
dom-debugger Web Inspector: console command line API should be exposed to breakpoint conditions/actions 2020-10-27 06:39:08 +00:00
formatting Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
heap
indexeddb Changes to shared testing JS files should not cause test failures due to console message line numbers changing 2020-04-10 21:10:11 +00:00
injected-script Changes to shared testing JS files should not cause test failures due to console message line numbers changing 2020-04-10 21:10:11 +00:00
layers Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
memory
model Web Inspector: Show current properties for font in new Elements sidebar Font panel 2020-12-10 19:09:00 +00:00
network Web Inspector: add UI for request interception 2020-12-09 22:33:47 +00:00
page PCM: Change from ad-click-attribution to private-click-measurement (in all forms, including .well-known URL) 2020-11-12 02:04:28 +00:00
protocol Web Inspector: add test for protocol "condition" logic 2020-05-29 21:58:48 +00:00
recording
runtime Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
sampling-profiler
script-profiler Changes to shared testing JS files should not cause test failures due to console message line numbers changing 2020-04-10 21:10:11 +00:00
storage Web Inspector: Storage: cannot clear out multiple or all local storage entries 2020-04-08 19:16:34 +00:00
styles
table
timeline Remove non-inclusive language from layout tests 2020-12-21 23:50:35 +00:00
tree-outline Web Insspector: Storage: cannot select multiple local storage entries 2020-04-24 01:05:34 +00:00
unit-tests Web Inspector: implement Multimap.prototype.take() 2020-11-21 19:08:51 +00:00
view
worker Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00