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

Unified Diff: Source/bindings/dart/custom/DartFormDataCustom.cpp

Issue 358823004: Fix FormData overloaded append. (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1985
Patch Set: Created 6 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/dart/custom/DartFormDataCustom.cpp
diff --git a/Source/bindings/dart/custom/DartFormDataCustom.cpp b/Source/bindings/dart/custom/DartFormDataCustom.cpp
index af79a078da7b8dedd1fb37ddae4a45e849013cd4..79646abec4e9edbf3306fd0f387f7af5b45930f7 100644
--- a/Source/bindings/dart/custom/DartFormDataCustom.cpp
+++ b/Source/bindings/dart/custom/DartFormDataCustom.cpp
@@ -63,45 +63,37 @@ void appendCallback(Dart_NativeArguments args)
{
DOMFormData* receiver = DartDOMWrapper::receiver<DOMFormData>(args);
- DartStringAdapter name = DartUtilities::dartToStringWithNullCheck(args, 1, exception);
+ DartStringAdapter name = DartUtilities::dartToString(args, 1, exception);
if (exception)
goto fail;
- DartStringAdapter value = DartUtilities::dartToStringWithNullCheck(args, 2, exception);
- if (exception)
- goto fail;
-
- receiver->append(name, value);
+ Dart_Handle arg2 = Dart_GetNativeArgument(args, 2);
- return;
- }
+ if (Dart_IsString(arg2)) {
+ ASSERT(Dart_GetNativeArgumentCount(args) == 3);
-fail:
- Dart_ThrowException(exception);
- ASSERT_NOT_REACHED();
-}
+ DartStringAdapter value = DartUtilities::dartToString(arg2, exception);
+ if (exception)
+ goto fail;
-void appendBlobCallback(Dart_NativeArguments args)
-{
- Dart_Handle exception = 0;
- {
- DOMFormData* receiver = DartDOMWrapper::receiver<DOMFormData>(args);
+ receiver->append(name, value);
+ return;
+ }
- DartStringAdapter name = DartUtilities::dartToStringWithNullCheck(args, 1, exception);
+ Blob* blob = DartBlob::toNative(arg2, exception);
if (exception)
goto fail;
- Dart_Handle valueHandle = Dart_GetNativeArgument(args, 2);
- Blob* blob = DartBlob::toNative(valueHandle, exception);
- if (exception)
- goto fail;
+ if (Dart_GetNativeArgumentCount(args) == 3) {
+ receiver->append(name, blob);
+ return;
+ }
DartStringAdapter filename = DartUtilities::dartToStringWithNullCheck(args, 3, exception);
if (exception)
goto fail;
receiver->append(name, blob, filename);
-
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698