2016-05-17 10:54:14 +00:00
|
|
|
// Copyright 2016 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef V8_URI_H_
|
|
|
|
#define V8_URI_H_
|
|
|
|
|
|
|
|
#include "src/allocation.h"
|
|
|
|
#include "src/objects.h"
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
class Uri : public AllStatic {
|
|
|
|
public:
|
2016-05-27 09:56:04 +00:00
|
|
|
// ES6 section 18.2.6.2 decodeURI (encodedURI)
|
|
|
|
static MaybeHandle<String> DecodeUri(Isolate* isolate, Handle<String> uri) {
|
|
|
|
return Decode(isolate, uri, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ES6 section 18.2.6.3 decodeURIComponent (encodedURIComponent)
|
|
|
|
static MaybeHandle<String> DecodeUriComponent(Isolate* isolate,
|
|
|
|
Handle<String> component) {
|
|
|
|
return Decode(isolate, component, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ES6 section 18.2.6.4 encodeURI (uri)
|
2016-05-24 11:45:18 +00:00
|
|
|
static MaybeHandle<String> EncodeUri(Isolate* isolate, Handle<String> uri) {
|
2016-05-17 10:54:14 +00:00
|
|
|
return Encode(isolate, uri, true);
|
|
|
|
}
|
|
|
|
|
2016-05-27 09:56:04 +00:00
|
|
|
// ES6 section 18.2.6.5 encodeURIComponenet (uriComponent)
|
2016-05-24 11:45:18 +00:00
|
|
|
static MaybeHandle<String> EncodeUriComponent(Isolate* isolate,
|
|
|
|
Handle<String> component) {
|
2016-05-17 10:54:14 +00:00
|
|
|
return Encode(isolate, component, false);
|
|
|
|
}
|
|
|
|
|
2016-06-01 04:24:32 +00:00
|
|
|
// ES6 section B.2.1.1 escape (string)
|
|
|
|
static MaybeHandle<String> Escape(Isolate* isolate, Handle<String> string);
|
|
|
|
|
|
|
|
// ES6 section B.2.1.2 unescape (string)
|
|
|
|
static MaybeHandle<String> Unescape(Isolate* isolate, Handle<String> string);
|
|
|
|
|
2016-05-17 10:54:14 +00:00
|
|
|
private:
|
2016-05-27 09:56:04 +00:00
|
|
|
static MaybeHandle<String> Decode(Isolate* isolate, Handle<String> uri,
|
|
|
|
bool is_uri);
|
2016-05-24 11:45:18 +00:00
|
|
|
static MaybeHandle<String> Encode(Isolate* isolate, Handle<String> uri,
|
|
|
|
bool is_uri);
|
2016-05-17 10:54:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
|
|
|
|
|
|
|
#endif // V8_URI_H_
|