| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 Dart_ThrowException(exception); | 56 Dart_ThrowException(exception); |
| 57 ASSERT_NOT_REACHED(); | 57 ASSERT_NOT_REACHED(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void appendCallback(Dart_NativeArguments args) | 60 void appendCallback(Dart_NativeArguments args) |
| 61 { | 61 { |
| 62 Dart_Handle exception = 0; | 62 Dart_Handle exception = 0; |
| 63 { | 63 { |
| 64 DOMFormData* receiver = DartDOMWrapper::receiver<DOMFormData>(args); | 64 DOMFormData* receiver = DartDOMWrapper::receiver<DOMFormData>(args); |
| 65 | 65 |
| 66 DartStringAdapter name = DartUtilities::dartToStringWithNullCheck(args,
1, exception); | 66 DartStringAdapter name = DartUtilities::dartToString(args, 1, exception)
; |
| 67 if (exception) | 67 if (exception) |
| 68 goto fail; | 68 goto fail; |
| 69 | 69 |
| 70 DartStringAdapter value = DartUtilities::dartToStringWithNullCheck(args,
2, exception); | 70 Dart_Handle arg2 = Dart_GetNativeArgument(args, 2); |
| 71 |
| 72 if (Dart_IsString(arg2)) { |
| 73 ASSERT(Dart_GetNativeArgumentCount(args) == 3); |
| 74 |
| 75 DartStringAdapter value = DartUtilities::dartToString(arg2, exceptio
n); |
| 76 if (exception) |
| 77 goto fail; |
| 78 |
| 79 receiver->append(name, value); |
| 80 return; |
| 81 } |
| 82 |
| 83 Blob* blob = DartBlob::toNative(arg2, exception); |
| 71 if (exception) | 84 if (exception) |
| 72 goto fail; | 85 goto fail; |
| 73 | 86 |
| 74 receiver->append(name, value); | 87 if (Dart_GetNativeArgumentCount(args) == 3) { |
| 75 | 88 receiver->append(name, blob); |
| 76 return; | 89 return; |
| 77 } | 90 } |
| 78 | |
| 79 fail: | |
| 80 Dart_ThrowException(exception); | |
| 81 ASSERT_NOT_REACHED(); | |
| 82 } | |
| 83 | |
| 84 void appendBlobCallback(Dart_NativeArguments args) | |
| 85 { | |
| 86 Dart_Handle exception = 0; | |
| 87 { | |
| 88 DOMFormData* receiver = DartDOMWrapper::receiver<DOMFormData>(args); | |
| 89 | |
| 90 DartStringAdapter name = DartUtilities::dartToStringWithNullCheck(args,
1, exception); | |
| 91 if (exception) | |
| 92 goto fail; | |
| 93 | |
| 94 Dart_Handle valueHandle = Dart_GetNativeArgument(args, 2); | |
| 95 Blob* blob = DartBlob::toNative(valueHandle, exception); | |
| 96 if (exception) | |
| 97 goto fail; | |
| 98 | 91 |
| 99 DartStringAdapter filename = DartUtilities::dartToStringWithNullCheck(ar
gs, 3, exception); | 92 DartStringAdapter filename = DartUtilities::dartToStringWithNullCheck(ar
gs, 3, exception); |
| 100 if (exception) | 93 if (exception) |
| 101 goto fail; | 94 goto fail; |
| 102 | 95 |
| 103 receiver->append(name, blob, filename); | 96 receiver->append(name, blob, filename); |
| 104 | |
| 105 return; | 97 return; |
| 106 } | 98 } |
| 107 | 99 |
| 108 fail: | 100 fail: |
| 109 Dart_ThrowException(exception); | 101 Dart_ThrowException(exception); |
| 110 ASSERT_NOT_REACHED(); | 102 ASSERT_NOT_REACHED(); |
| 111 } | 103 } |
| 112 | 104 |
| 113 } | 105 } |
| 114 | 106 |
| 115 } | 107 } |
| OLD | NEW |