Skip to content

Commit

Permalink
Don't re-parse dummy base URL every time in GeckoElement::style_attri…
Browse files Browse the repository at this point in the history
…bute.
  • Loading branch information
heycam committed May 26, 2016
1 parent 92ae502 commit 94ce097
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ports/geckolib/wrapper.rs
Expand Up @@ -314,6 +314,12 @@ impl<'le> GeckoElement<'le> {
}
}

lazy_static! {
pub static ref DUMMY_BASE_URL: Url = {
Url::parse("http://www.example.org").unwrap()
};
}

impl<'le> TElement for GeckoElement<'le> {
type ConcreteNode = GeckoNode<'le>;
type ConcreteDocument = GeckoDocument<'le>;
Expand All @@ -330,7 +336,7 @@ impl<'le> TElement for GeckoElement<'le> {
// in the nsAttrValue. That will allow us to borrow it from here.
let attr = self.get_attr(&ns!(), &atom!("style"));
// FIXME(bholley): Real base URL and error reporter.
let base_url = Url::parse("http://www.example.org").unwrap();
let base_url = &*DUMMY_BASE_URL;
// FIXME(heycam): Needs real ParserContextExtraData so that URLs parse
// properly.
let extra_data = ParserContextExtraData::default();
Expand Down

0 comments on commit 94ce097

Please sign in to comment.