mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 1504463 - Implement JS::CompileUtf8DontDeflate that accepts const char*/size_t and compiles it as UTF-8 of uncertain validity without first inflating to UTF-16. r=arai
--HG-- extra : rebase_source : c561fd9d4ce6468d54312313b96dcf1266633142
This commit is contained in:
parent
2ffe08ffb9
commit
6dd8e254b3
@ -166,6 +166,20 @@ extern JS_PUBLIC_API(bool)
|
||||
CompileUtf8(JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
const char* bytes, size_t length, MutableHandle<JSScript*> script);
|
||||
|
||||
/**
|
||||
* Compile the provided UTF-8 data into a script. If the data contains invalid
|
||||
* UTF-8, an error is reported.
|
||||
*
|
||||
* |script| is always set to the compiled script or to null in case of error.
|
||||
*
|
||||
* NOTE: This function DOES NOT INFLATE the UTF-8 bytes to UTF-16 before
|
||||
* compiling them. UTF-8 compilation is currently experimental and has
|
||||
* known bugs. Use only if you're willing to tolerate unspecified bugs!
|
||||
*/
|
||||
extern JS_PUBLIC_API(bool)
|
||||
CompileUtf8DontInflate(JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
const char* bytes, size_t length, MutableHandle<JSScript*> script);
|
||||
|
||||
/**
|
||||
* Compile the provided Latin-1 data (i.e. each byte directly corresponds to
|
||||
* the same Unicode code point) into a script.
|
||||
|
@ -139,6 +139,13 @@ JS::CompileUtf8(JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
return ::CompileUtf8(cx, options, bytes, length, script);
|
||||
}
|
||||
|
||||
bool
|
||||
JS::CompileUtf8DontInflate(JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
const char* bytes, size_t length, JS::MutableHandleScript script)
|
||||
{
|
||||
return ::CompileUtf8DontInflate(cx, options, bytes, length, script);
|
||||
}
|
||||
|
||||
bool
|
||||
JS::CompileUtf8File(JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
FILE* file, JS::MutableHandleScript script)
|
||||
|
Loading…
Reference in New Issue
Block a user