aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/components/main/servo.rs13
-rw-r--r--src/components/util/url.rs12
-rw-r--r--src/test/html/simple_iframe.html7
-rw-r--r--src/test/html/simple_iframe_inner.html5
-rw-r--r--src/test/ref/basic.list1
-rw-r--r--src/test/ref/data_img_a.html (renamed from src/test/html/data-url.html)0
-rw-r--r--src/test/ref/data_img_b.html9
-rw-r--r--src/test/ref/img_size_a.html6
-rw-r--r--src/test/ref/img_size_b.html6
-rw-r--r--src/test/ref/rust_logo.png (renamed from src/test/ref/img_size.png)bin4399 -> 4399 bytes
10 files changed, 46 insertions, 13 deletions
diff --git a/src/components/main/servo.rs b/src/components/main/servo.rs
index 86f1602754c..b21c292255b 100755
--- a/src/components/main/servo.rs
+++ b/src/components/main/servo.rs
@@ -62,6 +62,8 @@ pub use servo_util::url::parse_url;
#[cfg(not(test))]
use std::os;
+#[cfg(not(test))]
+use extra::url::Url;
#[cfg(not(test), target_os="android")]
use std::str;
#[cfg(not(test))]
@@ -166,7 +168,16 @@ fn run(opts: Opts) {
// Send the URL command to the constellation.
for filename in opts.urls.iter() {
- constellation_chan.send(InitLoadUrlMsg(parse_url(*filename, None)))
+ let url = if filename.starts_with("data:") {
+ // As a hack for easier command-line testing,
+ // assume that data URLs are not URL-encoded.
+ Url::new(~"data", None, ~"", None,
+ filename.slice_from(5).to_owned(), ~[], None)
+ } else {
+ parse_url(*filename, None)
+ };
+
+ constellation_chan.send(InitLoadUrlMsg(url));
}
// Send the constallation Chan as the result
diff --git a/src/components/util/url.rs b/src/components/util/url.rs
index 708b8d57aa2..5010c374769 100644
--- a/src/components/util/url.rs
+++ b/src/components/util/url.rs
@@ -56,10 +56,10 @@ pub fn parse_url(str_url: &str, base_url: Option<Url>) -> Url {
}
},
Ok((scheme, page)) => {
- match scheme {
- ~"about" => {
- match page {
- ~"failure" => {
+ match scheme.as_slice() {
+ "about" => {
+ match page.as_slice() {
+ "failure" => {
let mut path = os::getcwd();
path.push("../src/test/html/failure.html");
// FIXME (#1094): not the right way to transform a path
@@ -69,7 +69,7 @@ pub fn parse_url(str_url: &str, base_url: Option<Url>) -> Url {
_ => str_url
}
},
- ~"data" => {
+ "data" => {
// Drop whitespace within data: URLs, e.g. newlines within a base64
// src="..." block. Whitespace intended as content should be
// %-encoded or base64'd.
@@ -81,7 +81,7 @@ pub fn parse_url(str_url: &str, base_url: Option<Url>) -> Url {
};
// FIXME: Need to handle errors
- url::from_str(str_url).unwrap()
+ url::from_str(str_url).ok().expect("URL parsing failed")
}
#[cfg(test)]
diff --git a/src/test/html/simple_iframe.html b/src/test/html/simple_iframe.html
new file mode 100644
index 00000000000..e02aab29af5
--- /dev/null
+++ b/src/test/html/simple_iframe.html
@@ -0,0 +1,7 @@
+<html>
+<body>
+ <iframe src="simple_iframe_inner.html"
+ style="display:block; border: 1px; width: 400px; height: 400px">
+ </iframe>
+</body>
+</html>
diff --git a/src/test/html/simple_iframe_inner.html b/src/test/html/simple_iframe_inner.html
new file mode 100644
index 00000000000..221c287c6f3
--- /dev/null
+++ b/src/test/html/simple_iframe_inner.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+Just a simple little iframe.
+</body>
+</html>
diff --git a/src/test/ref/basic.list b/src/test/ref/basic.list
index 16ff2c93568..290a00741ca 100644
--- a/src/test/ref/basic.list
+++ b/src/test/ref/basic.list
@@ -28,3 +28,4 @@
== anon_block_inherit_a.html anon_block_inherit_b.html
== position_relative_a.html position_relative_b.html
== attr_exists_selector.html attr_exists_selector_ref.html
+== data_img_a.html data_img_b.html
diff --git a/src/test/html/data-url.html b/src/test/ref/data_img_a.html
index ce69991bc46..ce69991bc46 100644
--- a/src/test/html/data-url.html
+++ b/src/test/ref/data_img_a.html
diff --git a/src/test/ref/data_img_b.html b/src/test/ref/data_img_b.html
new file mode 100644
index 00000000000..265d57ec76b
--- /dev/null
+++ b/src/test/ref/data_img_b.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8" />
+</head>
+<body>
+<img src="rust_logo.png" />
+</body>
+</html>
diff --git a/src/test/ref/img_size_a.html b/src/test/ref/img_size_a.html
index bcfa30137d0..a96abad3736 100644
--- a/src/test/ref/img_size_a.html
+++ b/src/test/ref/img_size_a.html
@@ -6,13 +6,13 @@
</head>
<body>
<div>
- <img src="img_size.png" width="206" />
+ <img src="rust_logo.png" width="206" />
</div>
<div>
- <img src="img_size.png" width="206" />
+ <img src="rust_logo.png" width="206" />
</div>
<div style="width:1000px">
- <img src="img_size.png" style="width:100px" />
+ <img src="rust_logo.png" style="width:100px" />
</div>
</body>
</html>
diff --git a/src/test/ref/img_size_b.html b/src/test/ref/img_size_b.html
index d0cf3da554d..ee21881dfdb 100644
--- a/src/test/ref/img_size_b.html
+++ b/src/test/ref/img_size_b.html
@@ -6,13 +6,13 @@
</head>
<body>
<div>
- <img src="img_size.png" height="206" />
+ <img src="rust_logo.png" height="206" />
</div>
<div>
- <img src="img_size.png" style="height:206px"/>
+ <img src="rust_logo.png" style="height:206px"/>
</div>
<div style="width:1000px">
- <img src="img_size.png" style="width:10%" />
+ <img src="rust_logo.png" style="width:10%" />
</div>
</body>
</html>
diff --git a/src/test/ref/img_size.png b/src/test/ref/rust_logo.png
index 20d93badf5e..20d93badf5e 100644
--- a/src/test/ref/img_size.png
+++ b/src/test/ref/rust_logo.png
Binary files differ