We currently often have to use different UIClient callbacks for the main page and for other pages. The reason for this is that the callbacks for the main page are passed the Controller as clientInfo, while the other pages callbacks are passed the PlatformWebView as clientInfo. This causes code duplication and it is error prone. Someone may not pay attention to this detail and use the same callback for both the main view and the other views, and therefore not properly cast the clientInfo callback argument. As a matter of fact, the existing runModal() callback is wrong: it is used for both the Main page UIClient and the other pages UIClient. However, the callback unconditionally casts clientInfo to a PlatformWebView (which is wrong for the main page). I propose that we have a TestController as clientInfo for other pages UIClient callbacks, for consistency and to avoid useless code duplication. We just need to introduce a static HashTable so that we can retrieve the PlatformWebView corresponding to a given page in those callbacks.
Created attachment 167302 [details] Patch
Comment on attachment 167302 [details] Patch I will try the pass the main view for the main page callbacks instead.
Created attachment 167314 [details] Patch Much simpler proposal.
Comment on attachment 167314 [details] Patch Clearing flags on attachment: 167314 Committed r130515: <http://trac.webkit.org/changeset/130515>
All reviewed patches have been landed. Closing bug.