- Revision
- 202351
- Author
- [email protected]
- Date
- 2016-06-22 14:41:01 -0700 (Wed, 22 Jun 2016)
Log Message
Web Automation: Automation.inspectBrowsingContext should have an option to enable timeline auto-capturing
https://bugs.webkit.org/show_bug.cgi?id=159004
<rdar://problem/26931269>
Reviewed by Joseph Pecoraro.
Automation.inspectBrowsingContext was added to make it easier to hit breakpoints inside of
code evaluated using Automation.evaluateJavaScriptFunction. I recently changed the behavior
of this command to automatically start profiling the page as soon as the inspector attached
so that a full timeline recording could be obtained. However, starting a timeline recording
turns off the debugger, so this command is not so useful for debugging right now.
Add a new option, enableAutoCapturing, to the inspectBrowsingContext command. Don't toggle
profiling automatically unless this optional flag is present and set to true.
* UIProcess/Automation/Automation.json:
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::inspectBrowsingContext):
(WebKit::WebAutomationSession::inspectorFrontendLoaded): Deleted.
* UIProcess/Automation/WebAutomationSession.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (202350 => 202351)
--- trunk/Source/WebKit2/ChangeLog 2016-06-22 21:17:29 UTC (rev 202350)
+++ trunk/Source/WebKit2/ChangeLog 2016-06-22 21:41:01 UTC (rev 202351)
@@ -1,3 +1,26 @@
+2016-06-22 Brian Burg <[email protected]>
+
+ Web Automation: Automation.inspectBrowsingContext should have an option to enable timeline auto-capturing
+ https://bugs.webkit.org/show_bug.cgi?id=159004
+ <rdar://problem/26931269>
+
+ Reviewed by Joseph Pecoraro.
+
+ Automation.inspectBrowsingContext was added to make it easier to hit breakpoints inside of
+ code evaluated using Automation.evaluateJavaScriptFunction. I recently changed the behavior
+ of this command to automatically start profiling the page as soon as the inspector attached
+ so that a full timeline recording could be obtained. However, starting a timeline recording
+ turns off the debugger, so this command is not so useful for debugging right now.
+
+ Add a new option, enableAutoCapturing, to the inspectBrowsingContext command. Don't toggle
+ profiling automatically unless this optional flag is present and set to true.
+
+ * UIProcess/Automation/Automation.json:
+ * UIProcess/Automation/WebAutomationSession.cpp:
+ (WebKit::WebAutomationSession::inspectBrowsingContext):
+ (WebKit::WebAutomationSession::inspectorFrontendLoaded): Deleted.
+ * UIProcess/Automation/WebAutomationSession.h:
+
2016-06-22 Tim Horton <[email protected]>
Mail snapshot has black webview in multitasking switcher
Modified: trunk/Source/WebKit2/UIProcess/Automation/Automation.json (202350 => 202351)
--- trunk/Source/WebKit2/UIProcess/Automation/Automation.json 2016-06-22 21:17:29 UTC (rev 202350)
+++ trunk/Source/WebKit2/UIProcess/Automation/Automation.json 2016-06-22 21:41:01 UTC (rev 202351)
@@ -297,7 +297,8 @@
"name": "inspectBrowsingContext",
"description": "Inspect the specified browsing context using Web Inspector.",
"parameters": [
- { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be inspected." }
+ { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be inspected." },
+ { "name": "enableAutoCapturing", "type": "boolean", "optional": true, "description": "If this option is present and set to true, the Web Inspector will automatically start a timeline recording of the specified browsing context once it is attached. Note that this disables the debugger for the duration of the recording." }
],
"async": true
},
Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (202350 => 202351)
--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp 2016-06-22 21:17:29 UTC (rev 202350)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp 2016-06-22 21:41:01 UTC (rev 202351)
@@ -433,7 +433,7 @@
page->reload(reloadFromOrigin, contentBlockersEnabled);
}
-void WebAutomationSession::inspectBrowsingContext(Inspector::ErrorString& errorString, const String& handle, Ref<InspectBrowsingContextCallback>&& callback)
+void WebAutomationSession::inspectBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const bool* optionalEnableAutoCapturing, Ref<InspectBrowsingContextCallback>&& callback)
{
WebPageProxy* page = webPageProxyForHandle(handle);
if (!page)
@@ -445,8 +445,13 @@
// Don't bring the inspector to front since this may be done automatically.
// We just want it loaded so it can pause if a breakpoint is hit during a command.
- if (page->inspector())
+ if (page->inspector()) {
page->inspector()->connect();
+
+ // Start collecting profile information immediately so the entire session is captured.
+ if (optionalEnableAutoCapturing && *optionalEnableAutoCapturing)
+ page->inspector()->togglePageProfiling();
+ }
}
void WebAutomationSession::navigationOccurredForPage(const WebPageProxy& page)
@@ -459,9 +464,6 @@
{
if (auto callback = m_pendingInspectorCallbacksPerPage.take(page.pageID()))
callback->sendSuccess(InspectorObject::create());
-
- // Start collecting profile information immediately so the entire session is captured.
- page.inspector()->togglePageProfiling();
}
void WebAutomationSession::evaluateJavaScriptFunction(Inspector::ErrorString& errorString, const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const Inspector::InspectorArray& arguments, const bool* optionalExpectsImplicitCallbackArgument, const int* optionalCallbackTimeout, Ref<EvaluateJavaScriptFunctionCallback>&& callback)
Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h (202350 => 202351)
--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h 2016-06-22 21:17:29 UTC (rev 202350)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h 2016-06-22 21:41:01 UTC (rev 202351)
@@ -105,7 +105,7 @@
void goBackInBrowsingContext(Inspector::ErrorString&, const String&, Ref<GoBackInBrowsingContextCallback>&&) override;
void goForwardInBrowsingContext(Inspector::ErrorString&, const String&, Ref<GoForwardInBrowsingContextCallback>&&) override;
void reloadBrowsingContext(Inspector::ErrorString&, const String&, Ref<ReloadBrowsingContextCallback>&&) override;
- void inspectBrowsingContext(Inspector::ErrorString&, const String&, Ref<InspectBrowsingContextCallback>&&) override;
+ void inspectBrowsingContext(Inspector::ErrorString&, const String&, const bool* optionalEnableAutoCapturing, Ref<InspectBrowsingContextCallback>&&) override;
void evaluateJavaScriptFunction(Inspector::ErrorString&, const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const Inspector::InspectorArray& arguments, const bool* optionalExpectsImplicitCallbackArgument, const int* optionalCallbackTimeout, Ref<Inspector::AutomationBackendDispatcherHandler::EvaluateJavaScriptFunctionCallback>&&) override;
void performMouseInteraction(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& requestedPosition, const String& mouseButton, const String& mouseInteraction, const Inspector::InspectorArray& keyModifiers, RefPtr<Inspector::Protocol::Automation::Point>& updatedPosition) override;
void performKeyboardInteractions(Inspector::ErrorString&, const String& handle, const Inspector::InspectorArray& interactions) override;