Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(821)

Unified Diff: ios/web/web_state/ui/crw_wk_script_message_router.mm

Issue 1516303002: Adds support for POST request with bodies on WKWebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/web/web_state/ui/crw_wk_script_message_router.mm
diff --git a/ios/web/web_state/ui/crw_wk_script_message_router.mm b/ios/web/web_state/ui/crw_wk_script_message_router.mm
index 5699abdfb92067217ee1189e988c8afada72153d..0e1dfbb33e0dd333119542563b4cbd246663c9b7 100644
--- a/ios/web/web_state/ui/crw_wk_script_message_router.mm
+++ b/ios/web/web_state/ui/crw_wk_script_message_router.mm
@@ -100,8 +100,12 @@
- (void)tryRemoveScriptMessageHandlerForName:(NSString*)messageName
webView:(WKWebView*)webView {
NSMapTable* webViewToHandlerMap = [_handlers objectForKey:messageName];
- if (![webViewToHandlerMap objectForKey:webView])
+ id handler = [webViewToHandlerMap objectForKey:webView];
+ if (!handler)
return;
+ // Extend the lifetime of |handler| so removeScriptMessageHandlerForName: can
+ // be called from inside of |handler|.
+ [[handler retain] autorelease];
if (webViewToHandlerMap.count == 1) {
[_handlers removeObjectForKey:messageName];
[_userContentController removeScriptMessageHandlerForName:messageName];
« no previous file with comments | « ios/web/web_state/js/resources/post_request.js ('k') | ios/web/web_state/ui/crw_wk_web_view_web_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698