Bug 159777 - Web Automation: FrameNotFound errors happen a lot for the main frame
Summary: Web Automation: FrameNotFound errors happen a lot for the main frame
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Normal
Assignee: Timothy Hatcher
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-07-14 12:43 PDT by Timothy Hatcher
Modified: 2016-07-14 14:53 PDT (History)
7 users (show)

See Also:


Attachments
Patch (31.03 KB, patch)
2016-07-14 12:46 PDT, Timothy Hatcher
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.

<rdar://problem/27224628>
Comment 1 Timothy Hatcher 2016-07-14 12:46:04 PDT
Created attachment 283668 [details]
Patch
Comment 2 BJ Burg 2016-07-14 14:32:31 PDT
Comment on attachment 283668 [details]
Patch

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

r=me

> 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]
Patch

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.