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

Unified Diff: third_party/WebKit/Source/core/fileapi/File.cpp

Issue 1362963003: Blob/File constructors/slice method shouldn't throw on invalid types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fileapi/File.cpp
diff --git a/third_party/WebKit/Source/core/fileapi/File.cpp b/third_party/WebKit/Source/core/fileapi/File.cpp
index 5ca1b94385feb6f04a5fa68a49858400638e3bb6..bf8b4a3cdaa4f4e6cbf122ce1bc2a1b609223284 100644
--- a/third_party/WebKit/Source/core/fileapi/File.cpp
+++ b/third_party/WebKit/Source/core/fileapi/File.cpp
@@ -111,11 +111,6 @@ File* File::create(
const FilePropertyBag& options,
ExceptionState& exceptionState) {
ASSERT(options.hasType());
- if (!options.type().containsOnlyASCII()) {
- exceptionState.throwDOMException(
- SyntaxError, "The 'type' property must consist of ASCII characters.");
- return nullptr;
- }
double lastModified;
if (options.hasLastModified())
@@ -128,7 +123,7 @@ File* File::create(
UseCounter::count(context, UseCounter::FileAPINativeLineEndings);
std::unique_ptr<BlobData> blobData = BlobData::create();
- blobData->setContentType(options.type().lower());
+ blobData->setContentType(normalizeType(options.type()));
populateBlobData(blobData.get(), fileBits, normalizeLineEndingsToNative);
long long fileSize = blobData->length();
@@ -314,7 +309,7 @@ Blob* File::slice(long long start,
long long length = end - start;
std::unique_ptr<BlobData> blobData = BlobData::create();
- blobData->setContentType(contentType);
+ blobData->setContentType(normalizeType(contentType));
if (!m_fileSystemURL.isEmpty()) {
blobData->appendFileSystemURL(m_fileSystemURL, start, length,
modificationTimeMS / msPerSecond);

Powered by Google App Engine
This is Rietveld 408576698