diff options
author | Arjun Ramachandrula <arjun.ramachandrula@gmail.com> | 2020-07-27 21:45:20 -0400 |
---|---|---|
committer | Arjun Ramachandrula <arjun.ramachandrula@gmail.com> | 2020-07-27 21:45:20 -0400 |
commit | 60147105388fe7f5f95e019436d8027061330a47 (patch) | |
tree | a3e2792c5a0c5ddad03a61c1e7db8788db902c6b /components/script/dom/htmlscriptelement.rs | |
parent | 916d9e0e3d8574a991b1ac301e68395a8795d0bf (diff) | |
download | servo-60147105388fe7f5f95e019436d8027061330a47.tar.gz servo-60147105388fe7f5f95e019436d8027061330a47.zip |
Removed unnecessary conversion from UTF-8 to UTF-16
Diffstat (limited to 'components/script/dom/htmlscriptelement.rs')
-rw-r--r-- | components/script/dom/htmlscriptelement.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 39f8b912de9..b6e89d4027e 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -43,10 +43,10 @@ use html5ever::{LocalName, Prefix}; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use js::jsapi::{ - CanCompileOffThread, CompileOffThread, FinishOffThreadScript, Heap, JSScript, OffThreadToken, + CanCompileOffThread, CompileOffThread1, FinishOffThreadScript, Heap, JSScript, OffThreadToken, }; use js::jsval::UndefinedValue; -use js::rust::{transform_u16_to_source_text, CompileOptionsWrapper}; +use js::rust::{transform_str_to_source_text, CompileOptionsWrapper}; use msg::constellation_msg::PipelineId; use net_traits::request::{ CorsSettings, CredentialsMode, Destination, ParserMetadata, RequestBuilder, @@ -77,7 +77,6 @@ pub struct OffThreadCompilationContext { task_source: DOMManipulationTaskSource, canceller: TaskCanceller, script_text: String, - utf16_chars: Vec<u16>, fetch_options: ScriptFetchOptions, } @@ -433,7 +432,6 @@ impl FetchResponseListener for ClassicContext { if can_compile_off_thread { let source_string = source_text.to_string(); - let source_text: Vec<u16> = source_text.encode_utf16().collect(); let context = Box::new(OffThreadCompilationContext { script_element: self.elem.clone(), @@ -443,15 +441,14 @@ impl FetchResponseListener for ClassicContext { task_source: global.dom_manipulation_task_source(), canceller: global.task_canceller(TaskSourceName::DOMManipulation), script_text: source_string, - utf16_chars: source_text, fetch_options: self.fetch_options.clone(), }); unsafe { - assert!(CompileOffThread( + assert!(CompileOffThread1( *cx, options.ptr as *const _, - &mut transform_u16_to_source_text(&context.utf16_chars) as *mut _, + &mut transform_str_to_source_text(&context.script_text) as *mut _, Some(off_thread_compilation_callback), Box::into_raw(context) as *mut c_void, )); |