Remove the url! plugin.

In rust-url 1.0 the `Url` struct is going to have private fields, and there
is no way to to create an aribitrary one without going through the parser.

The plugin never had a clear demonstrated performance benefit,
it was made mostly because it was possible and relatively easy at the time.
This commit is contained in:
Simon Sapin 2016-02-26 17:01:51 +01:00
parent 87d5424d4d
commit 6889f37d9e
27 changed files with 84 additions and 296 deletions

View file

@ -7,6 +7,7 @@ extern crate cookie as cookie_rs;
use net::cookie::Cookie;
use net::cookie_storage::CookieStorage;
use net_traits::CookieSource;
use url::Url;
#[test]
fn test_domain_match() {
@ -56,9 +57,9 @@ fn test_default_path() {
fn fn_cookie_constructor() {
use net_traits::CookieSource;
let url = &url!("http://example.com/foo");
let url = &Url::parse("http://example.com/foo").unwrap();
let gov_url = &url!("http://gov.ac/foo");
let gov_url = &Url::parse("http://gov.ac/foo").unwrap();
// cookie name/value test
assert!(cookie_rs::Cookie::parse(" baz ").is_err());
assert!(cookie_rs::Cookie::parse(" = bar ").is_err());
@ -94,7 +95,7 @@ fn fn_cookie_constructor() {
assert!(&cookie.cookie.domain.as_ref().unwrap()[..] == "example.com");
assert!(cookie.host_only);
let u = &url!("http://example.com/foobar");
let u = &Url::parse("http://example.com/foobar").unwrap();
let cookie = cookie_rs::Cookie::parse("foobar=value;path=/").unwrap();
assert!(Cookie::new_wrapped(cookie, u, CookieSource::HTTP).is_some());
}
@ -117,7 +118,7 @@ fn delay_to_ensure_different_timestamp() {
fn test_sort_order() {
use std::cmp::Ordering;
let url = &url!("http://example.com/foo");
let url = &Url::parse("http://example.com/foo").unwrap();
let a_wrapped = cookie_rs::Cookie::parse("baz=bar; Path=/foo/bar/").unwrap();
let a = Cookie::new_wrapped(a_wrapped.clone(), url, CookieSource::HTTP).unwrap();
delay_to_ensure_different_timestamp();

View file

@ -6,6 +6,7 @@ use net::hsts::{HSTSList, HSTSEntry};
use net::hsts::{secure_url, preload_hsts_domains};
use net_traits::IncludeSubdomains;
use time;
use url::Url;
#[test]
fn test_hsts_entry_is_not_expired_when_it_has_no_timestamp() {
@ -255,7 +256,7 @@ fn test_preload_hsts_domains_well_formed() {
#[test]
fn test_secure_url_does_not_change_explicit_port() {
let url = url!("http://mozilla.org:8080/");
let url = Url::parse("http://mozilla.org:8080/").unwrap();
let secure = secure_url(&url);
assert!(secure.port().unwrap() == 8080u16);
@ -263,7 +264,7 @@ fn test_secure_url_does_not_change_explicit_port() {
#[test]
fn test_secure_url_does_not_affect_non_http_schemas() {
let url = url!("file://mozilla.org");
let url = Url::parse("file://mozilla.org").unwrap();
let secure = secure_url(&url);
assert_eq!(&secure.scheme, "file");
@ -271,7 +272,7 @@ fn test_secure_url_does_not_affect_non_http_schemas() {
#[test]
fn test_secure_url_forces_an_http_host_in_list_to_https() {
let url = url!("http://mozilla.org");
let url = Url::parse("http://mozilla.org").unwrap();
let secure = secure_url(&url);
assert_eq!(&secure.scheme, "https");

View file

@ -372,7 +372,7 @@ fn expect_devtools_http_response(devtools_port: &Receiver<DevtoolsControlMsg>) -
#[test]
fn test_check_default_headers_loaded_in_every_request() {
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let http_state = HttpState::new();
@ -415,7 +415,7 @@ fn test_check_default_headers_loaded_in_every_request() {
#[test]
fn test_load_when_request_is_not_get_or_head_and_there_is_no_body_content_length_should_be_set_to_0() {
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let http_state = HttpState::new();
@ -452,7 +452,7 @@ fn test_request_and_response_data_with_network_messages() {
let http_state = HttpState::new();
let url = url!("https://mozilla.com");
let url = Url::parse("https://mozilla.com").unwrap();
let (devtools_chan, devtools_port) = mpsc::channel::<DevtoolsControlMsg>();
// This will probably have to be changed as it uses fake_root_pipeline_id which is marked for removal.
let pipeline_id = PipelineId::fake_root_pipeline_id();
@ -526,7 +526,7 @@ fn test_request_and_response_message_from_devtool_without_pipeline_id() {
let http_state = HttpState::new();
let url = url!("https://mozilla.com");
let url = Url::parse("https://mozilla.com").unwrap();
let (devtools_chan, devtools_port) = mpsc::channel::<DevtoolsControlMsg>();
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
let _ = load::<MockRequest>(load_data, &http_state, Some(devtools_chan), &Factory,
@ -556,7 +556,7 @@ fn test_load_when_redirecting_from_a_post_should_rewrite_next_request_as_get() {
}
}
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let mut load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
load_data.method = Method::Post;
@ -584,7 +584,7 @@ fn test_load_should_decode_the_response_as_deflate_when_response_headers_have_co
}
}
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
let http_state = HttpState::new();
@ -617,7 +617,7 @@ fn test_load_should_decode_the_response_as_gzip_when_response_headers_have_conte
}
}
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
let http_state = HttpState::new();
@ -658,7 +658,7 @@ fn test_load_doesnt_send_request_body_on_any_redirect() {
}
}
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let mut load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
load_data.data = Some(<[_]>::to_vec("Body on POST!".as_bytes()));
@ -687,7 +687,7 @@ fn test_load_doesnt_add_host_to_sts_list_when_url_is_http_even_if_sts_headers_ar
}
}
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
@ -718,7 +718,7 @@ fn test_load_adds_host_to_sts_list_when_url_is_https_and_sts_headers_are_present
}
}
let url = url!("https://mozilla.com");
let url = Url::parse("https://mozilla.com").unwrap();
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
@ -749,7 +749,7 @@ fn test_load_sets_cookies_in_the_resource_manager_when_it_get_set_cookie_header_
}
}
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let http_state = HttpState::new();
@ -769,7 +769,7 @@ fn test_load_sets_cookies_in_the_resource_manager_when_it_get_set_cookie_header_
#[test]
fn test_load_sets_requests_cookies_header_for_url_by_getting_cookies_from_the_resource_manager() {
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let mut load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
load_data.data = Some(<[_]>::to_vec("Yay!".as_bytes()));
@ -800,8 +800,8 @@ fn test_load_sets_requests_cookies_header_for_url_by_getting_cookies_from_the_re
#[test]
fn test_load_sends_secure_cookie_if_http_changed_to_https_due_to_entry_in_hsts_store() {
let url = url!("http://mozilla.com");
let secured_url = url!("https://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let secured_url = Url::parse("https://mozilla.com").unwrap();
let http_state = HttpState::new();
{
@ -842,7 +842,7 @@ fn test_load_sends_secure_cookie_if_http_changed_to_https_due_to_entry_in_hsts_s
#[test]
fn test_load_sends_cookie_if_nonhttp() {
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let http_state = HttpState::new();
@ -886,7 +886,7 @@ fn test_cookie_set_with_httponly_should_not_be_available_using_getcookiesforurl(
}
}
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let http_state = HttpState::new();
@ -919,7 +919,7 @@ fn test_when_cookie_received_marked_secure_is_ignored_for_http() {
let http_state = HttpState::new();
let load_data = LoadData::new(LoadContext::Browsing, url!("http://mozilla.com"), None);
let load_data = LoadData::new(LoadContext::Browsing, Url::parse("http://mozilla.com").unwrap(), None);
let _ = load::<MockRequest>(load_data,
&http_state,
None,
@ -933,8 +933,8 @@ fn test_when_cookie_received_marked_secure_is_ignored_for_http() {
#[test]
fn test_when_cookie_set_marked_httpsonly_secure_isnt_sent_on_http_request() {
let sec_url = url!("https://mozilla.com");
let url = url!("http://mozilla.com");
let sec_url = Url::parse("https://mozilla.com").unwrap();
let url = Url::parse("http://mozilla.com").unwrap();
let http_state = HttpState::new();
@ -966,7 +966,7 @@ fn test_when_cookie_set_marked_httpsonly_secure_isnt_sent_on_http_request() {
fn test_load_sets_content_length_to_length_of_request_body() {
let content = "This is a request body";
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let mut load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
load_data.data = Some(<[_]>::to_vec(content.as_bytes()));
@ -990,7 +990,7 @@ fn test_load_uses_explicit_accept_from_headers_in_load_data() {
let mut accept_headers = Headers::new();
accept_headers.set(Accept(vec![text_html.clone()]));
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let mut load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
load_data.data = Some(<[_]>::to_vec("Yay!".as_bytes()));
load_data.headers.set(Accept(vec![text_html.clone()]));
@ -1017,7 +1017,7 @@ fn test_load_sets_default_accept_to_html_xhtml_xml_and_then_anything_else() {
QualityItem::new(Mime(TopLevel::Star, SubLevel::Star, vec![]), Quality(800)),
]));
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let mut load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
load_data.data = Some(<[_]>::to_vec("Yay!".as_bytes()));
@ -1038,7 +1038,7 @@ fn test_load_uses_explicit_accept_encoding_from_load_data_headers() {
let mut accept_encoding_headers = Headers::new();
accept_encoding_headers.set(AcceptEncoding(vec![qitem(Encoding::Chunked)]));
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let mut load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
load_data.data = Some(<[_]>::to_vec("Yay!".as_bytes()));
load_data.headers.set(AcceptEncoding(vec![qitem(Encoding::Chunked)]));
@ -1062,7 +1062,7 @@ fn test_load_sets_default_accept_encoding_to_gzip_and_deflate() {
qitem(Encoding::Deflate),
qitem(Encoding::EncodingExt("br".to_owned()))]));
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let mut load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
load_data.data = Some(<[_]>::to_vec("Yay!".as_bytes()));
@ -1096,7 +1096,7 @@ fn test_load_errors_when_there_a_redirect_loop() {
}
}
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
let http_state = HttpState::new();
@ -1126,7 +1126,7 @@ fn test_load_errors_when_there_is_too_many_redirects() {
}
}
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
let http_state = HttpState::new();
@ -1164,7 +1164,7 @@ fn test_load_follows_a_redirect() {
}
}
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
let http_state = HttpState::new();
@ -1191,7 +1191,7 @@ impl HttpRequestFactory for DontConnectFactory {
#[test]
fn test_load_errors_when_scheme_is_not_http_or_https() {
let url = url!("ftp://not-supported");
let url = Url::parse("ftp://not-supported").unwrap();
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
let http_state = HttpState::new();
@ -1209,7 +1209,7 @@ fn test_load_errors_when_scheme_is_not_http_or_https() {
#[test]
fn test_load_errors_when_viewing_source_and_inner_url_scheme_is_not_http_or_https() {
let url = url!("view-source:ftp://not-supported");
let url = Url::parse("view-source:ftp://not-supported").unwrap();
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
let http_state = HttpState::new();
@ -1251,7 +1251,7 @@ fn test_load_errors_when_cancelled() {
let cancel_listener = CancellationListener::new(Some(cancel_resource));
cancel_sender.send(()).unwrap();
let url = url!("https://mozilla.com");
let url = Url::parse("https://mozilla.com").unwrap();
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), None);
let http_state = HttpState::new();
@ -1268,8 +1268,8 @@ fn test_load_errors_when_cancelled() {
#[test]
fn test_redirect_from_x_to_y_provides_y_cookies_from_y() {
let url_x = url!("http://mozilla.com");
let url_y = url!("http://mozilla.org");
let url_x = Url::parse("http://mozilla.com").unwrap();
let url_y = Url::parse("http://mozilla.org").unwrap();
struct Factory;
@ -1338,7 +1338,7 @@ fn test_redirect_from_x_to_y_provides_y_cookies_from_y() {
#[test]
fn test_redirect_from_x_to_x_provides_x_with_cookie_from_first_response() {
let url = url!("http://mozilla.org/initial/");
let url = Url::parse("http://mozilla.org/initial/").unwrap();
struct Factory;
@ -1385,7 +1385,7 @@ fn test_redirect_from_x_to_x_provides_x_with_cookie_from_first_response() {
#[test]
fn test_if_auth_creds_not_in_url_but_in_cache_it_sets_it() {
let url = url!("http://mozilla.com");
let url = Url::parse("http://mozilla.com").unwrap();
let http_state = HttpState::new();

View file

@ -21,7 +21,7 @@ fn test_exit() {
fn test_bad_scheme() {
let resource_thread = new_resource_thread("".to_owned(), None);
let (start_chan, start) = ipc::channel().unwrap();
let url = url!("bogus://whatever");
let url = Url::parse("bogus://whatever").unwrap();
resource_thread.send(ControlMsg::Load(LoadData::new(LoadContext::Browsing, url, None),
LoadConsumer::Channel(start_chan), None)).unwrap();
let response = start.recv().unwrap();
@ -156,13 +156,13 @@ fn test_replace_hosts() {
host_table.insert("foo.bar.com".to_owned(), "127.0.0.1".to_owned());
host_table.insert("servo.test.server".to_owned(), "127.0.0.2".to_owned());
let url = url!("http://foo.bar.com:8000/foo");
let url = Url::parse("http://foo.bar.com:8000/foo").unwrap();
assert_eq!(host_replacement(&host_table, &url).domain().unwrap(), "127.0.0.1");
let url = url!("http://servo.test.server");
let url = Url::parse("http://servo.test.server").unwrap();
assert_eq!(host_replacement(&host_table, &url).domain().unwrap(), "127.0.0.2");
let url = url!("http://a.foo.bar.com");
let url = Url::parse("http://a.foo.bar.com").unwrap();
assert_eq!(host_replacement(&host_table, &url).domain().unwrap(), "a.foo.bar.com");
}

View file

@ -1,15 +0,0 @@
[package]
name = "plugin_tests"
version = "0.0.1"
authors = ["The Servo Project Developers"]
[lib]
name = "plugin_tests"
path = "lib.rs"
doctest = false
[dependencies.plugins]
path = "../../../components/plugins"
[dependencies]
url = {version = "0.5.7", features = ["heap_size"]}

View file

@ -1,11 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(plugin)]
#![plugin(plugins)]
extern crate url;
#[cfg(test)]
mod url_plugin;

View file

@ -1,24 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[test]
fn test_url_plugin() {
assert_eq!("ftp://google.com/",
url!("ftp://google.com").to_string());
assert_eq!("ftp://google.com:443/",
url!("ftp://google.com:443").to_string());
assert_eq!("ftp://google.com:443/a/b/c",
url!("ftp://google.com:443/a/b/c").to_string());
assert_eq!("ftp://google.com:443/?a=b&c=d",
url!("ftp://google.com:443?a=b&c=d").to_string());
assert_eq!("http://[2001::1]/",
url!("http://[2001::1]:80").to_string());
assert_eq!("about:blank",
url!("about:blank").to_string());
}

View file

@ -3,32 +3,33 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use script::origin::Origin;
use url::Url;
#[test]
fn same_origin() {
let a = Origin::new(&url!("http://example.com/a.html"));
let b = Origin::new(&url!("http://example.com/b.html"));
let a = Origin::new(&Url::parse("http://example.com/a.html").unwrap());
let b = Origin::new(&Url::parse("http://example.com/b.html").unwrap());
assert!(a.same_origin(&b));
assert_eq!(a.is_scheme_host_port_tuple(), true);
}
#[test]
fn identical_origin() {
let a = Origin::new(&url!("http://example.com/a.html"));
let a = Origin::new(&Url::parse("http://example.com/a.html").unwrap());
assert!(a.same_origin(&a));
}
#[test]
fn cross_origin() {
let a = Origin::new(&url!("http://example.com/a.html"));
let b = Origin::new(&url!("http://example.org/b.html"));
let a = Origin::new(&Url::parse("http://example.com/a.html").unwrap());
let b = Origin::new(&Url::parse("http://example.org/b.html").unwrap());
assert!(!a.same_origin(&b));
}
#[test]
fn alias_same_origin() {
let a = Origin::new(&url!("http://example.com/a.html"));
let b = Origin::new(&url!("http://example.com/b.html"));
let a = Origin::new(&Url::parse("http://example.com/a.html").unwrap());
let b = Origin::new(&Url::parse("http://example.com/b.html").unwrap());
let c = b.alias();
assert!(a.same_origin(&c));
assert!(b.same_origin(&b));
@ -38,8 +39,8 @@ fn alias_same_origin() {
#[test]
fn alias_cross_origin() {
let a = Origin::new(&url!("http://example.com/a.html"));
let b = Origin::new(&url!("http://example.org/b.html"));
let a = Origin::new(&Url::parse("http://example.com/a.html").unwrap());
let b = Origin::new(&Url::parse("http://example.org/b.html").unwrap());
let c = b.alias();
assert!(!a.same_origin(&c));
assert!(b.same_origin(&c));
@ -48,10 +49,10 @@ fn alias_cross_origin() {
#[test]
fn alias_update_same_origin() {
let a = Origin::new(&url!("http://example.com/a.html"));
let b = Origin::new(&url!("http://example.org/b.html"));
let a = Origin::new(&Url::parse("http://example.com/a.html").unwrap());
let b = Origin::new(&Url::parse("http://example.org/b.html").unwrap());
let c = b.alias();
b.set(url!("http://example.com/c.html").origin());
b.set(Url::parse("http://example.com/c.html").unwrap().origin());
assert!(a.same_origin(&c));
assert!(b.same_origin(&c));
assert!(c.same_origin(&c));
@ -59,10 +60,10 @@ fn alias_update_same_origin() {
#[test]
fn alias_update_cross_origin() {
let a = Origin::new(&url!("http://example.com/a.html"));
let b = Origin::new(&url!("http://example.com/b.html"));
let a = Origin::new(&Url::parse("http://example.com/a.html").unwrap());
let b = Origin::new(&Url::parse("http://example.com/b.html").unwrap());
let c = b.alias();
b.set(url!("http://example.org/c.html").origin());
b.set(Url::parse("http://example.org/c.html").unwrap().origin());
assert!(!a.same_origin(&c));
assert!(b.same_origin(&c));
assert!(c.same_origin(&c));
@ -70,8 +71,8 @@ fn alias_update_cross_origin() {
#[test]
fn alias_chain() {
let a = Origin::new(&url!("http://example.com/a.html"));
let b = Origin::new(&url!("http://example.com/b.html"));
let a = Origin::new(&Url::parse("http://example.com/a.html").unwrap());
let b = Origin::new(&Url::parse("http://example.com/b.html").unwrap());
let c = b.copy();
let d = c.alias();
let e = d.alias();
@ -80,7 +81,7 @@ fn alias_chain() {
assert!(c.same_origin(&e));
assert!(d.same_origin(&e));
assert!(e.same_origin(&e));
c.set(url!("http://example.org/c.html").origin());
c.set(Url::parse("http://example.org/c.html").unwrap().origin());
assert!(a.same_origin(&b));
assert!(!b.same_origin(&c));
assert!(c.same_origin(&d));

View file

@ -11,6 +11,7 @@ use style::media_queries::*;
use style::servo::Stylesheet;
use style::stylesheets::{Origin, CSSRuleIteratorExt};
use style::values::specified;
use url::Url;
pub struct CSSErrorReporterTest;
@ -23,7 +24,7 @@ impl ParseErrorReporter for CSSErrorReporterTest {
}
fn test_media_rule<F>(css: &str, callback: F) where F: Fn(&MediaQueryList, &str) {
let url = url!("http://localhost");
let url = Url::parse("http://localhost").unwrap();
let stylesheet = Stylesheet::from_str(css, url, Origin::Author, Box::new(CSSErrorReporterTest));
let mut rule_count = 0;
for rule in stylesheet.rules().media() {
@ -34,7 +35,7 @@ fn test_media_rule<F>(css: &str, callback: F) where F: Fn(&MediaQueryList, &str)
}
fn media_query_test(device: &Device, css: &str, expected_rule_count: usize) {
let url = url!("http://localhost");
let url = Url::parse("http://localhost").unwrap();
let ss = Stylesheet::from_str(css, url, Origin::Author, Box::new(CSSErrorReporterTest));
let rule_count = ss.effective_rules(device).style().count();
assert!(rule_count == expected_rule_count, css.to_owned());

View file

@ -13,6 +13,7 @@ use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, DeclaredV
use style::stylesheets::{CSSRule, StyleRule, Origin};
use style::error_reporting::ParseErrorReporter;
use style::servo::Stylesheet;
use url::Url;
#[test]
fn test_parse_stylesheet() {
@ -23,7 +24,7 @@ fn test_parse_stylesheet() {
html , body /**/ { display: block; }
#d1 > .ok { background: blue; }
";
let url = url!("about::test");
let url = Url::parse("about::test").unwrap();
let stylesheet = Stylesheet::from_str(css, url, Origin::UserAgent,
Box::new(CSSErrorReporterTest));
assert_eq!(stylesheet, Stylesheet {
@ -198,7 +199,7 @@ fn test_report_error_stylesheet() {
invalid: true;
}
";
let url = url!("about::test");
let url = Url::parse("about::test").unwrap();
let error_reporter = Box::new(CSSInvalidErrorReporterTest::new());
let errors = error_reporter.errors.clone();

View file

@ -16,10 +16,11 @@ use style::values::specified::LengthOrPercentageOrAuto::{self, Auto};
use style::values::specified::ViewportPercentageLength::Vw;
use style::viewport::*;
use style_traits::viewport::*;
use url::Url;
macro_rules! stylesheet {
($css:expr, $origin:ident, $error_reporter:expr) => {
Stylesheet::from_str($css, url!("http://localhost"), Origin::$origin, $error_reporter);
Stylesheet::from_str($css, Url::parse("http://localhost").unwrap(), Origin::$origin, $error_reporter);
}
}
@ -279,7 +280,7 @@ fn multiple_stylesheets_cascading() {
#[test]
fn constrain_viewport() {
let url = url!("http://localhost");
let url = Url::parse("http://localhost").unwrap();
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
macro_rules! from_css {