servo: Merge #11639 - Use base_url instead of url in HTMLAnchorElement::set_url (from awestroke:anchor-element-base-url); r=nox
authorOrvar Segerström <orvarsegerstrom@gmail.com>
Mon, 06 Jun 2016 11:54:38 -0500
changeset 339027 1697b1f15654e318b7e4fb6a491ad80aca792e10
parent 339026 1dea3e5570a79b669e72909e7d347ee82ad28ba8
child 339028 15e4b3faa28323a5b68dcbecdf19be0b1e61ecd2
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnox
servo: Merge #11639 - Use base_url instead of url in HTMLAnchorElement::set_url (from awestroke:anchor-element-base-url); r=nox <!-- Please describe your changes on the following line: --> `script::dom::HTMLAnchorElement::set_url` now uses `document::base_url` instead of `document::url`, allowing correct parsing of relative urls on about:blank and pages with a `<base href="some_url"/>` set. spec: https://html.spec.whatwg.org/multipage/infrastructure.html#resolving-urls --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11628 <!-- Either: --> - [x] There are tests for these changes: Some expected test failures have been removed. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 9fae4b18d1293101ecc17342e433bb1b0fff8398
servo/components/script/dom/htmlanchorelement.rs
--- a/servo/components/script/dom/htmlanchorelement.rs
+++ b/servo/components/script/dom/htmlanchorelement.rs
@@ -59,17 +59,17 @@ impl HTMLAnchorElement {
         Node::reflect_node(box element, document, HTMLAnchorElementBinding::Wrap)
     }
 
     // https://html.spec.whatwg.org/multipage/#concept-hyperlink-url-set
     fn set_url(&self) {
         let attribute = self.upcast::<Element>().get_attribute(&ns!(), &atom!("href"));
         *self.url.borrow_mut() = attribute.and_then(|attribute| {
             let document = document_from_node(self);
-            document.url().join(&attribute.value()).ok()
+            document.base_url().join(&attribute.value()).ok()
         });
     }
 
     // https://html.spec.whatwg.org/multipage/#reinitialise-url
     fn reinitialize_url(&self) {
         // Step 1.
         match *self.url.borrow() {
             Some(ref url) if url.scheme() == "blob" && url.cannot_be_a_base() => return,