Merge branch 'CB-8863'

This commit is contained in:
Jesse MacFadyen 2015-11-17 13:03:39 -08:00
commit 8fb2244432

View File

@ -214,14 +214,17 @@
_previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
CDVInAppBrowserNavigationController* nav = [[CDVInAppBrowserNavigationController alloc] __block CDVInAppBrowserNavigationController* nav = [[CDVInAppBrowserNavigationController alloc]
initWithRootViewController:self.inAppBrowserViewController]; initWithRootViewController:self.inAppBrowserViewController];
nav.orientationDelegate = self.inAppBrowserViewController; nav.orientationDelegate = self.inAppBrowserViewController;
nav.navigationBarHidden = YES; nav.navigationBarHidden = YES;
__weak CDVInAppBrowser* weakSelf = self;
// Run later to avoid the "took a long time" log message. // Run later to avoid the "took a long time" log message.
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (self.inAppBrowserViewController != nil) { if (weakSelf.inAppBrowserViewController != nil) {
[self.viewController presentViewController:nav animated:YES completion:nil]; [weakSelf.viewController presentViewController:nav animated:YES completion:nil];
} }
}); });
} }
@ -755,12 +758,14 @@
[self.navigationDelegate browserExit]; [self.navigationDelegate browserExit];
} }
__weak UIViewController* weakSelf = self;
// Run later to avoid the "took a long time" log message. // Run later to avoid the "took a long time" log message.
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if ([self respondsToSelector:@selector(presentingViewController)]) { if ([weakSelf respondsToSelector:@selector(presentingViewController)]) {
[[self presentingViewController] dismissViewControllerAnimated:YES completion:nil]; [[weakSelf presentingViewController] dismissViewControllerAnimated:YES completion:nil];
} else { } else {
[[self parentViewController] dismissViewControllerAnimated:YES completion:nil]; [[weakSelf parentViewController] dismissViewControllerAnimated:YES completion:nil];
} }
}); });
} }
@ -772,10 +777,11 @@
if (_userAgentLockToken != 0) { if (_userAgentLockToken != 0) {
[self.webView loadRequest:request]; [self.webView loadRequest:request];
} else { } else {
__weak CDVInAppBrowser* weakSelf = self;
[CDVUserAgentUtil acquireLock:^(NSInteger lockToken) { [CDVUserAgentUtil acquireLock:^(NSInteger lockToken) {
_userAgentLockToken = lockToken; _userAgentLockToken = lockToken;
[CDVUserAgentUtil setUserAgent:_userAgent lockToken:lockToken]; [CDVUserAgentUtil setUserAgent:_userAgent lockToken:lockToken];
[self.webView loadRequest:request]; [weakSelf.webView loadRequest:request];
}]; }];
} }
} }