mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Implement 'url!(..)' macro
https://github.com/servo/rust-url/issues/136 https://github.com/servo/rust-url/pull/137
This commit is contained in:
parent
0146751bb2
commit
f34da4120d
30 changed files with 346 additions and 128 deletions
|
@ -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() {
|
||||
|
|
|
@ -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"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue