Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index 1c78f00cde744587048c49b57493e95e14d8e559..28a42bda81574d9d716ce3cf53e30d3fe96b25ce 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -2103,6 +2103,34 @@ BUILTIN(ObjectSeal) { |
return *object; |
} |
+// ES6 section 18.2.6.2 decodeURI (encodedURI) |
+BUILTIN(GlobalDecodeURI) { |
+ HandleScope scope(isolate); |
+ Handle<String> encoded_uri; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, encoded_uri, |
+ Object::ToString(isolate, args.atOrUndefined(isolate, 1))); |
+ |
+ Handle<Object> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
+ Uri::DecodeUri(isolate, encoded_uri)); |
+ return *result; |
+} |
+ |
+// ES6 section 18.2.6.3 decodeURIComponent (encodedURIComponent) |
+BUILTIN(GlobalDecodeURIComponent) { |
+ HandleScope scope(isolate); |
+ Handle<String> encoded_uri_component; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, encoded_uri_component, |
+ Object::ToString(isolate, args.atOrUndefined(isolate, 1))); |
+ |
+ Handle<Object> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, Uri::DecodeUriComponent(isolate, encoded_uri_component)); |
+ return *result; |
+} |
+ |
// ES6 section 18.2.6.4 encodeURI (uri) |
BUILTIN(GlobalEncodeURI) { |
HandleScope scope(isolate); |
@@ -2110,18 +2138,24 @@ BUILTIN(GlobalEncodeURI) { |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
isolate, uri, Object::ToString(isolate, args.atOrUndefined(isolate, 1))); |
- return Uri::EncodeUri(isolate, uri); |
+ Handle<Object> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
+ Uri::EncodeUri(isolate, uri)); |
+ return *result; |
} |
// ES6 section 18.2.6.5 encodeURIComponenet (uriComponent) |
BUILTIN(GlobalEncodeURIComponent) { |
HandleScope scope(isolate); |
- Handle<String> uriComponent; |
+ Handle<String> uri_component; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, uriComponent, |
+ isolate, uri_component, |
Object::ToString(isolate, args.atOrUndefined(isolate, 1))); |
- return Uri::EncodeUriComponent(isolate, uriComponent); |
+ Handle<Object> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, Uri::EncodeUriComponent(isolate, uri_component)); |
+ return *result; |
} |
namespace { |