diff options
author | Keegan McAllister <kmcallister@mozilla.com> | 2014-02-11 14:53:19 -0800 |
---|---|---|
committer | Keegan McAllister <kmcallister@mozilla.com> | 2014-02-11 15:38:20 -0800 |
commit | 0a8ada86c52d9f850f635d1f963c504db6850de6 (patch) | |
tree | b924a541cd76c9c473ca9076666ee95a64500c5e | |
parent | 8a7cc86aa9759d7b49f7ba524e2f0d42c96bc59f (diff) | |
download | servo-0a8ada86c52d9f850f635d1f963c504db6850de6.tar.gz servo-0a8ada86c52d9f850f635d1f963c504db6850de6.zip |
Accept data: URLs on the command line without URL encoding
This facilitates quick testing, e.g.
./servo 'data:,<div style="color: red;">hi</div>'
-rwxr-xr-x | src/components/main/servo.rs | 13 |
1 files changed, 12 insertions, 1 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 |