Changeset 251620 in webkit
- Timestamp:
- Oct 25, 2019 6:10:59 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r251619 r251620 1 2019-10-25 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: support emulateUserGesture parameter in Runtime.callFunctionOn 4 https://bugs.webkit.org/show_bug.cgi?id=200262 5 6 Reviewed by Devin Rousso. 7 8 Supported emulateUserGesture in Runtime.callFunctionOn protocol command. 9 10 * TestExpectations: 11 * inspector/runtime/callFunctionOn-emulateUserGesture-expected.txt: Added. 12 * inspector/runtime/callFunctionOn-emulateUserGesture-userIsInteracting-expected.txt: Added. 13 * inspector/runtime/callFunctionOn-emulateUserGesture-userIsInteracting.html: Added. 14 * inspector/runtime/callFunctionOn-emulateUserGesture.html: Added. 15 * platform/wk2/TestExpectations: 16 Only enable the new test on WK2, as the user interaction state is only supported by WK2. 17 1 18 2019-10-25 Megan Gardner <megan_gardner@apple.com> 2 19 -
trunk/LayoutTests/TestExpectations
r251594 r251620 915 915 inspector/debugger/evaluateOnCallFrame-emulateUserGesture-userIsInteracting.html [ Skip ] 916 916 inspector/runtime/evaluate-emulateUserGesture-userIsInteracting.html [ Skip ] 917 inspector/runtime/callFunctionOn-emulateUserGesture-userIsInteracting.html [ Skip ] 917 918 918 919 # Target domain is only present in WK2. -
trunk/LayoutTests/platform/gtk/TestExpectations
r251606 r251620 2246 2246 2247 2247 webkit.org/b/149916 http/tests/inspector/dom/disconnect-dom-tree-after-main-frame-navigation.html [ Pass Slow ] 2248 webkit.org/b/149916 inspector/codemirror/prettyprinting-css.html [ Pass Slow ]2249 webkit.org/b/149916 inspector/codemirror/prettyprinting-javascript.html [ Pass Slow ]2250 2248 webkit.org/b/149916 inspector/console/clearMessages.html [ Pass Slow ] 2251 2249 webkit.org/b/149916 inspector/console/command-line-api.html [ Pass Slow ] -
trunk/LayoutTests/platform/wk2/TestExpectations
r251494 r251620 764 764 inspector/debugger/evaluateOnCallFrame-emulateUserGesture-userIsInteracting.html [ Pass ] 765 765 inspector/runtime/evaluate-emulateUserGesture-userIsInteracting.html [ Pass ] 766 inspector/runtime/callFunctionOn-emulateUserGesture-userIsInteracting.html [ Pass ] 766 767 767 768 # Target domain is only present in WebKit2. -
trunk/Source/JavaScriptCore/ChangeLog
r251584 r251620 1 2019-10-25 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: support emulateUserGesture parameter in Runtime.callFunctionOn 4 https://bugs.webkit.org/show_bug.cgi?id=200262 5 6 Reviewed by Devin Rousso. 7 8 * inspector/agents/InspectorRuntimeAgent.cpp: 9 (Inspector::InspectorRuntimeAgent::callFunctionOn): 10 * inspector/agents/InspectorRuntimeAgent.h: 11 * inspector/protocol/Runtime.json: 12 1 13 2019-10-24 Mark Lam <mark.lam@apple.com> 2 14 -
trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp
r250087 r251620 156 156 } 157 157 158 void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown)158 void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* /* emulateUserGesture */, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown) 159 159 { 160 160 InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId); -
trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h
r250996 r251620 64 64 void evaluate(ErrorString&, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, const bool* emulateUserGesture, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex) override; 65 65 void awaitPromise(const String& promiseObjectId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, Ref<AwaitPromiseCallback>&&) final; 66 void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown) final;66 void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* emulateUserGesture, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown) override; 67 67 void releaseObject(ErrorString&, const ErrorString& objectId) final; 68 68 void getPreview(ErrorString&, const String& objectId, RefPtr<Protocol::Runtime::ObjectPreview>&) final; -
trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json
r251227 r251620 254 254 { "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether function call should stop on exceptions and mute console. Overrides setPauseOnException state." }, 255 255 { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object which should be sent by value." }, 256 { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for the result." } 256 { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for the result." }, 257 { "name": "emulateUserGesture", "type": "boolean", "optional": true, "description": "Whether the expression should be considered to be in a user gesture or not." } 257 258 ], 258 259 "returns": [ -
trunk/Source/WebCore/ChangeLog
r251617 r251620 1 2019-10-25 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: support emulateUserGesture parameter in Runtime.callFunctionOn 4 https://bugs.webkit.org/show_bug.cgi?id=200262 5 6 Reviewed by Devin Rousso. 7 8 Support emulateUserGesture in Runtime.callFunctionOn 9 10 Tests: inspector/runtime/callFunctionOn-emulateUserGesture-userIsInteracting.html 11 inspector/runtime/callFunctionOn-emulateUserGesture.html 12 13 * Sources.txt: 14 * WebCore.xcodeproj/project.pbxproj: 15 * inspector/agents/page/PageDebuggerAgent.cpp: 16 (WebCore::PageDebuggerAgent::evaluateOnCallFrame): 17 * inspector/agents/page/PageRuntimeAgent.cpp: 18 (WebCore::asBool): 19 (WebCore::PageRuntimeAgent::evaluate): 20 (WebCore::PageRuntimeAgent::callFunctionOn): 21 * inspector/agents/page/PageRuntimeAgent.h: 22 * inspector/agents/page/UserGestureEmulationScope.cpp: Added. 23 (WebCore::UserGestureEmulationScope::UserGestureEmulationScope): Extracted logic 24 of overriding user gesture into the scope object to share it between evaluate and 25 callFunctionOn as well as PageDebuggerAgent::evaluateOnCallFrame. 26 (WebCore::UserGestureEmulationScope::~UserGestureEmulationScope): 27 * inspector/agents/page/UserGestureEmulationScope.h: Added. 28 1 29 2019-10-25 Zalan Bujtas <zalan@apple.com> 2 30 -
trunk/Source/WebCore/Sources.txt
r251590 r251620 1405 1405 inspector/agents/page/PageNetworkAgent.cpp 1406 1406 inspector/agents/page/PageRuntimeAgent.cpp 1407 inspector/agents/page/UserGestureEmulationScope.cpp 1407 1408 1408 1409 inspector/agents/worker/ServiceWorkerAgent.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r251590 r251620 4882 4882 F12171F516A8CED2000053CA /* WebVTTElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F12171F316A8BC63000053CA /* WebVTTElement.cpp */; }; 4883 4883 F12171F616A8CF0B000053CA /* WebVTTElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F12171F416A8BC63000053CA /* WebVTTElement.h */; }; 4884 F32BDCD92363AACA0073B6AE /* UserGestureEmulationScope.h in Headers */ = {isa = PBXBuildFile; fileRef = F32BDCD72363AACA0073B6AE /* UserGestureEmulationScope.h */; }; 4884 4885 F344C7141125B82C00F26EEE /* InspectorFrontendClient.h in Headers */ = {isa = PBXBuildFile; fileRef = F344C7121125B82C00F26EEE /* InspectorFrontendClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4885 4886 F344C75311294D9D00F26EEE /* InspectorFrontendClientLocal.h in Headers */ = {isa = PBXBuildFile; fileRef = F344C75211294D9D00F26EEE /* InspectorFrontendClientLocal.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 15241 15242 F12171F316A8BC63000053CA /* WebVTTElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebVTTElement.cpp; sourceTree = "<group>"; }; 15242 15243 F12171F416A8BC63000053CA /* WebVTTElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVTTElement.h; sourceTree = "<group>"; }; 15244 F32BDCD52363AAC90073B6AE /* UserGestureEmulationScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserGestureEmulationScope.cpp; sourceTree = "<group>"; }; 15245 F32BDCD72363AACA0073B6AE /* UserGestureEmulationScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserGestureEmulationScope.h; sourceTree = "<group>"; }; 15243 15246 F344C7121125B82C00F26EEE /* InspectorFrontendClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendClient.h; sourceTree = "<group>"; }; 15244 15247 F344C75211294D9D00F26EEE /* InspectorFrontendClientLocal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendClientLocal.h; sourceTree = "<group>"; }; … … 22780 22783 A5B81CC11FAA44B70037D1E6 /* PageRuntimeAgent.cpp */, 22781 22784 A5B81CBF1FAA44B70037D1E6 /* PageRuntimeAgent.h */, 22785 F32BDCD52363AAC90073B6AE /* UserGestureEmulationScope.cpp */, 22786 F32BDCD72363AACA0073B6AE /* UserGestureEmulationScope.h */, 22782 22787 ); 22783 22788 path = page; … … 32466 32471 003F1FEA11E6AB43008258D9 /* UserContentTypes.h in Headers */, 32467 32472 BCACF3BD1072921A00C0C8A3 /* UserContentURLPattern.h in Headers */, 32473 F32BDCD92363AACA0073B6AE /* UserGestureEmulationScope.h in Headers */, 32468 32474 2542F4DB1166C25A00E89A86 /* UserGestureIndicator.h in Headers */, 32469 32475 9920398318B95BC600B39AF9 /* UserInputBridge.h in Headers */, -
trunk/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp
r251531 r251620 34 34 35 35 #include "CachedResource.h" 36 #include "Chrome.h"37 #include "ChromeClient.h"38 36 #include "Document.h" 39 37 #include "Frame.h" … … 45 43 #include "ScriptExecutionContext.h" 46 44 #include "ScriptState.h" 47 #include "UserGesture Indicator.h"45 #include "UserGestureEmulationScope.h" 48 46 #include <JavaScriptCore/InjectedScript.h> 49 47 #include <JavaScriptCore/InjectedScriptManager.h> … … 72 70 void PageDebuggerAgent::evaluateOnCallFrame(ErrorString& errorString, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, const bool* emulateUserGesture, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex) 73 71 { 74 auto& pageChromeClient = m_inspectedPage.chrome().client();75 76 72 auto shouldEmulateUserGesture = emulateUserGesture && *emulateUserGesture; 77 78 Optional<ProcessingUserGestureState> userGestureState = shouldEmulateUserGesture ? Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt; 79 UserGestureIndicator gestureIndicator(userGestureState); 80 81 bool userWasInteracting = false; 82 if (shouldEmulateUserGesture) { 83 userWasInteracting = pageChromeClient.userIsInteracting(); 84 if (!userWasInteracting) 85 pageChromeClient.setUserIsInteracting(true); 86 } 73 UserGestureEmulationScope userGestureScope(m_inspectedPage, shouldEmulateUserGesture); 87 74 88 75 WebDebuggerAgent::evaluateOnCallFrame(errorString, callFrameId, expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, saveResult, emulateUserGesture, result, wasThrown, savedResultIndex); 89 90 if (shouldEmulateUserGesture && !userWasInteracting && pageChromeClient.userIsInteracting())91 pageChromeClient.setUserIsInteracting(false);92 76 } 93 77 -
trunk/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp
r251531 r251620 33 33 #include "PageRuntimeAgent.h" 34 34 35 #include "Chrome.h"36 #include "ChromeClient.h"37 35 #include "Document.h" 38 36 #include "Frame.h" … … 45 43 #include "ScriptState.h" 46 44 #include "SecurityOrigin.h" 47 #include "UserGesture Indicator.h"45 #include "UserGestureEmulationScope.h" 48 46 #include <JavaScriptCore/InjectedScript.h> 49 47 #include <JavaScriptCore/InjectedScriptManager.h> … … 51 49 using Inspector::Protocol::Runtime::ExecutionContextDescription; 52 50 53 54 51 namespace WebCore { 55 52 56 53 using namespace Inspector; 54 55 static bool asBool(const bool* b) 56 { 57 return b && *b; 58 } 57 59 58 60 PageRuntimeAgent::PageRuntimeAgent(PageAgentContext& context) … … 167 169 void PageRuntimeAgent::evaluate(ErrorString& errorString, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, const bool* emulateUserGesture, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex) 168 170 { 169 auto& pageChromeClient = m_inspectedPage.chrome().client(); 171 UserGestureEmulationScope userGestureScope(m_inspectedPage, asBool(emulateUserGesture)); 172 InspectorRuntimeAgent::evaluate(errorString, expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, executionContextId, returnByValue, generatePreview, saveResult, emulateUserGesture, result, wasThrown, savedResultIndex); 173 } 170 174 171 auto shouldEmulateUserGesture = emulateUserGesture && *emulateUserGesture; 172 173 Optional<ProcessingUserGestureState> userGestureState = shouldEmulateUserGesture ? Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt; 174 UserGestureIndicator gestureIndicator(userGestureState); 175 176 bool userWasInteracting = false; 177 if (shouldEmulateUserGesture) { 178 userWasInteracting = pageChromeClient.userIsInteracting(); 179 if (!userWasInteracting) 180 pageChromeClient.setUserIsInteracting(true); 181 } 182 183 InspectorRuntimeAgent::evaluate(errorString, expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, executionContextId, returnByValue, generatePreview, saveResult, emulateUserGesture, result, wasThrown, savedResultIndex); 184 185 if (shouldEmulateUserGesture && !userWasInteracting && pageChromeClient.userIsInteracting()) 186 pageChromeClient.setUserIsInteracting(false); 175 void PageRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* emulateUserGesture, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown) 176 { 177 UserGestureEmulationScope userGestureScope(m_inspectedPage, asBool(emulateUserGesture)); 178 InspectorRuntimeAgent::callFunctionOn(errorString, objectId, expression, optionalArguments, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, emulateUserGesture, result, wasThrown); 187 179 } 188 180 -
trunk/Source/WebCore/inspector/agents/page/PageRuntimeAgent.h
r251531 r251620 58 58 void disable(ErrorString&) override; 59 59 void evaluate(ErrorString&, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, const bool* emulateUserGesture, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex) override; 60 void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* emulateUserGesture, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown) override; 60 61 61 62 // InspectorInstrumentation
Note: See TracChangeset
for help on using the changeset viewer.