Auto merge of #8622 - frewsxcv:url-plugin, r=SimonSapin

Implement 'url!(..)' macro

https://github.com/servo/rust-url/issues/136

https://github.com/servo/rust-url/pull/137

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8622)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-11-21 21:10:52 +05:30
commit ea690a2dff
30 changed files with 346 additions and 128 deletions

View file

@ -112,7 +112,7 @@ fn parse_one_src(context: &ParserContext, input: &mut Parser) -> Result<Source,
}
let url = try!(input.expect_url());
let url = UrlParser::new().base_url(context.base_url).parse(&url).unwrap_or_else(
|_error| Url::parse("about:invalid").unwrap());
|_error| url!("about:invalid"));
// Parsing optional format()
let format_hints = if input.try(|input| input.expect_function_matching("format")).is_ok() {

View file

@ -31,7 +31,7 @@ impl<'a> ParserContext<'a> {
impl<'a> ParserContext<'a> {
pub fn parse_url(&self, input: &str) -> Url {
UrlParser::new().base_url(self.base_url).parse(input)
.unwrap_or_else(|_| Url::parse("about:invalid").unwrap())
.unwrap_or_else(|_| url!("about:invalid"))
}
}

View file

@ -61,7 +61,7 @@ lazy_static! {
Ok(res) => {
Stylesheet::from_bytes(
&res,
Url::parse("chrome:///quirks-mode.css").unwrap(),
url!("chrome:///quirks-mode.css"),
None,
None,
Origin::UserAgent)