OLD | NEW |
1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, Google Inc. |
2 // All rights reserved. | 2 // 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 DartApiScope dartApiScope; | 63 DartApiScope dartApiScope; |
64 Dart_Handle exception = 0; | 64 Dart_Handle exception = 0; |
65 { | 65 { |
66 DOMFormData* receiver = DartDOMWrapper::receiver<DOMFormData>(args); | 66 DOMFormData* receiver = DartDOMWrapper::receiver<DOMFormData>(args); |
67 | 67 |
68 DartStringAdapter name = DartUtilities::dartToStringWithNullCheck(Dart_G
etNativeArgument(args, 1), exception); | 68 DartStringAdapter name = DartUtilities::dartToStringWithNullCheck(Dart_G
etNativeArgument(args, 1), exception); |
69 if (exception) | 69 if (exception) |
70 goto fail; | 70 goto fail; |
71 | 71 |
72 Dart_Handle valueHandle = Dart_GetNativeArgument(args, 2); | 72 Dart_Handle valueHandle = Dart_GetNativeArgument(args, 2); |
73 if (DartDOMWrapper::instanceOf<DartBlob>(valueHandle)) { | 73 DartStringAdapter value = DartUtilities::dartToStringWithNullCheck(value
Handle, exception); |
74 Blob* blob = DartBlob::toNative(valueHandle, exception); | 74 if (exception) |
75 if (exception) | 75 goto fail; |
76 goto fail; | |
77 | 76 |
78 DartStringAdapter filename = DartUtilities::dartToStringWithNullChec
k(Dart_GetNativeArgument(args, 3), exception); | 77 receiver->append(name, value); |
79 if (exception) | |
80 goto fail; | |
81 | |
82 receiver->append(name, blob, filename); | |
83 } else { | |
84 DartStringAdapter filename = DartUtilities::dartToStringWithNullChec
k(valueHandle, exception); | |
85 if (exception) | |
86 goto fail; | |
87 | |
88 receiver->append(name, filename); | |
89 } | |
90 | 78 |
91 return; | 79 return; |
92 } | 80 } |
| 81 |
| 82 fail: |
| 83 Dart_ThrowException(exception); |
| 84 ASSERT_NOT_REACHED(); |
| 85 } |
| 86 |
| 87 void appendBlobCallback(Dart_NativeArguments args) |
| 88 { |
| 89 DartApiScope dartApiScope; |
| 90 Dart_Handle exception = 0; |
| 91 { |
| 92 DOMFormData* receiver = DartDOMWrapper::receiver<DOMFormData>(args); |
| 93 |
| 94 DartStringAdapter name = DartUtilities::dartToStringWithNullCheck(Dart_G
etNativeArgument(args, 1), exception); |
| 95 if (exception) |
| 96 goto fail; |
| 97 |
| 98 Dart_Handle valueHandle = Dart_GetNativeArgument(args, 2); |
| 99 Blob* blob = DartBlob::toNative(valueHandle, exception); |
| 100 if (exception) |
| 101 goto fail; |
| 102 |
| 103 DartStringAdapter filename = DartUtilities::dartToStringWithNullCheck(Da
rt_GetNativeArgument(args, 3), exception); |
| 104 if (exception) |
| 105 goto fail; |
| 106 |
| 107 receiver->append(name, blob, filename); |
| 108 |
| 109 return; |
| 110 } |
93 | 111 |
94 fail: | 112 fail: |
95 Dart_ThrowException(exception); | 113 Dart_ThrowException(exception); |
96 ASSERT_NOT_REACHED(); | 114 ASSERT_NOT_REACHED(); |
97 } | 115 } |
98 | 116 |
99 } | 117 } |
100 | 118 |
101 } | 119 } |
OLD | NEW |