Changeset 202351 in webkit


Ignore:
Timestamp:
Jun 22, 2016 2:41:01 PM (8 years ago)
Author:
BJ Burg
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:
Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r202347 r202351  
     12016-06-22  Brian Burg  <bburg@apple.com>
     2
     3        Web Automation: Automation.inspectBrowsingContext should have an option to enable timeline auto-capturing
     4        https://bugs.webkit.org/show_bug.cgi?id=159004
     5        <rdar://problem/26931269>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        Automation.inspectBrowsingContext was added to make it easier to hit breakpoints inside of
     10        code evaluated using Automation.evaluateJavaScriptFunction. I recently changed the behavior
     11        of this command to automatically start profiling the page as soon as the inspector attached
     12        so that a full timeline recording could be obtained. However, starting a timeline recording
     13        turns off the debugger, so this command is not so useful for debugging right now.
     14
     15        Add a new option, enableAutoCapturing, to the inspectBrowsingContext command. Don't toggle
     16        profiling automatically unless this optional flag is present and set to true.
     17
     18        * UIProcess/Automation/Automation.json:
     19        * UIProcess/Automation/WebAutomationSession.cpp:
     20        (WebKit::WebAutomationSession::inspectBrowsingContext):
     21        (WebKit::WebAutomationSession::inspectorFrontendLoaded): Deleted.
     22        * UIProcess/Automation/WebAutomationSession.h:
     23
    1242016-06-22  Tim Horton  <timothy_horton@apple.com>
    225
  • trunk/Source/WebKit2/UIProcess/Automation/Automation.json

    r200702 r202351  
    298298            "description": "Inspect the specified browsing context using Web Inspector.",
    299299            "parameters": [
    300                 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be inspected." }
     300                { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be inspected." },
     301                { "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." }
    301302            ],
    302303            "async": true
  • trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp

    r200959 r202351  
    434434}
    435435
    436 void WebAutomationSession::inspectBrowsingContext(Inspector::ErrorString& errorString, const String& handle, Ref<InspectBrowsingContextCallback>&& callback)
     436void WebAutomationSession::inspectBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const bool* optionalEnableAutoCapturing, Ref<InspectBrowsingContextCallback>&& callback)
    437437{
    438438    WebPageProxy* page = webPageProxyForHandle(handle);
     
    446446    // Don't bring the inspector to front since this may be done automatically.
    447447    // We just want it loaded so it can pause if a breakpoint is hit during a command.
    448     if (page->inspector())
     448    if (page->inspector()) {
    449449        page->inspector()->connect();
     450
     451        // Start collecting profile information immediately so the entire session is captured.
     452        if (optionalEnableAutoCapturing && *optionalEnableAutoCapturing)
     453            page->inspector()->togglePageProfiling();
     454    }
    450455}
    451456
     
    460465    if (auto callback = m_pendingInspectorCallbacksPerPage.take(page.pageID()))
    461466        callback->sendSuccess(InspectorObject::create());
    462 
    463     // Start collecting profile information immediately so the entire session is captured.
    464     page.inspector()->togglePageProfiling();
    465467}
    466468
  • trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h

    r200702 r202351  
    106106    void goForwardInBrowsingContext(Inspector::ErrorString&, const String&, Ref<GoForwardInBrowsingContextCallback>&&) override;
    107107    void reloadBrowsingContext(Inspector::ErrorString&, const String&, Ref<ReloadBrowsingContextCallback>&&) override;
    108     void inspectBrowsingContext(Inspector::ErrorString&, const String&, Ref<InspectBrowsingContextCallback>&&) override;
     108    void inspectBrowsingContext(Inspector::ErrorString&, const String&, const bool* optionalEnableAutoCapturing, Ref<InspectBrowsingContextCallback>&&) override;
    109109    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;
    110110    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;
Note: See TracChangeset for help on using the changeset viewer.