| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 TOSTRING_VOID(V8StringResource<>, fileName, info[1]); | 56 TOSTRING_VOID(V8StringResource<>, fileName, info[1]); |
| 57 | 57 |
| 58 V8BlobCustomHelpers::ParsedProperties properties(true); | 58 V8BlobCustomHelpers::ParsedProperties properties(true); |
| 59 if (info.Length() > 2) { | 59 if (info.Length() > 2) { |
| 60 if (!info[2]->IsObject()) { | 60 if (!info[2]->IsObject()) { |
| 61 exceptionState.throwTypeError("The 3rd argument is not of type Objec
t."); | 61 exceptionState.throwTypeError("The 3rd argument is not of type Objec
t."); |
| 62 exceptionState.throwIfNeeded(); | 62 exceptionState.throwIfNeeded(); |
| 63 return; | 63 return; |
| 64 } | 64 } |
| 65 | 65 |
| 66 if (!properties.parseBlobPropertyBag(info[2], "File", exceptionState, in
fo.GetIsolate())) { | 66 if (!properties.parseBlobPropertyBag(info.GetIsolate(), info[2], "File",
exceptionState)) { |
| 67 exceptionState.throwIfNeeded(); | 67 exceptionState.throwIfNeeded(); |
| 68 return; | 68 return; |
| 69 } | 69 } |
| 70 } else { | 70 } else { |
| 71 properties.setDefaultLastModified(); | 71 properties.setDefaultLastModified(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 OwnPtr<BlobData> blobData = BlobData::create(); | 74 OwnPtr<BlobData> blobData = BlobData::create(); |
| 75 blobData->setContentType(properties.contentType()); | 75 blobData->setContentType(properties.contentType()); |
| 76 v8::Local<v8::Object> blobParts = v8::Local<v8::Object>::Cast(info[0]); | 76 v8::Local<v8::Object> blobParts = v8::Local<v8::Object>::Cast(info[0]); |
| 77 if (!V8BlobCustomHelpers::processBlobParts(blobParts, properties.normalizeLi
neEndingsToNative(), *blobData, info.GetIsolate())) | 77 if (!V8BlobCustomHelpers::processBlobParts(info.GetIsolate(), blobParts, pro
perties.normalizeLineEndingsToNative(), *blobData)) |
| 78 return; | 78 return; |
| 79 | 79 |
| 80 long long fileSize = blobData->length(); | 80 long long fileSize = blobData->length(); |
| 81 File* file = File::create(fileName, properties.lastModified(), BlobDataHandl
e::create(blobData.release(), fileSize)); | 81 File* file = File::create(fileName, properties.lastModified(), BlobDataHandl
e::create(blobData.release(), fileSize)); |
| 82 v8SetReturnValue(info, file); | 82 v8SetReturnValue(info, file); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace blink | 85 } // namespace blink |
| OLD | NEW |