Bug 200275 - Web Inspector: Debugger: allow breakpoint actions to be evaluated as a user gesture
Summary: Web Inspector: Debugger: allow breakpoint actions to be evaluated as a user g...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-07-30 11:32 PDT by Devin Rousso
Modified: 2021-01-11 12:14 PST (History)
11 users (show)

See Also:


Attachments
Patch (39.76 KB, patch)
2021-01-08 18:54 PST, Devin Rousso
no flags Details | Formatted Diff | Diff
[Image] after Patch is applied (870.44 KB, image/png)
2021-01-08 18:55 PST, Devin Rousso
no flags Details
Patch (42.86 KB, patch)
2021-01-11 10:35 PST, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2019-07-30 11:32:13 PDT
This could be useful for developers trying to "hot patch" their code with some extra functionality.
Comment 1 Devin Rousso 2021-01-08 18:54:54 PST
Created attachment 417326 [details]
Patch
Comment 2 Devin Rousso 2021-01-08 18:55:09 PST
Created attachment 417327 [details]
[Image] after Patch is applied
Comment 3 EWS Watchlist 2021-01-08 18:55:48 PST
This patch modifies the inspector protocol. Please ensure that any frontend changes appropriately use feature checks for new protocol features.
Comment 4 BJ Burg 2021-01-11 10:11:14 PST
Comment on attachment 417326 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=417326&action=review

r=me, nice work!

> LayoutTests/inspector/debugger/breakpoint-action-emulateUserGesture.html:14
> +        TestPage.addResult(window.internals.isProcessingUserGesture() ? "In User Gesture" : "Not in User Gesture");

What's the difference between .isProcessingUserGresture() here and .userIsInteracting() above?

> Source/JavaScriptCore/debugger/Debugger.cpp:618
> +    JSObject* scopeExtensionObject = m_client ? m_client->debuggerScopeExtensionObject(*this, globalObject, debuggerCallFrame) : nullptr;

Nice.

> Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp:126
> +        m_breakpointActionUserGestureEmulationScopeStack.append(makeUniqueRef<UserGestureEmulationScope>(m_inspectedPage, true));

What a mouthful. I like the stack idea though.

> Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js:139
> +            emulateUserGestureLabel.appendChild(document.createTextNode(WI.UIString("Emulate User Gesture")));

Please add a location to the UIString (@ Evaluate JavaScript breakpoint action menu in Sources tab)

> Source/WebInspectorUI/UserInterface/Views/LogContentView.js:84
> +            this._emulateUserGestureNavigationItem = new WI.CheckboxNavigationItem("emulate-in-user-gesture", WI.UIString("Emulate User Gesture"), WI.settings.emulateInUserGesture.value);

Please add a location to the UIString (@ Option in Console Tab)
Comment 5 BJ Burg 2021-01-11 10:11:51 PST
Please (create a task to) add this to the documentation as well. =)
Comment 6 Joseph Pecoraro 2021-01-11 10:14:12 PST
Comment on attachment 417326 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=417326&action=review

>> Source/JavaScriptCore/debugger/Debugger.cpp:618
>> +    JSObject* scopeExtensionObject = m_client ? m_client->debuggerScopeExtensionObject(*this, globalObject, debuggerCallFrame) : nullptr;
> 
> Nice.

+1
Comment 7 Devin Rousso 2021-01-11 10:24:17 PST
Comment on attachment 417326 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=417326&action=review

>> LayoutTests/inspector/debugger/breakpoint-action-emulateUserGesture.html:14
>> +        TestPage.addResult(window.internals.isProcessingUserGesture() ? "In User Gesture" : "Not in User Gesture");
> 
> What's the difference between .isProcessingUserGresture() here and .userIsInteracting() above?

`isProcessingUserGesture` is a WebCore concept whereas `userIsInteracting` is a WebKit (WebProcess) concept.  I believe the latter is necessary (in addition to the former) for more "native" interactions like showing the iOS keyboard when evaluating `input.click()` (see Bug 197269).

>> Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js:139
>> +            emulateUserGestureLabel.appendChild(document.createTextNode(WI.UIString("Emulate User Gesture")));
> 
> Please add a location to the UIString (@ Evaluate JavaScript breakpoint action menu in Sources tab)

👍

>> Source/WebInspectorUI/UserInterface/Views/LogContentView.js:84
>> +            this._emulateUserGestureNavigationItem = new WI.CheckboxNavigationItem("emulate-in-user-gesture", WI.UIString("Emulate User Gesture"), WI.settings.emulateInUserGesture.value);
> 
> Please add a location to the UIString (@ Option in Console Tab)

👍
Comment 8 Devin Rousso 2021-01-11 10:35:06 PST
Created attachment 417391 [details]
Patch
Comment 9 EWS 2021-01-11 12:13:35 PST
Committed r271373: <https://trac.webkit.org/changeset/271373>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 417391 [details].
Comment 10 Radar WebKit Bug Importer 2021-01-11 12:14:15 PST
<rdar://problem/73008562>