OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_URI_H_ | 5 #ifndef V8_URI_H_ |
6 #define V8_URI_H_ | 6 #define V8_URI_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 class Uri : public AllStatic { | 14 class Uri : public AllStatic { |
15 public: | 15 public: |
| 16 // ES6 section 18.2.6.2 decodeURI (encodedURI) |
| 17 static MaybeHandle<String> DecodeUri(Isolate* isolate, Handle<String> uri) { |
| 18 return Decode(isolate, uri, true); |
| 19 } |
| 20 |
| 21 // ES6 section 18.2.6.3 decodeURIComponent (encodedURIComponent) |
| 22 static MaybeHandle<String> DecodeUriComponent(Isolate* isolate, |
| 23 Handle<String> component) { |
| 24 return Decode(isolate, component, false); |
| 25 } |
| 26 |
| 27 // ES6 section 18.2.6.4 encodeURI (uri) |
16 static MaybeHandle<String> EncodeUri(Isolate* isolate, Handle<String> uri) { | 28 static MaybeHandle<String> EncodeUri(Isolate* isolate, Handle<String> uri) { |
17 return Encode(isolate, uri, true); | 29 return Encode(isolate, uri, true); |
18 } | 30 } |
19 | 31 |
| 32 // ES6 section 18.2.6.5 encodeURIComponenet (uriComponent) |
20 static MaybeHandle<String> EncodeUriComponent(Isolate* isolate, | 33 static MaybeHandle<String> EncodeUriComponent(Isolate* isolate, |
21 Handle<String> component) { | 34 Handle<String> component) { |
22 return Encode(isolate, component, false); | 35 return Encode(isolate, component, false); |
23 } | 36 } |
24 | 37 |
25 // DecodeUri | |
26 // DecodeUriComponent | |
27 // escape | |
28 // unescape | |
29 | |
30 private: | 38 private: |
| 39 static MaybeHandle<String> Decode(Isolate* isolate, Handle<String> uri, |
| 40 bool is_uri); |
31 static MaybeHandle<String> Encode(Isolate* isolate, Handle<String> uri, | 41 static MaybeHandle<String> Encode(Isolate* isolate, Handle<String> uri, |
32 bool is_uri); | 42 bool is_uri); |
33 // decode | |
34 }; | 43 }; |
35 | 44 |
36 } // namespace internal | 45 } // namespace internal |
37 } // namespace v8 | 46 } // namespace v8 |
38 | 47 |
39 #endif // V8_URI_H_ | 48 #endif // V8_URI_H_ |
OLD | NEW |