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

Side by Side Diff: Source/bindings/v8/custom/V8BlobCustom.cpp

Issue 57483002: Implement File constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed feedback on tests. Created 7 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 void V8Blob::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& info) 44 void V8Blob::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
45 { 45 {
46 if (!info.Length()) { 46 if (!info.Length()) {
47 RefPtr<Blob> blob = Blob::create(); 47 RefPtr<Blob> blob = Blob::create();
48 info.GetReturnValue().Set(toV8(blob.get(), info.Holder(), info.GetIsolat e())); 48 info.GetReturnValue().Set(toV8(blob.get(), info.Holder(), info.GetIsolat e()));
49 return; 49 return;
50 } 50 }
51 51
52 v8::Local<v8::Value> firstArg = info[0]; 52 v8::Local<v8::Value> firstArg = info[0];
53 // FIXME: handle WebIDL sequences, possibly by using toV8Sequence
Inactive 2013/11/05 00:38:48 Nit: Would be good to indicate the bug number.
pwnall-personal 2013/11/05 01:14:23 Done.
53 if (!firstArg->IsArray()) { 54 if (!firstArg->IsArray()) {
54 throwTypeError("First argument of the constructor is not of type Array", info.GetIsolate()); 55 throwTypeError("First argument of the constructor is not of type Array", info.GetIsolate());
55 return; 56 return;
56 } 57 }
57 58
58 String type; 59 String type;
59 String endings = "transparent"; 60 String endings = "transparent";
60 61
61 if (info.Length() > 1) { 62 if (info.Length() > 1) {
62 if (!info[1]->IsObject()) { 63 if (!info[1]->IsObject()) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringValue , item); 110 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringValue , item);
110 blobBuilder.append(stringValue, endings); 111 blobBuilder.append(stringValue, endings);
111 } 112 }
112 } 113 }
113 114
114 RefPtr<Blob> blob = blobBuilder.getBlob(type); 115 RefPtr<Blob> blob = blobBuilder.getBlob(type);
115 info.GetReturnValue().Set(toV8(blob.get(), info.Holder(), info.GetIsolate()) ); 116 info.GetReturnValue().Set(toV8(blob.get(), info.Holder(), info.GetIsolate()) );
116 } 117 }
117 118
118 } // namespace WebCore 119 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698