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

Updating http_network_or_cache_fetch to better match the fetch API spec #14784

Merged
merged 1 commit into from Jan 2, 2017

Conversation

@mattnenterprise
Copy link
Contributor

mattnenterprise commented Dec 30, 2016


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #14742
  • There are tests for these changes

This change is Reviewable

@highfive
Copy link

highfive commented Dec 30, 2016

Heads up! This PR modifies the following files:

@highfive
Copy link

highfive commented Dec 30, 2016

warning Warning warning

  • These commits modify net code, but no tests are modified. Please consider adding a test!
@KiChjang
Copy link
Member

KiChjang commented Dec 30, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 30, 2016

Trying commit 563c9eb with merge 5944e85...

bors-servo added a commit that referenced this pull request Dec 30, 2016
Updating http_network_or_cache_fetch to better match the fetch API spec

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

---
<!-- 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
- [ ] These changes fix #14742

<!-- Either: -->
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/14784)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 30, 2016

💔 Test failed - linux-rel-wpt

@KiChjang
Copy link
Member

KiChjang commented Dec 30, 2016


  ▶ Unexpected subtest result in /XMLHttpRequest/send-entity-body-empty.htm:
  └ PASS [expected FAIL] XMLHttpRequest: send("") - empty entity body (HEAD)

  ▶ Unexpected subtest result in /XMLHttpRequest/send-entity-body-get-head.htm:
  └ PASS [expected FAIL] XMLHttpRequest: send() - non-empty data argument and GET/HEAD (HEAD)

  ▶ Unexpected subtest result in /XMLHttpRequest/send-entity-body-none.htm:
  └ PASS [expected FAIL] No content type (HEAD)

  ▶ Unexpected subtest result in /XMLHttpRequest/send-entity-body-none.htm:
  └ PASS [expected FAIL] Explicit content type (HEAD)

  ▶ Unexpected subtest result in /eventsource/request-cache-control.htm:
  └ PASS [expected TIMEOUT] EventSource: Cache-Control

  ▶ Unexpected subtest result in /html/webappapis/scripting/event-loops/microtask_after_script.html:
  └ PASS [expected FAIL] Microtask immediately after script

Looking good! You'll need to update the WPT test expectations.

type: testharness
[Microtask immediately after script]
expected: FAIL

This comment has been minimized.

@jdm

jdm Dec 30, 2016

Member

Unfortunately this isn't actually a result caused by these changes (see #14221), so we should revert this.

@mattnenterprise
Copy link
Contributor Author

mattnenterprise commented Dec 30, 2016

I have made the updates.

Copy link
Member

jdm left a comment

This looks fine with some indentation adjustments.

if response.is_none() {
if http_request.cache_mode.get() == CacheMode::OnlyIfCached {
return Response::network_error(NetworkError::Internal("Couldn't find response in cache".into()))

This comment has been minimized.

@jdm

jdm Dec 30, 2016

Member

nit: four space indents, please.

http_request.cache_mode.get() == CacheMode::NoCache) {
match status {
StatusCode::NotModified => {
// Step 21

This comment has been minimized.

@jdm

jdm Dec 30, 2016

Member

nit: four space indents on this block and the previous line, please.

StatusCode::NotModified => {
// Step 21
if http_request.cache_mode.get() == CacheMode::Default ||
http_request.cache_mode.get() == CacheMode::NoCache {
// Substep 1

This comment has been minimized.

@jdm

jdm Dec 30, 2016

Member

nit: this block should be indented four spaces past the previous line.

}
},
StatusCode::Unauthorized => {
// Step 22

This comment has been minimized.

@jdm

jdm Dec 30, 2016

Member

nit: indent this block by another two spaces.

return http_network_or_cache_fetch(http_request, true, cors_flag, done_chan, context);
},
StatusCode::ProxyAuthenticationRequired => {
// Step 23

This comment has been minimized.

@jdm

jdm Dec 30, 2016

Member

nit: indentation.

// Step 20
// Step 24
if authentication_fetch_flag {
// TODO Create the authentication entry for request and the given realm

This comment has been minimized.

@jdm

jdm Dec 30, 2016

Member

nit: indentation.

@mattnenterprise
Copy link
Contributor Author

mattnenterprise commented Dec 31, 2016

I have made the updates.

Copy link
Member

KiChjang left a comment

Almost there! Still needs some indentation changes, and after that it can be r=me.

let fetch_result = http_network_or_cache_fetch(request.clone(), credentials, authentication_fetch_flag,
done_chan, context);
let fetch_result = http_network_or_cache_fetch(request.clone(), authentication_fetch_flag,
cors_flag, done_chan, context);

This comment has been minimized.

@KiChjang

KiChjang Jan 1, 2017

Member

nit: Indentation.

// TODO have a HTTP cache to check for a completed response
let complete_http_response_from_cache: Option<Response> = None;
if http_request.cache_mode.get() != CacheMode::NoStore &&
http_request.cache_mode.get() != CacheMode::Reload &&
complete_http_response_from_cache.is_some() {
// Substep 1
if http_request.cache_mode.get() == CacheMode::ForceCache {
if http_request.cache_mode.get() == CacheMode::ForceCache ||
http_request.cache_mode.get() == CacheMode::OnlyIfCached {

This comment has been minimized.

@KiChjang

KiChjang Jan 1, 2017

Member

nit: Indentation, this should match the previous line's http_request.

@mattnenterprise
Copy link
Contributor Author

mattnenterprise commented Jan 1, 2017

I have made the updates.

@jdm
Copy link
Member

jdm commented Jan 1, 2017

@bors-servo r=KiChjang,jdm
Thanks!

@bors-servo
Copy link
Contributor

bors-servo commented Jan 1, 2017

📌 Commit 6caa5a2 has been approved by KiChjang,jdm

@bors-servo
Copy link
Contributor

bors-servo commented Jan 1, 2017

Testing commit 6caa5a2 with merge b337e92...

bors-servo added a commit that referenced this pull request Jan 1, 2017
Updating http_network_or_cache_fetch to better match the fetch API spec

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

---
<!-- 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 #14742

<!-- Either: -->
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/14784)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 1, 2017

💔 Test failed - linux-dev

@jdm
Copy link
Member

jdm commented Jan 2, 2017

Checking files for tidiness...
./components/net/http_loader.rs:1058: Line is longer than 120 characters
@jdm jdm added S-fails-tidy and removed S-tests-failed labels Jan 2, 2017
@mattnenterprise
Copy link
Contributor Author

mattnenterprise commented Jan 2, 2017

I have fixed that line.

@jdm
Copy link
Member

jdm commented Jan 2, 2017

@bors-servo: r=jdm,KiChjang

@bors-servo
Copy link
Contributor

bors-servo commented Jan 2, 2017

📌 Commit 09194a1 has been approved by jdm,KiChjang

@highfive highfive assigned jdm and unassigned KiChjang Jan 2, 2017
@bors-servo
Copy link
Contributor

bors-servo commented Jan 2, 2017

Testing commit 09194a1 with merge 987b640...

bors-servo added a commit that referenced this pull request Jan 2, 2017
Updating http_network_or_cache_fetch to better match the fetch API spec

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

---
<!-- 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 #14742

<!-- Either: -->
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/14784)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 2, 2017

💔 Test failed - mac-rel-wpt1

@jdm
Copy link
Member

jdm commented Jan 2, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Jan 2, 2017

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

@bors-servo bors-servo merged commit 09194a1 into servo:master Jan 2, 2017
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
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.

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