<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add an option to run-webkit-tests to wait for a connected remote inspector frontend before running"
   href="https://bugs.webkit.org/show_bug.cgi?id=147069">147069</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Add an option to run-webkit-tests to wait for a connected remote inspector frontend before running
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>528+ (Nightly build)
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Tools / Tests
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>burg&#64;cs.washington.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>andersca&#64;apple.com, ap&#64;webkit.org, dbates&#64;webkit.org, ddkilzer&#64;webkit.org, joepeck&#64;webkit.org, sam&#64;webkit.org, timothy&#64;apple.com, tobi+webkit&#64;basecode.de
          </td>
        </tr>

        <tr>
          <th>Depends on</th>
          <td>147068
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>147066
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This bug is too big for one patch, but I'll put all my notes here until I actually start making progress.

--

Everyone wastes a lot of time adding logging to layout tests to debug what's going on. Simply using the web inspector would make simple mistakes very obvious and save unnecessary logging. Debugging a layout test in this way should be as simple as passing an extra flag to run-webkit-tests to make the test runner hold off until an inspector is attached by the developer.

Even if a test page under WebKitTestRunner can be remote inspected, it won't be much good unless a developer can attach the Web Inspector before the test() method starts to run. This is typically attached to the test page's &quot;load&quot; event.

To do this in WKTR, there needs to be some sort of notification available to its InjectedBundle that an inspector frontend has been connected or not, and whether its local (part of the test) or remote (developer-initiated).

Connecting the frontend is performed in the various InspectorController classes. These connection events are not currently propagated up into WK2, but it would be easy to do so using InspectorClient. Similarly, there are no relevant events in any bundle client, so these events would need to be added to a new or existing bundle client so WKTR can get at them.

Inspecting a layout test that uses the web inspector will be a bit more complicated, because there is only a single FrontendConnection per inspected page. We would need to add a second 'diagnostic' frontend connection and revisit code that assumes there's only one frontend open at a time. For the most part, it seems that events would be duplicated to all frontends and command responses would be threaded to the originating connection.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>