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

Unified Diff: ios/chrome/browser/ui/browser_view_controller.mm

Issue 2646003002: [ios] Remove the openJavascript method from Tab. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « ios/chrome/browser/tabs/tab.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/browser_view_controller.mm
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm
index af75824e2ee01794856eb8717e2f8076bebf0294..6734972d92d8f334056ae2f17be19cd65972548b 100644
--- a/ios/chrome/browser/ui/browser_view_controller.mm
+++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -3787,7 +3787,12 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver {
}
- (void)openJavascript:(NSString*)javascript {
- [[_model currentTab] openJavascript:javascript];
+ DCHECK(javascript);
+ javascript = [javascript stringByRemovingPercentEncoding];
rohitrao (ping after 24h) 2017/01/19 21:59:09 Is this sanitization important?
Eugene But (OOO till 7-30) 2017/01/19 22:20:33 I don't know.
+ web::WebState* web_state = [[_model currentTab] webState];
Eugene But (OOO till 7-30) 2017/01/19 22:20:34 s/web_state/webState
rohitrao (ping after 24h) 2017/01/20 16:12:17 Done.
+ if (web_state) {
+ web_state->ExecuteJavaScript(base::SysNSStringToUTF16(javascript));
rohitrao (ping after 24h) 2017/01/19 21:59:09 This is a little dumb because we go from UTF8 -> N
Eugene But (OOO till 7-30) 2017/01/19 22:20:33 This is user supplied JS. I don't think they can t
rohitrao (ping after 24h) 2017/01/20 16:12:17 This is not actually true. The JS supplied here c
Eugene But (OOO till 7-30) 2017/01/20 18:05:18 So maybe we should change WebState::ExecuteJavaScr
+ }
}
#pragma mark - WebToolbarDelegate methods
« no previous file with comments | « ios/chrome/browser/tabs/tab.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698