Ignore:
Timestamp:
Mar 18, 2022, 6:03:20 PM (3 years ago)
Author:
Devin Rousso
Message:

Web Inspector: REGRESSION(?): Emulate User Gesture doesn't work
https://bugs.webkit.org/show_bug.cgi?id=232584
<rdar://problem/84899576>

Reviewed by Patrick Angle.

Source/JavaScriptCore:

  • inspector/agents/InspectorDebuggerAgent.h:
  • inspector/agents/InspectorDebuggerAgent.cpp:

(Inspector::InspectorDebuggerAgent::evaluateOnCallFrame):

  • inspector/agents/InspectorRuntimeAgent.h:
  • inspector/agents/InspectorRuntimeAgent.cpp:

(Inspector::InspectorRuntimeAgent::evaluate):
(Inspector::InspectorRuntimeAgent::callFunctionOn):
Create overloads for these (protocol) methods so that we can avoid having to fetch the same
InjectedScript more than once (i.e. if the subclass fetches the InjectedScript and then
called into the baseclass, which also fetches the same InjectedScript).

  • debugger/Debugger.h:

(JSC::Debugger::Client::debuggerWillEvaluate):
(JSC::Debugger::Client::debuggerDidEvaluate):

  • debugger/Debugger.cpp:

(JSC::Debugger::evaluateBreakpointActions):
Pass along the current JSGlobalObject to eventually derive a relevant WebCore::Document.

Source/WebCore:

Recently some new web APIs have gone a step further by using a new way to detect one-time
user interaction called [transient activation](https://html.spec.whatwg.org/multipage/interaction.html#transient-activation).
In order to support invoking these APIs from Web Inspector, UserGestureEmulationScope
needs to be adjusted to support marking the context as having recently been interacted with,
which turns out to just involve plumbing a Document through to the UserGestureIndicator,
as the rest has already been implemented.

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

inspector/debugger/evaluateOnCallFrame-emulateUserGesture-hasTransientActivation.html
inspector/runtime/callFunctionOn-emulateUserGesture-hasTransientActivation.html
inspector/runtime/evaluate-emulateUserGesture-hasTransientActivation.html

  • inspector/agents/page/PageDebuggerAgent.h:
  • inspector/agents/page/PageDebuggerAgent.cpp:

(WebCore::PageDebuggerAgent::evaluateOnCallFrame):
(WebCore::PageDebuggerAgent::debuggerWillEvaluate):
(WebCore::PageDebuggerAgent::debuggerDidEvaluate):

  • inspector/agents/page/PageRuntimeAgent.cpp:

(WebCore::PageRuntimeAgent::evaluate):
(WebCore::PageRuntimeAgent::callFunctionOn):

  • inspector/agents/page/UserGestureEmulationScope.h:
  • inspector/agents/page/UserGestureEmulationScope.cpp:

(WebCore::UserGestureEmulationScope::UserGestureEmulationScope):
Derive a Document from the JSGlobalObject of the relevant InjectedScript.

  • inspector/InspectorFrontendClientLocal.cpp:

(WebCore::InspectorFrontendClientLocal::openURLExternally):

  • inspector/InspectorFrontendHost.cpp:

(WebCore::FrontendMenuProvider::contextMenuItemSelected):

  • inspector/agents/InspectorPageAgent.cpp:

(WebCore::InspectorPageAgent::navigate):
Drive-by: Pass the relevant Document to the UserGestureIndicator just in case the Web

Inspector frontend needs it.

  • page/DOMWindow.h:
  • testing/Internals.idl:
  • testing/Internals.h:
  • testing/Internals.cpp:

(WebCore::Internals::hasTransientActivation): Added.
Expose DOMWindow::hasTransientActivation to tests.

LayoutTests:

  • inspector/debugger/breakpoint-action-emulateUserGesture-hasTransientActiviation.html: Added.
  • inspector/debugger/breakpoint-action-emulateUserGesture-hasTransientActiviation-expected.txt: Added.
  • inspector/debugger/evaluateOnCallFrame-emulateUserGesture-hasTransientActivation.html: Added.
  • inspector/debugger/evaluateOnCallFrame-emulateUserGesture-hasTransientActivation-expected.txt: Added.
  • inspector/runtime/callFunctionOn-emulateUserGesture-hasTransientActivation.html: Added.
  • inspector/runtime/callFunctionOn-emulateUserGesture-hasTransientActivation-expected.txt: Added.
  • inspector/runtime/evaluate-emulateUserGesture-hasTransientActivation.html: Added.
  • inspector/runtime/evaluate-emulateUserGesture-hasTransientActivation-expected.txt: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/debugger/Debugger.cpp

    r291380 r291517  
    638638    for (const auto& action : breakpoint.actions()) {
    639639        if (m_client)
    640             m_client->debuggerWillEvaluate(*this, action);
     640            m_client->debuggerWillEvaluate(*this, globalObject, action);
    641641
    642642        auto& debuggerCallFrame = currentDebuggerCallFrame();
     
    680680
    681681        if (m_client)
    682             m_client->debuggerDidEvaluate(*this, action);
     682            m_client->debuggerDidEvaluate(*this, globalObject, action);
    683683
    684684        if (!isAttached(globalObject))
Note: See TracChangeset for help on using the changeset viewer.