Bug 159777

Summary: Web Automation: FrameNotFound errors happen a lot for the main frame
Product: WebKit Reporter: Timothy Hatcher <timothy>
Component: Web InspectorAssignee: Timothy Hatcher <timothy>
Severity: Normal CC: bburg, commit-queue, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: All   
OS: All   
Description Flags
Patch none

Description Timothy Hatcher 2016-07-14 12:43:49 PDT
WebAutomationSession::webFrameProxyForHandle is returning nullptr for empty handles (main frame), when we need a frame. That causes the FrameNotFound error.

This is a race between a page being created and the main frame being created. WebPage sends a DidCreateMainFrame message, until that is sent we don’t have a frameID for the main frame and we can’t send our evaluateJavaScript message (or other messages with just frameID).

We need to send both pageID and frameID, and have the WebProcess side resolve the mainFrame from 0 based on the known pageID.

Comment 1 Timothy Hatcher 2016-07-14 12:46:04 PDT
Created attachment 283668 [details]
Comment 2 BJ Burg 2016-07-14 14:32:31 PDT
Comment on attachment 283668 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=283668&action=review


> Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp:766
> +    // Always send the main frame ID as 0 so it is resolved on the WebProcess side. This avoids a race when page->mainFrame() is null still.

Nit: 'still null'
Comment 3 WebKit Commit Bot 2016-07-14 14:53:41 PDT
Comment on attachment 283668 [details]

Clearing flags on attachment: 283668

Committed r203245: <http://trac.webkit.org/changeset/203245>
Comment 4 WebKit Commit Bot 2016-07-14 14:53:46 PDT
All reviewed patches have been landed.  Closing bug.