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

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

Issue 1235213004: Blob/File constructors/slice method shouldn't throw on invalid types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove debugging spew Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/fileapi/Blob.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 OwnPtr<BlobData> blobData = BlobData::create(); 84 OwnPtr<BlobData> blobData = BlobData::create();
85 blobData->setContentType(getContentTypeFromFileName(fileSystemURL.path(), Fi le::WellKnownContentTypes)); 85 blobData->setContentType(getContentTypeFromFileName(fileSystemURL.path(), Fi le::WellKnownContentTypes));
86 blobData->appendFileSystemURL(fileSystemURL, 0, metadata.length, metadata.mo dificationTime / msPerSecond); 86 blobData->appendFileSystemURL(fileSystemURL, 0, metadata.length, metadata.mo dificationTime / msPerSecond);
87 return blobData.release(); 87 return blobData.release();
88 } 88 }
89 89
90 // static 90 // static
91 File* File::create(const HeapVector<BlobOrStringOrArrayBufferViewOrArrayBuffer>& fileBits, const String& fileName, const FilePropertyBag& options, ExceptionStat e& exceptionState) 91 File* File::create(const HeapVector<BlobOrStringOrArrayBufferViewOrArrayBuffer>& fileBits, const String& fileName, const FilePropertyBag& options, ExceptionStat e& exceptionState)
92 { 92 {
93 ASSERT(options.hasType()); 93 ASSERT(options.hasType());
94 if (!options.type().containsOnlyASCII()) {
95 exceptionState.throwDOMException(SyntaxError, "The 'type' property must consist of ASCII characters.");
96 return nullptr;
97 }
98 94
99 double lastModified; 95 double lastModified;
100 if (options.hasLastModified()) 96 if (options.hasLastModified())
101 lastModified = static_cast<double>(options.lastModified()); 97 lastModified = static_cast<double>(options.lastModified());
102 else 98 else
103 lastModified = currentTimeMS(); 99 lastModified = currentTimeMS();
104 100
105 ASSERT(options.hasEndings()); 101 ASSERT(options.hasEndings());
106 bool normalizeLineEndingsToNative = options.endings() == "native"; 102 bool normalizeLineEndingsToNative = options.endings() == "native";
107 103
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (m_fileSystemURL.isEmpty() != other.m_fileSystemURL.isEmpty()) 351 if (m_fileSystemURL.isEmpty() != other.m_fileSystemURL.isEmpty())
356 return false; 352 return false;
357 353
358 if (!m_fileSystemURL.isEmpty()) 354 if (!m_fileSystemURL.isEmpty())
359 return m_fileSystemURL == other.m_fileSystemURL; 355 return m_fileSystemURL == other.m_fileSystemURL;
360 356
361 return uuid() == other.uuid(); 357 return uuid() == other.uuid();
362 } 358 }
363 359
364 } // namespace blink 360 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/fileapi/Blob.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698