aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/html/hubbub_html_parser.rs
diff options
context:
space:
mode:
authorKeegan McAllister <kmcallister@mozilla.com>2013-10-15 18:14:15 -0700
committerKeegan McAllister <kmcallister@mozilla.com>2013-10-16 14:59:05 -0700
commit279ae53b7bb05b0098fe9b27dff429b888f222a8 (patch)
treef4d564c47c6f48dee45a59a2f7a67cb784f72c95 /src/components/script/html/hubbub_html_parser.rs
parentc5399454016b9efb3ea4f3a073e9248fdfd073be (diff)
downloadservo-279ae53b7bb05b0098fe9b27dff429b888f222a8.tar.gz
servo-279ae53b7bb05b0098fe9b27dff429b888f222a8.zip
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.
Diffstat (limited to 'src/components/script/html/hubbub_html_parser.rs')
-rw-r--r--src/components/script/html/hubbub_html_parser.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index e5ccb6f2e83..b9892ac86a3 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -19,6 +19,7 @@ use std::cast;
use std::cell::Cell;
use std::comm;
use std::comm::{Port, SharedChan};
+use std::str;
use std::str::eq_slice;
use std::task;
use std::from_str::FromStr;
@@ -102,7 +103,7 @@ macro_rules! handle_element_base(
pub struct JSFile {
- data: ~[u8],
+ data: ~str,
url: Url
}
@@ -222,11 +223,11 @@ fn js_script_listener(to_parent: SharedChan<HtmlDiscoveryMessage>,
let bytes = result_port.recv();
if bytes.is_some() {
- result_vec.push(JSFile { data: bytes.unwrap(), url: url_clone });
+ result_vec.push(JSFile { data: str::from_utf8(bytes.unwrap()), url: url_clone });
}
}
JSTaskNewInlineScript(data, url) => {
- result_vec.push(JSFile { data: data.into_bytes(), url: url });
+ result_vec.push(JSFile { data: data, url: url });
}
JSTaskExit => {
break;