Skip to content

Commit

Permalink
Remove WebViewJavascriptBridge -reset method. It is unreliable and …
Browse files Browse the repository at this point in the history
…should not be used. See GH issue marcuswestin#99
  • Loading branch information
marcuswestin committed Aug 27, 2014
1 parent 646def3 commit dcecc11
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Release Checklist
Version History
---------------

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

v4.1.4
+ Improve how WVJB handles the case when there is no ObjC handler for a message received from js.
+ If an objc handler throws and exception, let it bubble up to the webkit engine instead of catching it in WVJB.
Expand Down
1 change: 0 additions & 1 deletion WebViewJavascriptBridge/WebViewJavascriptBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,5 @@ typedef void (^WVJBHandler)(id data, WVJBResponseCallback responseCallback);
- (void)callHandler:(NSString*)handlerName;
- (void)callHandler:(NSString*)handlerName data:(id)data;
- (void)callHandler:(NSString*)handlerName data:(id)data responseCallback:(WVJBResponseCallback)responseCallback;
- (void)reset;

@end
16 changes: 9 additions & 7 deletions WebViewJavascriptBridge/WebViewJavascriptBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ + (instancetype)bridgeForWebView:(WVJB_WEBVIEW_TYPE*)webView webViewDelegate:(WV
{
WebViewJavascriptBridge* bridge = [[WebViewJavascriptBridge alloc] init];
[bridge _platformSpecificSetup:webView webViewDelegate:webViewDelegate handler:messageHandler resourceBundle:bundle];
[bridge reset];
return bridge;
}

Expand Down Expand Up @@ -79,15 +78,18 @@ - (void)registerHandler:(NSString *)handlerName handler:(WVJBHandler)handler {
_messageHandlers[handlerName] = [handler copy];
}

- (void)reset {
_startupMessageQueue = [NSMutableArray array];
_responseCallbacks = [NSMutableDictionary dictionary];
_uniqueId = 0;
}

/* Platform agnostic internals
*****************************/

- (id)init {
if (self = [super init]) {
_startupMessageQueue = [NSMutableArray array];
_responseCallbacks = [NSMutableDictionary dictionary];
_uniqueId = 0;
}
return self;
}

- (void)dealloc {
[self _platformSpecificDealloc];

Expand Down

0 comments on commit dcecc11

Please sign in to comment.