Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Urlmageddon #14246

Merged
merged 1 commit into from Nov 17, 2016
Merged

Urlmageddon #14246

merged 1 commit into from Nov 17, 2016

Conversation

@emilio
Copy link
Member

emilio commented Nov 16, 2016

Still needs a bunch of code in net to be converted in order to get more
advantage of this for images and stuff, but meanwhile this should help quite a
bit with #13778.

Still wanted to get this in.

r? @SimonSapin


This change is Reviewable

@highfive
Copy link

highfive commented Nov 16, 2016

Heads up! This PR modifies the following files:

  • @bholley: components/style/values/specified/url.rs, components/style/values/specified/image.rs
  • @fitzgen: components/script/dom/element.rs, components/script/dom/htmlimageelement.rs, components/script/dom/htmlcanvaselement.rs
  • @KiChjang: components/net/Cargo.toml, components/net/lib.rs, components/script/dom/element.rs, components/net_traits/lib.rs, components/net_traits/lib.rs, components/script/dom/htmlimageelement.rs, components/script/dom/htmlcanvaselement.rs, components/net_traits/Cargo.toml, components/net_traits/Cargo.toml, components/net_traits/image_cache_thread.rs, components/net_traits/image_cache_thread.rs, components/net/image_cache_thread.rs
@highfive
Copy link

highfive commented Nov 16, 2016

warning Warning warning

  • These commits modify net, layout, style, and script code, but no tests are modified. Please consider adding a test!
Url(Arc<Url>),
}

impl From<Url> for ServoUrl {

This comment has been minimized.

Copy link
@emilio

emilio Nov 16, 2016

Author Member

This is just so transition is easier, and needs to be removed afterwards.

@emilio emilio force-pushed the emilio:servo-url branch from a1b44cb to be62420 Nov 16, 2016
@SimonSapin
Copy link
Member

SimonSapin commented Nov 16, 2016

While you’re at it, is replacing every use of url::Url at once with sed much harder? ServoUrl could be made to have some APIs compatible with url::Url (like parse, join, …) to ease the transition.


Reviewed 17 of 20 files at r1, 3 of 3 files at r2.
Review status: all files reviewed at latest revision, 5 unresolved discussions.


components/net/image_cache_thread.rs, line 540 at r2 (raw file):

                        // TODO(emilio): ServoUrl in more places please!
                        let request = RequestInit {
                            url: Url::parse(url.as_str()).unwrap(),

This (and a couple lines below) needlessly goes through rust-url’s parser even when the ServoUrl value is a non-data URL. This should instead use a conversion method on ServoUrl, even if that method is removed eventually.


components/style/values/specified/url.rs, line 91 at r2 (raw file):

        let serialization = Arc::new(url.into_owned());
        let resolved = if serialization.starts_with("data:") {

This if / else block should be in a method or constructor of ServoUrl. Perhaps mimicking url::Url’s API: a parse constructor that doesn’t use a base URL, and a join method that does.


components/style_traits/Cargo.toml, line 21 at r2 (raw file):

cssparser = "0.7"
euclid = "0.10.1"
url = "1.2"

This likely needs a ./mach cargo-update -p style_traits run to update all lock files.


components/style_traits/lib.rs, line 36 at r2 (raw file):

/// afterwards.
///
/// FIXME: Better name for this appreciated.

I think it’s OK to call this Url. Types are namespaced in modules and crates, let’s take advantage of that. (Only a few modules will need to rename one of the two types in order to import both.)


Comments from Reviewable

@emilio emilio force-pushed the emilio:servo-url branch from be62420 to 6ffe104 Nov 16, 2016
@emilio emilio changed the title style: Avoid a bunch of url clones and passing data-uris through rust-url WIP: Urlmageddon Nov 16, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Nov 16, 2016

The latest upstream changes (presumably #14172) made this pull request unmergeable. Please resolve the merge conflicts.

@emilio emilio force-pushed the emilio:servo-url branch from 6ffe104 to e842117 Nov 17, 2016
@emilio
Copy link
Member Author

emilio commented Nov 17, 2016

@bors-servo try

I was really dubious on the data thing after seeing some use cases, so I decided to defer it for after the landing on this with more discussion, because I think, for example, we should still percent-decode, probably when serializing too. So I'd rather land this (a wrapper for an Arc<Url> with the proper interface we need (and indeed I was using until I found that out), and then do the switch to enum { Data(..), Url(..) }.

But I think this is mostly ready for review (given tests pass), and I'd appreciate a fast review given how prone it is to bitrot.

bors-servo added a commit that referenced this pull request Nov 17, 2016
WIP: Urlmageddon

<!-- Please describe your changes on the following line: -->

Still needs a bunch of code in net to be converted in order to get more
advantage of this for images and stuff, but meanwhile this should help quite a
bit with #13778.

Still wanted to get this in.

r? @SimonSapin

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14246)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

Trying commit e842117 with merge 711326f...

@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

💔 Test failed - arm64

@emilio emilio force-pushed the emilio:servo-url branch from e842117 to 4401845 Nov 17, 2016
@emilio
Copy link
Member Author

emilio commented Nov 17, 2016

@bors-servo try

  • Forgot to add some files.
@emilio emilio removed the S-needs-rebase label Nov 17, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

Trying commit 4401845 with merge 915a63b...

bors-servo added a commit that referenced this pull request Nov 17, 2016
WIP: Urlmageddon

<!-- Please describe your changes on the following line: -->

Still needs a bunch of code in net to be converted in order to get more
advantage of this for images and stuff, but meanwhile this should help quite a
bit with #13778.

Still wanted to get this in.

r? @SimonSapin

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14246)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

💔 Test failed - mac-rel-wpt2

@emilio emilio force-pushed the emilio:servo-url branch from 4401845 to 94ad6a7 Nov 17, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

📌 Commit 913c874 has been approved by SimonSapin

@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

Testing commit 913c874 with merge 2312997...

bors-servo added a commit that referenced this pull request Nov 17, 2016
Urlmageddon

<!-- Please describe your changes on the following line: -->

Still needs a bunch of code in net to be converted in order to get more
advantage of this for images and stuff, but meanwhile this should help quite a
bit with #13778.

Still wanted to get this in.

r? @SimonSapin

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14246)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

💔 Test failed - linux-rel-wpt

@highfive
Copy link

highfive commented Nov 17, 2016

  ▶ FAIL [expected PASS] /_mozilla/css/incremental_trailing_whitespace_a.html
  └   → /_mozilla/css/incremental_trailing_whitespace_a.html da54041086f2975f8e3c776d2283ad6609e6862a
/_mozilla/css/incremental_trailing_whitespace_ref.html f5d0147c8bddbdc772a7e5e86c7c9e433fcd486b
Testing da54041086f2975f8e3c776d2283ad6609e6862a == f5d0147c8bddbdc772a7e5e86c7c9e433fcd486b
@KiChjang
Copy link
Member

KiChjang commented Nov 17, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

Testing commit 913c874 with merge 22aebdf...

bors-servo added a commit that referenced this pull request Nov 17, 2016
Urlmageddon

<!-- Please describe your changes on the following line: -->

Still needs a bunch of code in net to be converted in order to get more
advantage of this for images and stuff, but meanwhile this should help quite a
bit with #13778.

Still wanted to get this in.

r? @SimonSapin

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14246)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

💔 Test failed - linux-rel-wpt

@highfive
Copy link

highfive commented Nov 17, 2016

  ▶ FAIL [expected PASS] /_mozilla/css/incremental_trailing_whitespace_a.html
  └   → /_mozilla/css/incremental_trailing_whitespace_a.html da54041086f2975f8e3c776d2283ad6609e6862a
/_mozilla/css/incremental_trailing_whitespace_ref.html f5d0147c8bddbdc772a7e5e86c7c9e433fcd486b
Testing da54041086f2975f8e3c776d2283ad6609e6862a == f5d0147c8bddbdc772a7e5e86c7c9e433fcd486b
@KiChjang
Copy link
Member

KiChjang commented Nov 17, 2016

@bors-servo retry force

@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

Previous build results for arm32, arm64, linux-dev, mac-dev-unit, windows-dev are reusable. Rebuilding only linux-rel-css, linux-rel-wpt, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2...

@bors-servo
Copy link
Contributor

bors-servo commented Nov 17, 2016

@bors-servo bors-servo merged commit 913c874 into servo:master Nov 17, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@emilio emilio deleted the emilio:servo-url branch Nov 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.