mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Removed unnecessary conversion from UTF-8 to UTF-16
This commit is contained in:
parent
916d9e0e3d
commit
6014710538
2 changed files with 8 additions and 13 deletions
|
@ -45,7 +45,7 @@ use js::jsapi::Handle as RawHandle;
|
|||
use js::jsapi::HandleObject;
|
||||
use js::jsapi::HandleValue as RawHandleValue;
|
||||
use js::jsapi::Value;
|
||||
use js::jsapi::{CompileModule, ExceptionStackBehavior, FinishDynamicModuleImport};
|
||||
use js::jsapi::{CompileModuleDontInflate, ExceptionStackBehavior, FinishDynamicModuleImport};
|
||||
use js::jsapi::{GetModuleResolveHook, JSRuntime, SetModuleResolveHook};
|
||||
use js::jsapi::{GetRequestedModules, SetModuleMetadataHook};
|
||||
use js::jsapi::{Heap, JSContext, JS_ClearPendingException, SetModulePrivate};
|
||||
|
@ -56,7 +56,7 @@ use js::jsapi::{SetModuleDynamicImportHook, SetScriptPrivateReferenceHooks};
|
|||
use js::jsval::{JSVal, PrivateValue, UndefinedValue};
|
||||
use js::rust::jsapi_wrapped::{GetRequestedModuleSpecifier, JS_GetPendingException};
|
||||
use js::rust::jsapi_wrapped::{JS_GetArrayLength, JS_GetElement};
|
||||
use js::rust::transform_u16_to_source_text;
|
||||
use js::rust::transform_str_to_source_text;
|
||||
use js::rust::wrappers::JS_SetPendingException;
|
||||
use js::rust::CompileOptionsWrapper;
|
||||
use js::rust::{Handle, HandleValue, IntoHandle};
|
||||
|
@ -420,8 +420,6 @@ impl ModuleTree {
|
|||
url: ServoUrl,
|
||||
options: ScriptFetchOptions,
|
||||
) -> Result<ModuleObject, RethrowError> {
|
||||
let module: Vec<u16> = module_script_text.encode_utf16().collect();
|
||||
|
||||
let url_cstr = ffi::CString::new(url.as_str().as_bytes()).unwrap();
|
||||
|
||||
let _ac = JSAutoRealm::new(*global.get_cx(), *global.reflector().get_jsobject());
|
||||
|
@ -430,10 +428,10 @@ impl ModuleTree {
|
|||
unsafe { CompileOptionsWrapper::new(*global.get_cx(), url_cstr.as_ptr(), 1) };
|
||||
|
||||
unsafe {
|
||||
rooted!(in(*global.get_cx()) let mut module_script = CompileModule(
|
||||
rooted!(in(*global.get_cx()) let mut module_script = CompileModuleDontInflate(
|
||||
*global.get_cx(),
|
||||
compile_options.ptr,
|
||||
&mut transform_u16_to_source_text(&module),
|
||||
&mut transform_str_to_source_text(&module_script_text),
|
||||
));
|
||||
|
||||
if module_script.is_null() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue