Bug 174622 - Web Automation: pending evaluate script callbacks are stored with the wrong frame ID when using the default main frame
Summary: Web Automation: pending evaluate script callbacks are stored with the wrong f...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-07-18 04:01 PDT by Carlos Garcia Campos
Modified: 2017-07-18 23:07 PDT (History)
3 users (show)

See Also:


Attachments
Patch (3.43 KB, patch)
2017-07-18 04:05 PDT, Carlos Garcia Campos
bburg: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2017-07-18 04:01:08 PDT
The frameHandle argument is optional in evaluateJavaScriptFunction(), when not provided we pass 0 to the web process. Then, the proxy gets the web page main frame when received frame ID is 0, but the given frameID is still used as key of m_webFramePendingEvaluateJavaScriptCallbacksMap and also passed to the javascript function as argument. I think r203442 was actually a workaround to this bug, making it even more hidden. m_webFrameScriptObjectMap and m_webFramePendingEvaluateJavaScriptCallbacksMap should never have a 0 as key, since the always use a frame ID and the frame identifier counter starts at 1. This is causing test testShouldDetectPageLoadsWhileWaitingOnAnAsyncScriptAndReturnAnError to hang, because when the page is unloaded and didClearWindowObjectForFrame is called, we try to get the pending callbacks of frame 1, but they were stored as frame 0 so DidEvaluateJavaScriptFunction message is never sent to the Ui process.
Comment 1 Carlos Garcia Campos 2017-07-18 04:05:46 PDT
Created attachment 315789 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2017-07-18 15:32:40 PDT
<rdar://problem/33387829>
Comment 3 BJ Burg 2017-07-18 15:36:38 PDT
Comment on attachment 315789 [details]
Patch

r=me

Great catch!
Comment 4 Carlos Garcia Campos 2017-07-18 23:07:10 PDT
Committed r219649: <http://trac.webkit.org/changeset/219649>