Pass scripts as ~str to support non-ASCII string literals etc.

Of course scripts on the Web are not always encoded as UTF-8 and we will have
to deal with that at some point.
This commit is contained in:
Keegan McAllister 2013-10-15 18:14:15 -07:00
parent c539945401
commit 279ae53b7b
3 changed files with 7 additions and 5 deletions

View file

@ -30,6 +30,7 @@ use std::comm;
use std::comm::{Port, SharedChan};
use std::io::read_whole_file;
use std::ptr;
use std::str;
use std::task::{spawn_sched, SingleThreaded};
use std::util::replace;
use dom::window::TimerData;
@ -578,7 +579,7 @@ impl ScriptTask {
Ok(bytes) => {
compartment.define_functions(debug_fns);
cx.evaluate_script(compartment.global_obj,
bytes,
str::from_utf8(bytes),
url.path.clone(),
1);
}