mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Merge pull request #2913 from Ms2ger/url-clone
Avoid an unnecessary clone of the base URL in parse_html(); r=jdm
This commit is contained in:
commit
302480765b
1 changed files with 3 additions and 3 deletions
|
@ -319,7 +319,7 @@ pub fn parse_html(page: &Page,
|
|||
|
||||
debug!("Fetched page; metadata is {:?}", load_response.metadata);
|
||||
|
||||
let base_url = load_response.metadata.final_url.clone();
|
||||
let base_url = &load_response.metadata.final_url;
|
||||
|
||||
{
|
||||
// Store the final URL before we start parsing, so that DOM routines
|
||||
|
@ -414,7 +414,7 @@ pub fn parse_html(page: &Page,
|
|||
s.as_slice().eq_ignore_ascii_case("stylesheet")
|
||||
}) => {
|
||||
debug!("found CSS stylesheet: {:s}", *href);
|
||||
match UrlParser::new().base_url(&base_url).parse(href.as_slice()) {
|
||||
match UrlParser::new().base_url(base_url).parse(href.as_slice()) {
|
||||
Ok(url) => css_chan2.send(CSSTaskNewFile(
|
||||
UrlProvenance(url, resource_task.clone()))),
|
||||
Err(e) => debug!("Parsing url {:s} failed: {:s}", *href, e)
|
||||
|
@ -498,7 +498,7 @@ pub fn parse_html(page: &Page,
|
|||
match script.get_attribute(Null, "src").root() {
|
||||
Some(src) => {
|
||||
debug!("found script: {:s}", src.deref().Value());
|
||||
match UrlParser::new().base_url(&base_url)
|
||||
match UrlParser::new().base_url(base_url)
|
||||
.parse(src.deref().value().as_slice()) {
|
||||
Ok(new_url) => js_chan2.send(JSTaskNewFile(new_url)),
|
||||
Err(e) => debug!("Parsing url {:s} failed: {:s}", src.deref().Value(), e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue