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

Side by Side Diff: third_party/WebKit/Source/core/fileapi/Blob.cpp

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: add missing tests Created 3 years, 8 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // static 125 // static
126 void Blob::PopulateBlobData( 126 void Blob::PopulateBlobData(
127 BlobData* blob_data, 127 BlobData* blob_data,
128 const HeapVector<ArrayBufferOrArrayBufferViewOrBlobOrUSVString>& parts, 128 const HeapVector<ArrayBufferOrArrayBufferViewOrBlobOrUSVString>& parts,
129 bool normalize_line_endings_to_native) { 129 bool normalize_line_endings_to_native) {
130 for (const auto& item : parts) { 130 for (const auto& item : parts) {
131 if (item.isArrayBuffer()) { 131 if (item.isArrayBuffer()) {
132 DOMArrayBuffer* array_buffer = item.getAsArrayBuffer(); 132 DOMArrayBuffer* array_buffer = item.getAsArrayBuffer();
133 blob_data->AppendBytes(array_buffer->Data(), array_buffer->ByteLength()); 133 blob_data->AppendBytes(array_buffer->Data(), array_buffer->ByteLength());
134 } else if (item.isArrayBufferView()) { 134 } else if (item.isArrayBufferView()) {
135 DOMArrayBufferView* array_buffer_view = item.getAsArrayBufferView(); 135 DOMArrayBufferView* array_buffer_view =
136 item.getAsArrayBufferView().View();
136 blob_data->AppendBytes(array_buffer_view->BaseAddress(), 137 blob_data->AppendBytes(array_buffer_view->BaseAddress(),
137 array_buffer_view->byteLength()); 138 array_buffer_view->byteLength());
138 } else if (item.isBlob()) { 139 } else if (item.isBlob()) {
139 item.getAsBlob()->AppendTo(*blob_data); 140 item.getAsBlob()->AppendTo(*blob_data);
140 } else if (item.isUSVString()) { 141 } else if (item.isUSVString()) {
141 blob_data->AppendText(item.getAsUSVString(), 142 blob_data->AppendText(item.getAsUSVString(),
142 normalize_line_endings_to_native); 143 normalize_line_endings_to_native);
143 } else { 144 } else {
144 NOTREACHED(); 145 NOTREACHED();
145 } 146 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 const UChar* chars = type.Characters16(); 237 const UChar* chars = type.Characters16();
237 for (size_t i = 0; i < length; ++i) { 238 for (size_t i = 0; i < length; ++i) {
238 if (chars[i] < 0x0020 || chars[i] > 0x007e) 239 if (chars[i] < 0x0020 || chars[i] > 0x007e)
239 return g_empty_string; 240 return g_empty_string;
240 } 241 }
241 } 242 }
242 return type.DeprecatedLower(); 243 return type.DeprecatedLower();
243 } 244 }
244 245
245 } // namespace blink 246 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698