Skip to content

Commit

Permalink
PushMessageData strings should not be normalized before encoding
Browse files Browse the repository at this point in the history
Spec doesn't require NFC normalization, and it's considered
bad practice on the Web to muck with user data this way.

BUG=545675
R=peter@chromium.org,jshin@chromium.org,mvanouwerkerk@chromium.org

Review URL: https://codereview.chromium.org/1417773003

Cr-Commit-Position: refs/heads/master@{#355410}
  • Loading branch information
inexorabletash authored and Commit bot committed Oct 21, 2015
1 parent 6415f40 commit aa0e86b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,10 @@ test(function() {
assert_throws(null, () => new PushMessageData(new ArrayBuffer(8)));

}, 'PushMessageData should not be constructable.');

test(function() {
var s = "e\u0328"; // 'e' + COMBINING OGONEK
var data = createPushMessageData(s);
assert_equals(data.text(), s, 'String should not be NFC-normalized.');

}, 'PushEventInit data is not normalized');
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ PushMessageData* PushMessageData::create(const ArrayBufferOrArrayBufferViewOrUSV
}

if (messageData.isUSVString()) {
CString encodedString = UTF8Encoding().normalizeAndEncode(messageData.getAsUSVString(), WTF::EntitiesForUnencodables);
CString encodedString = UTF8Encoding().encode(messageData.getAsUSVString(), WTF::EntitiesForUnencodables);
return new PushMessageData(encodedString.data(), encodedString.length());
}

Expand Down

0 comments on commit aa0e86b

Please sign in to comment.