| OLD | NEW |
| 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 Loading... |
| 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, see http://crbug.com/314755 |
| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } else if (V8Blob::HasInstance(item, info.GetIsolate(), worldType(info.G
etIsolate()))) { | 105 } else if (V8Blob::HasInstance(item, info.GetIsolate(), worldType(info.G
etIsolate()))) { |
| 105 Blob* blob = V8Blob::toNative(v8::Handle<v8::Object>::Cast(item)); | 106 Blob* blob = V8Blob::toNative(v8::Handle<v8::Object>::Cast(item)); |
| 106 ASSERT(blob); | 107 ASSERT(blob); |
| 107 blobBuilder.append(blob); | 108 blobBuilder.append(blob); |
| 108 } else { | 109 } else { |
| 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.createBlob(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 |
| OLD | NEW |