Skip to content

Commit

Permalink
Use explicit WVJB_WEBVIEW_DELEGATE_TYPE instead of inferred `typeof…
Browse files Browse the repository at this point in the history
…(_webViewDelegate)`. Should hopefully fix GH issues marcuswestin#81 and marcuswestin#98
  • Loading branch information
marcuswestin committed Aug 27, 2014
1 parent dcecc11 commit 5f10f81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Version History

Intended v5.0.0
+ Removed `WebViewJavascriptBridge -reset`. It should never have been exposed as a public API.
+ Fixed compilation in C99 mode

v4.1.4
+ Improve how WVJB handles the case when there is no ObjC handler for a message received from js.
Expand Down
8 changes: 4 additions & 4 deletions WebViewJavascriptBridge/WebViewJavascriptBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView {
_startupMessageQueue = nil;
}

__strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate;
__strong WVJB_WEBVIEW_DELEGATE_TYPE* strongDelegate = _webViewDelegate;
if (strongDelegate && [strongDelegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
[strongDelegate webViewDidFinishLoad:webView];
}
Expand All @@ -367,7 +367,7 @@ - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {

_numRequestsLoading--;

__strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate;
__strong WVJB_WEBVIEW_DELEGATE_TYPE* strongDelegate = _webViewDelegate;
if (strongDelegate && [strongDelegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
[strongDelegate webView:webView didFailLoadWithError:error];
}
Expand All @@ -376,7 +376,7 @@ - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if (webView != _webView) { return YES; }
NSURL *url = [request URL];
__strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate;
__strong WVJB_WEBVIEW_DELEGATE_TYPE* strongDelegate = _webViewDelegate;
if ([[url scheme] isEqualToString:kCustomProtocolScheme]) {
if ([[url host] isEqualToString:kQueueHasMessage]) {
[self _flushMessageQueue];
Expand All @@ -396,7 +396,7 @@ - (void)webViewDidStartLoad:(UIWebView *)webView {

_numRequestsLoading++;

__strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate;
__strong WVJB_WEBVIEW_DELEGATE_TYPE* strongDelegate = _webViewDelegate;
if (strongDelegate && [strongDelegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
[strongDelegate webViewDidStartLoad:webView];
}
Expand Down

0 comments on commit 5f10f81

Please sign in to comment.