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

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

Issue 2717583003: [BlobStorage] Enforcing renderer constraints to prevent broken blobs (Closed)
Patch Set: fixed File.cpp usage Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/blob/BlobData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..716b3a3d2613c38b2540d7fd0462e7e1f20a2dd6 100644
--- a/third_party/WebKit/Source/core/fileapi/File.cpp
+++ b/third_party/WebKit/Source/core/fileapi/File.cpp
@@ -84,22 +84,34 @@ static std::unique_ptr<BlobData> createBlobDataForFileWithName(
static std::unique_ptr<BlobData> createBlobDataForFileWithMetadata(
const String& fileSystemName,
const FileMetadata& metadata) {
- std::unique_ptr<BlobData> blobData = BlobData::create();
+ std::unique_ptr<BlobData> blobData;
+ if (metadata.length == BlobDataItem::toEndOfFile) {
pwnall 2017/03/06 21:13:45 Tests?
dmurph 2017/03/06 23:43:29 Tested by one or more of: FileTest.fileSystemFileW
pwnall 2017/03/06 23:45:12 Do we know for sure that we have coverage of both
dmurph 2017/03/29 23:19:24 Checked. Added one test for case where we have the
+ blobData = BlobData::createForFileWithUnknownSize(
+ metadata.platformPath, metadata.modificationTime / msPerSecond);
+ } else {
+ blobData = BlobData::create();
+ blobData->appendFile(metadata.platformPath, 0, metadata.length,
+ metadata.modificationTime / msPerSecond);
+ }
blobData->setContentType(
getContentTypeFromFileName(fileSystemName, File::WellKnownContentTypes));
- blobData->appendFile(metadata.platformPath, 0, metadata.length,
- metadata.modificationTime / msPerSecond);
return blobData;
}
static std::unique_ptr<BlobData> createBlobDataForFileSystemURL(
const KURL& fileSystemURL,
const FileMetadata& metadata) {
- std::unique_ptr<BlobData> blobData = BlobData::create();
+ std::unique_ptr<BlobData> blobData;
+ if (metadata.length == BlobDataItem::toEndOfFile) {
+ blobData = BlobData::createForFileSystemURLWithUnknownSize(
+ fileSystemURL, metadata.modificationTime / msPerSecond);
+ } else {
+ blobData = BlobData::create();
+ blobData->appendFileSystemURL(fileSystemURL, 0, metadata.length,
+ metadata.modificationTime / msPerSecond);
+ }
blobData->setContentType(getContentTypeFromFileName(
fileSystemURL.path(), File::WellKnownContentTypes));
- blobData->appendFileSystemURL(fileSystemURL, 0, metadata.length,
- metadata.modificationTime / msPerSecond);
return blobData;
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/blob/BlobData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698