diff options
author | chansuke <chansuke@georepublic.de> | 2018-09-18 23:24:15 +0900 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2018-09-19 17:40:47 -0400 |
commit | c37a345dc9f4dda6ea29c42f96f6c7201c42cbac (patch) | |
tree | 1f05b49bac02318455a59d5b143c186fd872bdb9 /components/script/dom/userscripts.rs | |
parent | 2ca7a134736bb4759ff209c1bc0b6dc3cc1984c9 (diff) | |
download | servo-c37a345dc9f4dda6ea29c42f96f6c7201c42cbac.tar.gz servo-c37a345dc9f4dda6ea29c42f96f6c7201c42cbac.zip |
Format script component
Diffstat (limited to 'components/script/dom/userscripts.rs')
-rw-r--r-- | components/script/dom/userscripts.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/components/script/dom/userscripts.rs b/components/script/dom/userscripts.rs index e2db3e4cfe0..1180b0c8279 100644 --- a/components/script/dom/userscripts.rs +++ b/components/script/dom/userscripts.rs @@ -12,7 +12,6 @@ use std::fs::{File, read_dir}; use std::io::Read; use std::path::PathBuf; - pub fn load_script(head: &HTMLHeadElement) { if let Some(ref path_str) = opts::get().userscripts { let node = head.upcast::<Node>(); @@ -22,9 +21,11 @@ pub fn load_script(head: &HTMLHeadElement) { rooted!(in(cx) let mut rval = UndefinedValue()); let path = PathBuf::from(path_str); - let mut files = read_dir(&path).expect("Bad path passed to --userscripts") - .filter_map(|e| e.ok()) - .map(|e| e.path()).collect::<Vec<_>>(); + let mut files = read_dir(&path) + .expect("Bad path passed to --userscripts") + .filter_map(|e| e.ok()) + .map(|e| e.path()) + .collect::<Vec<_>>(); files.sort(); @@ -33,7 +34,8 @@ pub fn load_script(head: &HTMLHeadElement) { let mut contents = vec![]; f.read_to_end(&mut contents).unwrap(); let script_text = String::from_utf8_lossy(&contents); - win.upcast::<GlobalScope>().evaluate_js_on_global_with_result(&script_text, rval.handle_mut()); + win.upcast::<GlobalScope>() + .evaluate_js_on_global_with_result(&script_text, rval.handle_mut()); } } } |