OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 29 matching lines...) Expand all Loading... | |
40 namespace WebCore { | 40 namespace WebCore { |
41 | 41 |
42 void V8FormData::appendMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& i nfo) | 42 void V8FormData::appendMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& i nfo) |
43 { | 43 { |
44 if (info.Length() < 2) { | 44 if (info.Length() < 2) { |
45 throwError(v8SyntaxError, "Not enough arguments", info.GetIsolate()); | 45 throwError(v8SyntaxError, "Not enough arguments", info.GetIsolate()); |
46 return; | 46 return; |
47 } | 47 } |
48 | 48 |
49 DOMFormData* domFormData = V8FormData::toNative(info.Holder()); | 49 DOMFormData* domFormData = V8FormData::toNative(info.Holder()); |
50 | 50 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, name, info[0]); |
51 String name = toWebCoreStringWithNullCheck(info[0]); | |
52 | 51 |
53 v8::Handle<v8::Value> arg = info[1]; | 52 v8::Handle<v8::Value> arg = info[1]; |
54 if (V8Blob::hasInstance(arg, info.GetIsolate(), worldType(info.GetIsolate()) )) { | 53 if (V8Blob::hasInstance(arg, info.GetIsolate(), worldType(info.GetIsolate()) )) { |
55 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); | 54 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); |
56 Blob* blob = V8Blob::toNative(object); | 55 Blob* blob = V8Blob::toNative(object); |
57 ASSERT(blob); | 56 ASSERT(blob); |
58 | 57 |
59 String filename; | 58 String filename; |
60 if (info.Length() >= 3 && !info[2]->IsUndefined()) | 59 if (info.Length() >= 3) { |
61 filename = toWebCoreStringWithNullCheck(info[2]); | 60 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedO rNullCheck>, filenameResource, info[2]); |
haraken
2013/11/15 22:20:15
Not related to your CL, it looks inconsistent that
Inactive
2013/11/15 22:30:25
Only the last argument is optional, doesn't it mak
haraken
2013/11/15 22:33:39
Makes sense. Thanks for the clarification!
| |
61 filename = filenameResource; | |
62 } | |
62 | 63 |
63 domFormData->append(name, blob, filename); | 64 domFormData->append(name, blob, filename); |
64 } else | 65 } else { |
65 domFormData->append(name, toWebCoreStringWithNullCheck(arg)); | 66 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, ar gString, arg); |
67 domFormData->append(name, argString); | |
68 } | |
66 } | 69 } |
67 | 70 |
68 } // namespace WebCore | 71 } // namespace WebCore |
OLD | NEW |