mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Added off thread compilation
Co-authored-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com> Co-authored-by: Abhishek Sharma <20724848+AbhishekSharma102@users.noreply.github.com>
This commit is contained in:
parent
bfb7bea704
commit
1119dd119e
8 changed files with 310 additions and 85 deletions
|
@ -4,14 +4,17 @@
|
|||
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::refcounted::Trusted;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::htmlheadelement::HTMLHeadElement;
|
||||
use crate::dom::htmlscriptelement::SourceCode;
|
||||
use crate::dom::node::document_from_node;
|
||||
use crate::script_module::ScriptFetchOptions;
|
||||
use js::jsval::UndefinedValue;
|
||||
use std::fs::{read_dir, File};
|
||||
use std::io::Read;
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub fn load_script(head: &HTMLHeadElement) {
|
||||
let doc = document_from_node(head);
|
||||
|
@ -38,7 +41,9 @@ pub fn load_script(head: &HTMLHeadElement) {
|
|||
let mut f = File::open(&file).unwrap();
|
||||
let mut contents = vec![];
|
||||
f.read_to_end(&mut contents).unwrap();
|
||||
let script_text = String::from_utf8_lossy(&contents);
|
||||
let script_text = SourceCode::Text(
|
||||
Rc::new(DOMString::from_string(String::from_utf8_lossy(&contents).to_string()))
|
||||
);
|
||||
let global = win.upcast::<GlobalScope>();
|
||||
global.evaluate_script_on_global_with_result(
|
||||
&script_text,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue