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

Unified Diff: ios/web/public/test/crw_test_js_injection_receiver.mm

Issue 1423483004: Updated TODO(shreyasv) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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/public/test/crw_test_js_injection_receiver.mm
diff --git a/ios/web/public/test/crw_test_js_injection_receiver.mm b/ios/web/public/test/crw_test_js_injection_receiver.mm
index 692dd96d9602d2bc0fca82af8d15383d7810fb89..32f283616a1e37a2a22ca356d7d907a5bd9b8740 100644
--- a/ios/web/public/test/crw_test_js_injection_receiver.mm
+++ b/ios/web/public/test/crw_test_js_injection_receiver.mm
@@ -6,6 +6,7 @@
#import <UIKit/UIKit.h>
+#include "base/ios/weak_nsobject.h"
#import "base/mac/scoped_nsobject.h"
#import "ios/web/public/web_state/js/crw_js_injection_evaluator.h"
@@ -27,11 +28,11 @@
- (void)evaluateJavaScript:(NSString*)script
stringResultHandler:(web::JavaScriptCompletion)handler {
+ base::WeakNSObject<CRWTestUIWebViewEvaluator> weakEvaluator(self);
Eugene But (OOO till 7-30) 2015/10/22 00:12:02 NIT: s/weakEvaluator/weakSelf since we usually cal
shreyasv1 2015/10/22 00:33:59 Acknowledged.
dispatch_async(dispatch_get_main_queue(), ^{
- // TODO(shreyasv): Change to weaknsobject once weaknsobject is moved to
- // ios/base.
+ UIWebView* webView = weakEvaluator ? weakEvaluator->_webView : nil;
sdefresne 2015/10/22 03:17:33 Looks like you need the following to fix the compi
shreyasv1 2015/10/22 17:08:26 Done.
NSString* result =
- [_webView stringByEvaluatingJavaScriptFromString:script];
+ [webView stringByEvaluatingJavaScriptFromString:script];
if (handler)
handler(result, nil);
});

Powered by Google App Engine
This is Rietveld 408576698