UIWebView doesn't load iframe requests with custom urls on iOS 10

Originator:AlexSludnikov1
Number:rdar://30488958 Date Originated:13-Feb-2017
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 10
Classification:Other Bug Reproducible:Always
 
Area:
WebKit

Summary:
When loading iframe requests the delegate method of UIWebView - - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType gets about:blank url

Steps to Reproduce:
On XCode 8 iOS project create a UIWebView.

Inject the following JavaScript code to UIWebView - 

var iframe = document.createElement('iframe');
iframe.setAttribute('src', "myapp://" + msg);
iframe.setAttribute('style', 'display:none');
document.body.appendChild(iframe);
iframe.parentNode.removeChild(iframe);
iframe = null;

implement the UIWebView delegate method 

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request

Once the java script code is injected this method will be called and the request's url will be about.blank.

Expected Results:
I expect the request.url to be the custom url in the iframe's src (In our case 'myapp://SOME_MESSAGE')


Actual Results:
request.url is about.blank

Version:
All iOS 10 devices

Notes:


Configuration:
All iOS 10 devices.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!