Ignore:
Timestamp:
Jan 11, 2021, 12:13:30 PM (4 years ago)
Author:
Devin Rousso
Message:

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.
File:
1 edited

Legend:

Unmodified
Added
Removed
Note: See TracChangeset for help on using the changeset viewer.