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

Side by Side Diff: Source/core/fileapi/BlobBuilder.cpp

Issue 19845004: Do not normalize into NFC the values of form fields (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add normalizeAndEncode() without memory safety problem Created 7 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 { 53 {
54 // If the last item is not a data item, create one. Otherwise, we simply app end the new string to the last data item. 54 // If the last item is not a data item, create one. Otherwise, we simply app end the new string to the last data item.
55 if (m_items.isEmpty() || m_items[m_items.size() - 1].type != BlobDataItem::D ata) 55 if (m_items.isEmpty() || m_items[m_items.size() - 1].type != BlobDataItem::D ata)
56 m_items.append(BlobDataItem(RawData::create())); 56 m_items.append(BlobDataItem(RawData::create()));
57 57
58 return *m_items[m_items.size() - 1].data->mutableData(); 58 return *m_items[m_items.size() - 1].data->mutableData();
59 } 59 }
60 60
61 void BlobBuilder::append(const String& text, const String& endingType) 61 void BlobBuilder::append(const String& text, const String& endingType)
62 { 62 {
63 CString utf8Text = UTF8Encoding().encode(text, WTF::EntitiesForUnencodables) ; 63 CString utf8Text = UTF8Encoding().normalizeAndEncode(text, WTF::EntitiesForU nencodables);
64 64
65 Vector<char>& buffer = getBuffer(); 65 Vector<char>& buffer = getBuffer();
66 size_t oldSize = buffer.size(); 66 size_t oldSize = buffer.size();
67 67
68 if (endingType == "native") 68 if (endingType == "native")
69 normalizeLineEndingsToNative(utf8Text, buffer); 69 normalizeLineEndingsToNative(utf8Text, buffer);
70 else { 70 else {
71 ASSERT(endingType == "transparent"); 71 ASSERT(endingType == "transparent");
72 buffer.append(utf8Text.data(), utf8Text.length()); 72 buffer.append(utf8Text.data(), utf8Text.length());
73 } 73 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 RefPtr<Blob> blob = Blob::create(blobData.release(), m_size); 131 RefPtr<Blob> blob = Blob::create(blobData.release(), m_size);
132 132
133 // After creating a blob from the current blob data, we do not need to keep the data around any more. Instead, we only 133 // After creating a blob from the current blob data, we do not need to keep the data around any more. Instead, we only
134 // need to keep a reference to the URL of the blob just created. 134 // need to keep a reference to the URL of the blob just created.
135 m_items.append(BlobDataItem(blob->url(), 0, m_size)); 135 m_items.append(BlobDataItem(blob->url(), 0, m_size));
136 136
137 return blob; 137 return blob;
138 } 138 }
139 139
140 } // namespace WebCore 140 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/form-data-encoding-3-expected.txt ('k') | Source/core/page/PageSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698