CB-9445 Improves executeScript callbacks on iOS

This closes #125

Signed-off-by: Shazron Abdullah <shazron@apache.org>
This commit is contained in:
sgrebnov 2015-11-20 19:15:55 +03:00 committed by Shazron Abdullah
parent 290ea0ac9c
commit 65821f907d
2 changed files with 2 additions and 7 deletions

View File

@ -30,7 +30,6 @@
@class CDVInAppBrowserViewController;
@interface CDVInAppBrowser : CDVPlugin {
BOOL _injectedIframeBridge;
}
@property (nonatomic, retain) CDVInAppBrowserViewController* inAppBrowserViewController;

View File

@ -266,11 +266,8 @@
- (void)injectDeferredObject:(NSString*)source withWrapper:(NSString*)jsWrapper
{
if (!_injectedIframeBridge) {
_injectedIframeBridge = YES;
// Create an iframe bridge in the new document to communicate with the CDVInAppBrowserViewController
[self.inAppBrowserViewController.webView stringByEvaluatingJavaScriptFromString:@"(function(d){var e = _cdvIframeBridge = d.createElement('iframe');e.style.display='none';d.body.appendChild(e);})(document)"];
}
// Ensure an iframe bridge is created to communicate with the CDVInAppBrowserViewController
[self.inAppBrowserViewController.webView stringByEvaluatingJavaScriptFromString:@"(function(d){_cdvIframeBridge=d.getElementById('_cdvIframeBridge');if(!_cdvIframeBridge) {var e = _cdvIframeBridge = d.createElement('iframe');e.id='_cdvIframeBridge'; e.style.display='none';d.body.appendChild(e);}})(document)"];
if (jsWrapper != nil) {
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:@[source] options:0 error:nil];
@ -407,7 +404,6 @@
- (void)webViewDidStartLoad:(UIWebView*)theWebView
{
_injectedIframeBridge = NO;
}
- (void)webViewDidFinishLoad:(UIWebView*)theWebView