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

Unified Diff: Source/WebCore/bindings/dart/custom/DartLocationCustom.cpp

Issue 10660025: Cleanup dart to string conversions. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: . Created 8 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
Index: Source/WebCore/bindings/dart/custom/DartLocationCustom.cpp
diff --git a/Source/WebCore/bindings/dart/custom/DartLocationCustom.cpp b/Source/WebCore/bindings/dart/custom/DartLocationCustom.cpp
index b0119dac07ba9b0da809992ec993b3d3c0ed8678..be046caa8e8d4e0ece4183fdd2fce5aeb67af431 100644
--- a/Source/WebCore/bindings/dart/custom/DartLocationCustom.cpp
+++ b/Source/WebCore/bindings/dart/custom/DartLocationCustom.cpp
@@ -46,11 +46,9 @@ void hrefSetter(Dart_NativeArguments args)
{
Location* receiver = DartDOMWrapper::receiver<Location>(args);
- const ParameterAdapter<String> href(Dart_GetNativeArgument(args, 1));
- if (!href.conversionSuccessful()) {
- exception = href.exception();
+ DartStringAdapter href = DartUtilities::dartToString(Dart_GetNativeArgument(args, 1), exception);
+ if (exception)
goto fail;
- }
receiver->setHref(href, DartUtilities::domWindowForCurrentIsolate(), receiver->frame()->existingDOMWindow());
return;
@@ -68,11 +66,9 @@ void protocolSetter(Dart_NativeArguments args)
{
Location* receiver = DartDOMWrapper::receiver<Location>(args);
- const ParameterAdapter<String> protocol(Dart_GetNativeArgument(args, 1));
- if (!protocol.conversionSuccessful()) {
- exception = protocol.exception();
+ DartStringAdapter protocol = DartUtilities::dartToString(Dart_GetNativeArgument(args, 1), exception);
+ if (exception)
goto fail;
- }
DOMWindow* window = receiver->frame()->existingDOMWindow();
ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
@@ -97,11 +93,9 @@ void hostSetter(Dart_NativeArguments args)
{
Location* receiver = DartDOMWrapper::receiver<Location>(args);
- const ParameterAdapter<String> host(Dart_GetNativeArgument(args, 1));
- if (!host.conversionSuccessful()) {
- exception = host.exception();
+ DartStringAdapter host = DartUtilities::dartToString(Dart_GetNativeArgument(args, 1), exception);
+ if (exception)
goto fail;
- }
DOMWindow* window = receiver->frame()->existingDOMWindow();
ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
@@ -121,11 +115,9 @@ void hostnameSetter(Dart_NativeArguments args)
{
Location* receiver = DartDOMWrapper::receiver<Location>(args);
- const ParameterAdapter<String> hostname(Dart_GetNativeArgument(args, 1));
- if (!hostname.conversionSuccessful()) {
- exception = hostname.exception();
+ DartStringAdapter hostname = DartUtilities::dartToString(Dart_GetNativeArgument(args, 1), exception);
+ if (exception)
goto fail;
- }
DOMWindow* window = receiver->frame()->existingDOMWindow();
ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
@@ -145,11 +137,9 @@ void portSetter(Dart_NativeArguments args)
{
Location* receiver = DartDOMWrapper::receiver<Location>(args);
- const ParameterAdapter<String> port(Dart_GetNativeArgument(args, 1));
- if (!port.conversionSuccessful()) {
- exception = port.exception();
+ DartStringAdapter port = DartUtilities::dartToString(Dart_GetNativeArgument(args, 1), exception);
+ if (exception)
goto fail;
- }
DOMWindow* window = receiver->frame()->existingDOMWindow();
ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
@@ -169,11 +159,9 @@ void pathnameSetter(Dart_NativeArguments args)
{
Location* receiver = DartDOMWrapper::receiver<Location>(args);
- const ParameterAdapter<String> pathname(Dart_GetNativeArgument(args, 1));
- if (!pathname.conversionSuccessful()) {
- exception = pathname.exception();
+ DartStringAdapter pathname = DartUtilities::dartToString(Dart_GetNativeArgument(args, 1), exception);
+ if (exception)
goto fail;
- }
DOMWindow* window = receiver->frame()->existingDOMWindow();
ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
@@ -193,11 +181,9 @@ void searchSetter(Dart_NativeArguments args)
{
Location* receiver = DartDOMWrapper::receiver<Location>(args);
- const ParameterAdapter<String> search(Dart_GetNativeArgument(args, 1));
- if (!search.conversionSuccessful()) {
- exception = search.exception();
+ DartStringAdapter search = DartUtilities::dartToString(Dart_GetNativeArgument(args, 1), exception);
+ if (exception)
goto fail;
- }
DOMWindow* window = receiver->frame()->existingDOMWindow();
ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
@@ -216,11 +202,9 @@ void hashSetter(Dart_NativeArguments args)
Dart_Handle exception = 0;
{
Location* receiver = DartDOMWrapper::receiver<Location>(args);
- const ParameterAdapter<String> hash(Dart_GetNativeArgument(args, 1));
- if (!hash.conversionSuccessful()) {
- exception = hash.exception();
+ DartStringAdapter hash = DartUtilities::dartToString(Dart_GetNativeArgument(args, 1), exception);
+ if (exception)
goto fail;
- }
DOMWindow* window = receiver->frame()->existingDOMWindow();
ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
@@ -239,11 +223,9 @@ void assignCallback(Dart_NativeArguments args)
Dart_Handle exception = 0;
{
Location* receiver = DartDOMWrapper::receiver<Location>(args);
- const ParameterAdapter<String> url(Dart_GetNativeArgument(args, 1));
- if (!url.conversionSuccessful()) {
- exception = url.exception();
+ DartStringAdapter url = DartUtilities::dartToString(Dart_GetNativeArgument(args, 1), exception);
+ if (exception)
goto fail;
- }
DOMWindow* window = receiver->frame()->existingDOMWindow();
ASSERT(window == DartUtilities::domWindowForCurrentIsolate());
@@ -262,11 +244,9 @@ void replaceCallback(Dart_NativeArguments args)
Dart_Handle exception = 0;
{
Location* receiver = DartDOMWrapper::receiver<Location>(args);
- const ParameterAdapter<String> url(Dart_GetNativeArgument(args, 1));
- if (!url.conversionSuccessful()) {
- exception = url.exception();
+ DartStringAdapter url = DartUtilities::dartToString(Dart_GetNativeArgument(args, 1), exception);
+ if (exception)
goto fail;
- }
DOMWindow* window = receiver->frame()->existingDOMWindow();
ASSERT(window == DartUtilities::domWindowForCurrentIsolate());

Powered by Google App Engine
This is Rietveld 408576698