Skip to content
Permalink
Browse files
Web Automation: Automation.inspectBrowsingContext should have an opti…
…on 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:

Canonical link: https://commits.webkit.org/177118@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
burg committed Jun 22, 2016
1 parent 50e007e commit 79bd11d7e629be72d7d13ce093db6ddbae0203fd
@@ -1,3 +1,26 @@
2016-06-22 Brian Burg <bburg@apple.com>

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 <timothy_horton@apple.com>

Mail snapshot has black webview in multitasking switcher
@@ -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
},
@@ -433,7 +433,7 @@ void WebAutomationSession::reloadBrowsingContext(Inspector::ErrorString& errorSt
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 @@ void WebAutomationSession::inspectBrowsingContext(Inspector::ErrorString& errorS

// 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 @@ void WebAutomationSession::inspectorFrontendLoaded(const WebPageProxy& page)
{
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)
@@ -105,7 +105,7 @@ class WebAutomationSession final : public API::ObjectImpl<API::Object::Type::Aut
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;

0 comments on commit 79bd11d

Please sign in to comment.