| OLD | NEW |
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 if (!options.type().containsOnlyASCII()) { | 96 if (!options.type().containsOnlyASCII()) { |
| 97 exceptionState.throwDOMException(SyntaxError, "The 'type' property must
consist of ASCII characters."); | 97 exceptionState.throwDOMException(SyntaxError, "The 'type' property must
consist of ASCII characters."); |
| 98 return nullptr; | 98 return nullptr; |
| 99 } | 99 } |
| 100 | 100 |
| 101 double lastModified; | 101 double lastModified; |
| 102 if (options.hasLastModified()) | 102 if (options.hasLastModified()) |
| 103 lastModified = static_cast<double>(options.lastModified()); | 103 lastModified = static_cast<double>(options.lastModified()); |
| 104 else | 104 else |
| 105 lastModified = currentTimeMS(); | 105 lastModified = currentTimeMS(); |
| 106 ASSERT(options.hasEndings()); | |
| 107 bool normalizeLineEndingsToNative = options.endings() == "native"; | |
| 108 if (normalizeLineEndingsToNative) | |
| 109 UseCounter::count(context, UseCounter::FileAPINativeLineEndings); | |
| 110 | 106 |
| 111 std::unique_ptr<BlobData> blobData = BlobData::create(); | 107 std::unique_ptr<BlobData> blobData = BlobData::create(); |
| 112 blobData->setContentType(options.type().lower()); | 108 blobData->setContentType(options.type().lower()); |
| 113 populateBlobData(blobData.get(), fileBits, normalizeLineEndingsToNative); | 109 populateBlobData(blobData.get(), fileBits); |
| 114 | 110 |
| 115 long long fileSize = blobData->length(); | 111 long long fileSize = blobData->length(); |
| 116 return File::create(fileName, lastModified, BlobDataHandle::create(std::move
(blobData), fileSize)); | 112 return File::create(fileName, lastModified, BlobDataHandle::create(std::move
(blobData), fileSize)); |
| 117 } | 113 } |
| 118 | 114 |
| 119 File* File::createWithRelativePath(const String& path, const String& relativePat
h) | 115 File* File::createWithRelativePath(const String& path, const String& relativePat
h) |
| 120 { | 116 { |
| 121 File* file = new File(path, File::AllContentTypes, File::IsUserVisible); | 117 File* file = new File(path, File::AllContentTypes, File::IsUserVisible); |
| 122 file->m_relativePath = relativePath; | 118 file->m_relativePath = relativePath; |
| 123 return file; | 119 return file; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 if (m_fileSystemURL.isEmpty() != other.m_fileSystemURL.isEmpty()) | 354 if (m_fileSystemURL.isEmpty() != other.m_fileSystemURL.isEmpty()) |
| 359 return false; | 355 return false; |
| 360 | 356 |
| 361 if (!m_fileSystemURL.isEmpty()) | 357 if (!m_fileSystemURL.isEmpty()) |
| 362 return m_fileSystemURL == other.m_fileSystemURL; | 358 return m_fileSystemURL == other.m_fileSystemURL; |
| 363 | 359 |
| 364 return uuid() == other.uuid(); | 360 return uuid() == other.uuid(); |
| 365 } | 361 } |
| 366 | 362 |
| 367 } // namespace blink | 363 } // namespace blink |
| OLD | NEW |