Chromium Code Reviews| 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 |