mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Accept data: URLs on the command line without URL encoding
This facilitates quick testing, e.g. ./servo 'data:,<div style="color: red;">hi</div>'
This commit is contained in:
parent
8a7cc86aa9
commit
0a8ada86c5
1 changed files with 12 additions and 1 deletions
|
@ -62,6 +62,8 @@ pub use servo_util::url::parse_url;
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
use std::os;
|
use std::os;
|
||||||
|
#[cfg(not(test))]
|
||||||
|
use extra::url::Url;
|
||||||
#[cfg(not(test), target_os="android")]
|
#[cfg(not(test), target_os="android")]
|
||||||
use std::str;
|
use std::str;
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
|
@ -166,7 +168,16 @@ fn run(opts: Opts) {
|
||||||
|
|
||||||
// Send the URL command to the constellation.
|
// Send the URL command to the constellation.
|
||||||
for filename in opts.urls.iter() {
|
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
|
// Send the constallation Chan as the result
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue