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

Issue 2581883002: [ios] Do not JSON encode messages sent from WebView to native code. (Closed)

Created:
4 years ago by Eugene But (OOO till 7-30)
Modified:
4 years ago
Reviewers:
kkhorimoto, sdefresne
CC:
chromium-reviews, Olivier, Justin Donnelly
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[ios] Do not JSON encode messages sent from WebView to native code. UIWebView did not have API for JS -> Native code messaging and communication was implemented using iframes with custom URL schemes and messages were encoded into URL as JSON. WKWebView allows sending messages between JS and native code and there is no need to encode messages into JSON, so they can be decoded in the native code. This change should improve the performance and security as decoding JSON format can be a source of security vulnerabilities. Since WKWebView sends all numbers as doubles (kCFNumberDoubleType) clients should extract them as doubles, not as integers. BUG=579697 Committed: https://crrev.com/cbc1a720e8e6b094f30b58c653fe97b32cd4dcdd Cr-Commit-Position: refs/heads/master@{#440123}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Addressed review comment #

Total comments: 2

Patch Set 3 : Actually addressed review comments :) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+35 lines, -40 lines) Patch
M components/translate/ios/browser/language_detection_controller.mm View 1 chunk +2 lines, -2 lines 0 comments Download
M ios/web/web_state/js/resources/message.js View 1 chunk +4 lines, -6 lines 0 comments Download
M ios/web/web_state/ui/crw_web_controller.mm View 1 2 9 chunks +29 lines, -32 lines 0 comments Download

Messages

Total messages: 27 (12 generated)
Eugene But (OOO till 7-30)
I would like to remove unnecessary JSON encoding from JS -> Native messages. This should ...
4 years ago (2016-12-16 03:40:00 UTC) #5
sdefresne
I probably won't have time to look at this CL before middle of next week.
4 years ago (2016-12-16 17:39:24 UTC) #9
Eugene But (OOO till 7-30)
On 2016/12/16 17:39:24, sdefresne wrote: > I probably won't have time to look at this ...
4 years ago (2016-12-16 17:46:23 UTC) #10
kkhorimoto
lgtm. Death to UIWebView tech debt!
4 years ago (2016-12-16 22:33:27 UTC) #11
Justin Donnelly
On Thu, Dec 15, 2016 at 7:39 PM, <eugenebut@chromium.org> wrote: > CCed people whose features ...
4 years ago (2016-12-16 22:59:37 UTC) #12
Eugene But (OOO till 7-30)
On 2016/12/16 22:59:37, Justin Donnelly wrote: > On Thu, Dec 15, 2016 at 7:39 PM, ...
4 years ago (2016-12-17 00:20:27 UTC) #13
sdefresne
Looks like there is a bug with the conversion. https://codereview.chromium.org/2581883002/diff/1/ios/web/web_state/ui/crw_web_controller.mm File ios/web/web_state/ui/crw_web_controller.mm (right): https://codereview.chromium.org/2581883002/diff/1/ios/web/web_state/ui/crw_web_controller.mm#newcode2926 ios/web/web_state/ui/crw_web_controller.mm:2926: ...
4 years ago (2016-12-21 13:05:38 UTC) #14
Eugene But (OOO till 7-30)
Fixed casting. PTAL https://codereview.chromium.org/2581883002/diff/1/ios/web/web_state/ui/crw_web_controller.mm File ios/web/web_state/ui/crw_web_controller.mm (right): https://codereview.chromium.org/2581883002/diff/1/ios/web/web_state/ui/crw_web_controller.mm#newcode2926 ios/web/web_state/ui/crw_web_controller.mm:2926: keyCode = static_cast<double>(keyCode); On 2016/12/21 13:05:38, ...
4 years ago (2016-12-21 15:58:46 UTC) #15
sdefresne
https://codereview.chromium.org/2581883002/diff/20001/ios/web/web_state/ui/crw_web_controller.mm File ios/web/web_state/ui/crw_web_controller.mm (right): https://codereview.chromium.org/2581883002/diff/20001/ios/web/web_state/ui/crw_web_controller.mm#newcode2919 ios/web/web_state/ui/crw_web_controller.mm:2919: keyCode = static_cast<int>(keyCode); The issue I pointed is still ...
4 years ago (2016-12-21 16:02:53 UTC) #16
Eugene But (OOO till 7-30)
Sorry about that :) https://codereview.chromium.org/2581883002/diff/20001/ios/web/web_state/ui/crw_web_controller.mm File ios/web/web_state/ui/crw_web_controller.mm (right): https://codereview.chromium.org/2581883002/diff/20001/ios/web/web_state/ui/crw_web_controller.mm#newcode2919 ios/web/web_state/ui/crw_web_controller.mm:2919: keyCode = static_cast<int>(keyCode); On 2016/12/21 ...
4 years ago (2016-12-21 16:09:13 UTC) #17
sdefresne
lgtm I am okay if the tests are added in a later CL, but please ...
4 years ago (2016-12-21 16:15:38 UTC) #18
Eugene But (OOO till 7-30)
Thanks. File crbug.com/676340
4 years ago (2016-12-21 16:20:48 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2581883002/40001
4 years ago (2016-12-21 16:21:12 UTC) #22
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years ago (2016-12-21 16:33:43 UTC) #25
commit-bot: I haz the power
4 years ago (2016-12-21 16:37:15 UTC) #27
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/cbc1a720e8e6b094f30b58c653fe97b32cd4dcdd
Cr-Commit-Position: refs/heads/master@{#440123}

Powered by Google App Engine
This is Rietveld 408576698