WebKit Bugzilla
Attachment 362169 Details for
Bug 194725
: Allow emulation of user gestures from Web Inspector console
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194725-20190216103455.patch (text/plain), 26.55 KB, created by
Dean Jackson
on 2019-02-15 15:34:57 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Dean Jackson
Created:
2019-02-15 15:34:57 PST
Size:
26.55 KB
patch
obsolete
>Subversion Revision: 241444 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 2d9c0f04514f5320f716bde8238ce03e2740557b..f8d693b32b507da3a0f1c4380893771d0ce490ef 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,18 @@ >+2019-02-15 Dean Jackson <dino@apple.com> >+ >+ Allow emulation of user gestures from Web Inspector console >+ https://bugs.webkit.org/show_bug.cgi?id=194725 >+ <rdar://problem/48126604> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/agents/InspectorRuntimeAgent.cpp: Add a new optional parameter, emulateUserGesture, >+ to the evaluate function, and mark the function as override so that PageRuntimeAgent >+ can change the behaviour. >+ (Inspector::InspectorRuntimeAgent::evaluate): >+ * inspector/agents/InspectorRuntimeAgent.h: >+ * inspector/protocol/Runtime.json: >+ > 2019-02-13 Tadeu Zagallo <tzagallo@apple.com> > > CodeBlocks read from disk should not be re-written >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b5ddee82cdaa63f91b895c07870d23e0aae2d73c..966eb3f33dab67d5de5b326ea66dc4f3c55670c3 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2019-02-15 Dean Jackson <dino@apple.com> >+ >+ Allow emulation of user gestures from Web Inspector console >+ https://bugs.webkit.org/show_bug.cgi?id=194725 >+ <rdar://problem/48126604> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: inspector/runtime/evaluate-userGestureEmulation.html >+ >+ * inspector/agents/page/PageRuntimeAgent.cpp: Override the emulate method and create >+ a UserGestureIndicator based on the emulateUserGesture option. >+ (WebCore::PageRuntimeAgent::evaluate): >+ * inspector/agents/page/PageRuntimeAgent.h: >+ > 2019-02-13 Alex Christensen <achristensen@webkit.org> > > Stop using setDefersLoading from WebCore >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 141c11319e5358b97ac45c2d60b0e695fedbf44f..4ba476274b16d448545bc641301583771676604a 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,31 @@ >+2019-02-15 Dean Jackson <dino@apple.com> >+ >+ Allow emulation of user gestures from Web Inspector console >+ https://bugs.webkit.org/show_bug.cgi?id=194725 >+ <rdar://problem/48126604> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add some UI for emulating a User Gesture when evaluating in the console. This >+ allows the developer to do things that would otherwise require actual interaction >+ with the page, such as start playback of media on iOS. >+ >+ * Localizations/en.lproj/localizedStrings.js: >+ * UserInterface/Base/Setting.js: Add a new setting for this option. >+ * UserInterface/Controllers/JavaScriptLogViewController.js: >+ (WI.JavaScriptLogViewController.prototype.consolePromptTextCommitted): >+ * UserInterface/Controllers/RuntimeManager.js: Call evaluate with this new option. >+ (WI.RuntimeManager.prototype.evaluateInInspectedWindow): >+ * UserInterface/Views/LogContentView.js: Add a new checkbox in the upper bar >+ that allows the user to toggle the setting. >+ (WI.LogContentView): >+ (WI.LogContentView.prototype.get navigationItems): >+ (WI.LogContentView.prototype._executeInUserGestureSettingChanged): >+ >+ * UserInterface/Views/NetworkTableContentView.js: Two drive-by typo fixes :) >+ (WI.NetworkTableContentView): perserve -> preserve >+ (WI.NetworkTableContentView.prototype.get navigationItems): checkboxs -> checkboxes >+ > 2019-02-12 Joseph Pecoraro <pecoraro@apple.com> > > Web Inspector: Experimental setting for CPU Usage Timeline improvements >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp >index d68bb41b7e3c1921b6c999a247e45ba97853fd68..8bf9be4f6c216f5ce4395f403877390e19e584b9 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp >+++ b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp >@@ -111,7 +111,7 @@ void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Protoc > } > } > >-void InspectorRuntimeAgent::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, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex) >+void InspectorRuntimeAgent::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*, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex) > { > InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId); > if (injectedScript.hasNoValue()) >diff --git a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h >index b6e2ad08316e7fe389be6c75b9a1a3c5fe1e8ee5..ea63d0b2134794adbf4e591dc9e68571a96937db 100644 >--- a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h >+++ b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h >@@ -58,7 +58,7 @@ public: > void enable(ErrorString&) override { m_enabled = true; } > void disable(ErrorString&) override { m_enabled = false; } > void parse(ErrorString&, const String& expression, Protocol::Runtime::SyntaxErrorType* result, Optional<String>& message, RefPtr<Protocol::Runtime::ErrorRange>&) final; >- 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, RefPtr<Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex) final; >+ 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; > void awaitPromise(const String& promiseObjectId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, Ref<AwaitPromiseCallback>&&) final; > 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; > void releaseObject(ErrorString&, const ErrorString& objectId) final; >diff --git a/Source/JavaScriptCore/inspector/protocol/Runtime.json b/Source/JavaScriptCore/inspector/protocol/Runtime.json >index 42f0745aa1c21b0f98f8e48ac2238e874abab1df..6902b5ebee39d8e02ef7bb29df4b67d8a7b460eb 100644 >--- a/Source/JavaScriptCore/inspector/protocol/Runtime.json >+++ b/Source/JavaScriptCore/inspector/protocol/Runtime.json >@@ -217,7 +217,8 @@ > { "name": "contextId", "$ref": "Runtime.ExecutionContextId", "optional": true, "description": "Specifies in which isolated context to perform evaluation. Each content script lives in an isolated context and this parameter may be used to specify one of those contexts. If the parameter is omitted or 0 the evaluation will be performed in the context of the inspected page." }, > { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }, > { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for the result." }, >- { "name": "saveResult", "type": "boolean", "optional": true, "description": "Whether the resulting value should be considered for saving in the $n history." } >+ { "name": "saveResult", "type": "boolean", "optional": true, "description": "Whether the resulting value should be considered for saving in the $n history." }, >+ { "name": "emulateUserGesture", "type": "boolean", "optional": true, "description": "Whether the expression should be considered to be in a user gesture or not." } > ], > "returns": [ > { "name": "result", "$ref": "RemoteObject", "description": "Evaluation result." }, >diff --git a/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp b/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp >index 177367030e920afa2267e06a6eac8621f5b5bbce..28a3c7b22603120778c12195364ce669d0db973a 100644 >--- a/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp >+++ b/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp >@@ -42,6 +42,7 @@ > #include "ScriptController.h" > #include "ScriptState.h" > #include "SecurityOrigin.h" >+#include "UserGestureIndicator.h" > #include <JavaScriptCore/InjectedScript.h> > #include <JavaScriptCore/InjectedScriptManager.h> > >@@ -170,4 +171,16 @@ void PageRuntimeAgent::notifyContextCreated(const String& frameId, JSC::ExecStat > .release()); > } > >+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) >+{ >+ auto userGestureState = [&] () -> Optional<ProcessingUserGestureState> { >+ if (!emulateUserGesture) >+ return WTF::nullopt; >+ return *emulateUserGesture ? Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt; >+ }(); >+ >+ UserGestureIndicator gestureIndicator(userGestureState); >+ InspectorRuntimeAgent::evaluate(errorString, expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, executionContextId, returnByValue, generatePreview, saveResult, emulateUserGesture, result, wasThrown, savedResultIndex); >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/inspector/agents/page/PageRuntimeAgent.h b/Source/WebCore/inspector/agents/page/PageRuntimeAgent.h >index d80f927f2d6afd0101be2ef9cb7cf60691efc2c3..72a4b6cb515ba0b519bc355d0d3a6127ced20527 100644 >--- a/Source/WebCore/inspector/agents/page/PageRuntimeAgent.h >+++ b/Source/WebCore/inspector/agents/page/PageRuntimeAgent.h >@@ -58,6 +58,7 @@ public: > void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override; > void enable(ErrorString&) override; > void disable(ErrorString&) override; >+ 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) final; > > // InspectorInstrumentation > void didCreateMainWorldContext(Frame&); >diff --git a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >index b673168064d3ce4d7dda2263132ead19ee6b8533..c0d7efd323947bd8b6cfd41307dec38982dfce89 100644 >--- a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >+++ b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >@@ -412,6 +412,7 @@ localizedStrings["Event Dispatched"] = "Event Dispatched"; > localizedStrings["Event Listeners"] = "Event Listeners"; > localizedStrings["Events"] = "Events"; > localizedStrings["Example: \u201C%s\u201D"] = "Example: \u201C%s\u201D"; >+localizedStrings["Emulate User Gesture"] = "Emulate User Gesture"; > localizedStrings["Exception with thrown value: %s"] = "Exception with thrown value: %s"; > localizedStrings["Exited Full-Screen Mode"] = "Exited Full-Screen Mode"; > localizedStrings["Exited Low-Power Mode"] = "Exited Low-Power Mode"; >@@ -809,6 +810,7 @@ localizedStrings["Reveal in Original Resource"] = "Reveal in Original Resource"; > localizedStrings["Reveal in Resources Tab"] = "Reveal in Resources Tab"; > localizedStrings["Role"] = "Role"; > localizedStrings["Run %d"] = "Run %d"; >+localizedStrings["Run console commands as if inside a user gesture"] = "Run console commands as if inside a user gesture"; > localizedStrings["Running the \u201C%s\u201D audit"] = "Running the \u201C%s\u201D audit"; > localizedStrings["Samples"] = "Samples"; > localizedStrings["Save %d"] = "Save %d"; >diff --git a/Source/WebInspectorUI/UserInterface/Base/Setting.js b/Source/WebInspectorUI/UserInterface/Base/Setting.js >index 270cf26ff0483837964e6f7d8f01751d45bce13f..65d5447b08a8cd5e896cd035c7b86cbb4887bac8 100644 >--- a/Source/WebInspectorUI/UserInterface/Base/Setting.js >+++ b/Source/WebInspectorUI/UserInterface/Base/Setting.js >@@ -131,6 +131,7 @@ WI.settings = { > clearNetworkOnNavigate: new WI.Setting("clear-network-on-navigate", true), > enableControlFlowProfiler: new WI.Setting("enable-control-flow-profiler", false), > enableLineWrapping: new WI.Setting("enable-line-wrapping", false), >+ emulateInUserGesture: new WI.Setting("emulate-in-user-gesture", false), > groupByDOMNode: new WI.Setting("group-by-dom-node", false), > indentUnit: new WI.Setting("indent-unit", 4), > indentWithTabs: new WI.Setting("indent-with-tabs", false), >diff --git a/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js b/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js >index d293c14a2f830497125b8656be9635b81e40ff59..b7ec1e6bf462f8058a56f637971e1866cc402968 100644 >--- a/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js >+++ b/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js >@@ -242,6 +242,7 @@ WI.JavaScriptLogViewController = class JavaScriptLogViewController extends WI.Ob > returnByValue: false, > generatePreview: true, > saveResult: true, >+ emulateUserGesture: WI.settings.emulateInUserGesture.value, > sourceURLAppender: appendWebInspectorConsoleEvaluationSourceURL, > }; > >diff --git a/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js b/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js >index a71beeced20727d700dcf6913602d7be70c9f446..b339c0ea3c509d211f1aeaa7e881047194a9fe73 100644 >--- a/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js >+++ b/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js >@@ -81,13 +81,14 @@ WI.RuntimeManager = class RuntimeManager extends WI.Object > return; > } > >- let {objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, saveResult, sourceURLAppender} = options; >+ let {objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, saveResult, emulateUserGesture, sourceURLAppender} = options; > > includeCommandLineAPI = includeCommandLineAPI || false; > doNotPauseOnExceptionsAndMuteConsole = doNotPauseOnExceptionsAndMuteConsole || false; > returnByValue = returnByValue || false; > generatePreview = generatePreview || false; > saveResult = saveResult || false; >+ emulateUserGesture = emulateUserGesture || false; > sourceURLAppender = sourceURLAppender || appendWebInspectorSourceURL; > > console.assert(objectGroup, "RuntimeManager.evaluateInInspectedWindow should always be called with an objectGroup"); >@@ -137,7 +138,7 @@ WI.RuntimeManager = class RuntimeManager extends WI.Object > } > > // COMPATIBILITY (iOS 8): "saveResult" did not exist. >- target.RuntimeAgent.evaluate.invoke({expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, contextId: executionContextId, returnByValue, generatePreview, saveResult}, evalCallback.bind(this), target.RuntimeAgent); >+ target.RuntimeAgent.evaluate.invoke({expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, contextId: executionContextId, returnByValue, generatePreview, saveResult, emulateUserGesture}, evalCallback.bind(this), target.RuntimeAgent); > } > > saveResult(remoteObject, callback) >diff --git a/Source/WebInspectorUI/UserInterface/Views/LogContentView.js b/Source/WebInspectorUI/UserInterface/Views/LogContentView.js >index 1caca5c4d30bf9d153310511e3f56499503ace0a..1c15c3b71634cab4678caff755baf6bc87d3c7c7 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/LogContentView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/LogContentView.js >@@ -66,12 +66,17 @@ WI.LogContentView = class LogContentView extends WI.ContentView > this._selectedSearchMatch = null; > this._selectedSearchMatchIsValid = false; > >- this._preserveLogNavigationItem = new WI.CheckboxNavigationItem("perserve-log", WI.UIString("Preserve Log"), !WI.settings.clearLogOnNavigate.value); >+ this._preserveLogNavigationItem = new WI.CheckboxNavigationItem("preserve-log", WI.UIString("Preserve Log"), !WI.settings.clearLogOnNavigate.value); > this._preserveLogNavigationItem.tooltip = WI.UIString("Do not clear the console on new page loads"); > this._preserveLogNavigationItem.addEventListener(WI.CheckboxNavigationItem.Event.CheckedDidChange, () => { WI.settings.clearLogOnNavigate.value = !WI.settings.clearLogOnNavigate.value; }); > WI.settings.clearLogOnNavigate.addEventListener(WI.Setting.Event.Changed, this._clearLogOnNavigateSettingChanged, this); > >- this._checkboxsNavigationItemGroup = new WI.GroupNavigationItem([this._preserveLogNavigationItem, new WI.DividerNavigationItem]); >+ this._emulateInUserGestureNavigationItem = new WI.CheckboxNavigationItem("emulate-in-user-gesture", WI.UIString("Emulate User Gesture"), WI.settings.emulateInUserGesture.value); >+ this._emulateInUserGestureNavigationItem.tooltip = WI.UIString("Run console commands as if inside a user gesture"); >+ this._emulateInUserGestureNavigationItem.addEventListener(WI.CheckboxNavigationItem.Event.CheckedDidChange, () => { WI.settings.emulateInUserGesture.value = !WI.settings.emulateInUserGesture.value; }); >+ WI.settings.emulateInUserGesture.addEventListener(WI.Setting.Event.Changed, this._emulateInUserGestureSettingChanged, this); >+ >+ this._checkboxesNavigationItemGroup = new WI.GroupNavigationItem([this._preserveLogNavigationItem, this._emulateInUserGestureNavigationItem, new WI.DividerNavigationItem]); > > let scopeBarItems = [ > new WI.ScopeBarItem(WI.LogContentView.Scopes.All, WI.UIString("All"), {exclusive: true}), >@@ -136,7 +141,7 @@ WI.LogContentView = class LogContentView extends WI.ContentView > if (WI.isShowingSplitConsole()) > navigationItems.push(new WI.DividerNavigationItem, this._showConsoleTabNavigationItem); > else if (WI.isShowingConsoleTab()) >- navigationItems.unshift(this._findBanner, this._checkboxsNavigationItemGroup); >+ navigationItems.unshift(this._findBanner, this._checkboxesNavigationItemGroup); > > return navigationItems; > } >@@ -849,6 +854,11 @@ WI.LogContentView = class LogContentView extends WI.ContentView > this._preserveLogNavigationItem.checked = !WI.settings.clearLogOnNavigate.value; > } > >+ _executeInUserGestureSettingChanged() >+ { >+ this._executeInUserGestureNavigationItem.checked = WI.settings.executeInUserGesture.value; >+ } >+ > _keyDown(event) > { > let isRTL = WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL; >diff --git a/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js b/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js >index 43815af0131df9945095ce2187507f8f581c64ba..349e685761b84d0181b53948d62681aaf3dcd3f8 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js >@@ -103,7 +103,7 @@ WI.NetworkTableContentView = class NetworkTableContentView extends WI.ContentVie > > this._emptyFilterResultsMessageElement = null; > >- this._clearOnLoadNavigationItem = new WI.CheckboxNavigationItem("perserve-log", WI.UIString("Preserve Log"), !WI.settings.clearNetworkOnNavigate.value); >+ this._clearOnLoadNavigationItem = new WI.CheckboxNavigationItem("preserve-log", WI.UIString("Preserve Log"), !WI.settings.clearNetworkOnNavigate.value); > this._clearOnLoadNavigationItem.tooltip = WI.UIString("Do not clear network items on new page loads"); > this._clearOnLoadNavigationItem.addEventListener(WI.CheckboxNavigationItem.Event.CheckedDidChange, () => { WI.settings.clearNetworkOnNavigate.value = !WI.settings.clearNetworkOnNavigate.value; }); > WI.settings.clearNetworkOnNavigate.addEventListener(WI.Setting.Event.Changed, this._clearNetworkOnNavigateSettingChanged, this); >@@ -113,8 +113,8 @@ WI.NetworkTableContentView = class NetworkTableContentView extends WI.ContentVie > this._harExportNavigationItem.tooltip = WI.UIString("HAR Export (%s)").format(WI.saveKeyboardShortcut.displayName); > this._harExportNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, () => { this._exportHAR(); }); > >- this._checkboxsNavigationItemGroup = new WI.GroupNavigationItem([this._clearOnLoadNavigationItem, new WI.DividerNavigationItem]); >- this._checkboxsNavigationItemGroup.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low; >+ this._checkboxesNavigationItemGroup = new WI.GroupNavigationItem([this._clearOnLoadNavigationItem, new WI.DividerNavigationItem]); >+ this._checkboxesNavigationItemGroup.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low; > > this._buttonsNavigationItemGroup = new WI.GroupNavigationItem([this._harExportNavigationItem, new WI.DividerNavigationItem]); > this._buttonsNavigationItemGroup.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low; >@@ -207,7 +207,7 @@ WI.NetworkTableContentView = class NetworkTableContentView extends WI.ContentVie > > get navigationItems() > { >- let items = [this._checkboxsNavigationItemGroup, this._buttonsNavigationItemGroup]; >+ let items = [this._checkboxesNavigationItemGroup, this._buttonsNavigationItemGroup]; > if (this._disableResourceCacheNavigationItem) > items.push(this._disableResourceCacheNavigationItem); > items.push(this._clearNetworkItemsNavigationItem); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 52e92b4e5bf8611a60d023d08d5e4f24add1acf0..66885b9bd15df085390b738ed8e86e0daa95ca32 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-02-15 Dean Jackson <dino@apple.com> >+ >+ Allow emulation of user gestures from Web Inspector console >+ https://bugs.webkit.org/show_bug.cgi?id=194725 >+ <rdar://problem/48126604> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/runtime/evaluate-userGestureEmulation-expected.txt: Added. >+ * inspector/runtime/evaluate-userGestureEmulation.html: Added. >+ > 2019-02-13 Sihui Liu <sihui_liu@apple.com> > > Add two regression tests for reference cycle in IndexedDB >diff --git a/LayoutTests/inspector/runtime/evaluate-userGestureEmulation-expected.txt b/LayoutTests/inspector/runtime/evaluate-userGestureEmulation-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..778972d1cb5df3872bf221850c5cdf5b8800b73d >--- /dev/null >+++ b/LayoutTests/inspector/runtime/evaluate-userGestureEmulation-expected.txt >@@ -0,0 +1,9 @@ >+CONSOLE MESSAGE: line 37: Not in User Gesture >+CONSOLE MESSAGE: line 37: In User Gesture >+Tests for Runtime emulateUserGesture option. >+ >+ >+== Running test suite: Runtime.evaluateUserGestureEmulation >+-- Running test case: EvaluateWithoutEmulatingUserGesture >+-- Running test case: EvaluateWithEmulatingUserGesture >+ >diff --git a/LayoutTests/inspector/runtime/evaluate-userGestureEmulation.html b/LayoutTests/inspector/runtime/evaluate-userGestureEmulation.html >new file mode 100644 >index 0000000000000000000000000000000000000000..771a76b2a1c683e4fd6f1f1d9b168c35db23ee44 >--- /dev/null >+++ b/LayoutTests/inspector/runtime/evaluate-userGestureEmulation.html >@@ -0,0 +1,50 @@ >+<!doctype html> >+<html> >+<head> >+<script src="../../http/tests/inspector/resources/inspector-test.js"></script> >+<script> >+function test() >+{ >+ let suite = InspectorTest.createAsyncSuite("Runtime.evaluateUserGestureEmulation"); >+ >+ suite.addTestCase({ >+ name: "EvaluateWithoutEmulatingUserGesture", >+ description: "Evalute with the emulateUserGesture option set to false.", >+ test(resolve, reject) { >+ RuntimeAgent.evaluate.invoke({expression: "document.getElementById('foo').click()", objectGroup: "test", emulateUserGesture: false}, (error) => { >+ InspectorTest.assert(!error, "Should not be a protocol error."); >+ resolve(); >+ }); >+ } >+ }); >+ >+ suite.addTestCase({ >+ name: "EvaluateWithEmulatingUserGesture", >+ description: "Evalute with the emulateUserGesture option set to true.", >+ test(resolve, reject) { >+ RuntimeAgent.evaluate.invoke({expression: "document.getElementById('foo').click()", objectGroup: "test", emulateUserGesture: true}, (error) => { >+ InspectorTest.assert(!error, "Should not be a protocol error."); >+ resolve(); >+ }); >+ } >+ }); >+ >+ suite.runTestCasesAndFinish(); >+} >+ >+function handleClick(event) { >+ if (window.internals) >+ console.log(window.internals.isProcessingUserGesture() ? "In User Gesture" : "Not in User Gesture"); >+} >+ >+window.addEventListener("load", function () { >+ document.getElementById("foo").addEventListener("click", handleClick, false) >+ runTest(); >+}, false); >+</script> >+</head> >+<body> >+<a id="foo"></a> >+<p>Tests for Runtime emulateUserGesture option.</p> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
joepeck
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194725
: 362169