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

Fix a few things regarding redirects #25357

Merged
merged 5 commits into from May 5, 2020
Merged

Fix a few things regarding redirects #25357

merged 5 commits into from May 5, 2020

Conversation

@Eijebong
Copy link
Member

Eijebong commented Dec 21, 2019

See individual commits

@highfive
Copy link

highfive commented Dec 21, 2019

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/fetch.rs, components/script/dom/response.rs
  • @KiChjang: components/net/http_loader.rs, components/net_traits/lib.rs, components/script/fetch.rs, components/net_traits/response.rs, components/script/dom/response.rs
@Eijebong
Copy link
Member Author

Eijebong commented Dec 21, 2019

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Dec 21, 2019

Trying commit 1589101 with merge 6d50e3e...

bors-servo added a commit that referenced this pull request Dec 21, 2019
Fix a few things regarding redirects

See individual commits
@bors-servo
Copy link
Contributor

bors-servo commented Dec 21, 2019

💔 Test failed - status-taskcluster

@Eijebong
Copy link
Member Author

Eijebong commented Dec 21, 2019

▶ TIMEOUT [expected OK] /fetch/api/redirect/redirect-method.any.html
  │ TIMEOUT [expected PASS] Redirect 301 with POST

👀

@Eijebong
Copy link
Member Author

Eijebong commented Dec 21, 2019

I can repro locally, guess I failed some rebase before pushing...

@Eijebong Eijebong force-pushed the Eijebong:redirects branch from 1589101 to 2ed6ed5 Dec 21, 2019
@Eijebong
Copy link
Member Author

Eijebong commented Dec 21, 2019

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Dec 21, 2019

Trying commit 2ed6ed5 with merge 6b14697...

bors-servo added a commit that referenced this pull request Dec 21, 2019
Fix a few things regarding redirects

See individual commits
@bors-servo
Copy link
Contributor

bors-servo commented Dec 21, 2019

💔 Test failed - status-taskcluster

@Eijebong
Copy link
Member Author

Eijebong commented Dec 21, 2019

@bors-servo retry

1 unexpected results that are NOT known-intermittents:
  ▶ FAIL [expected PASS] /css/CSS2/ui/outline-color-101.xht
  │   → /css/CSS2/ui/outline-color-101.xht 54a9df64f1476dd12020019d7cf22ac34d727bc0
  │   → /css/CSS2/reference/boxes_same_color_100px_black_50px_margin.xht bb2751bfe2e9b16331e4522f296d899b22e12085
  └   → Screenshot is solid color 0xFFFFFF for /css/CSS2/ui/outline-color-101.xht

#24726

@bors-servo
Copy link
Contributor

bors-servo commented Dec 21, 2019

Trying commit 2ed6ed5 with merge b5d4abd...

bors-servo added a commit that referenced this pull request Dec 21, 2019
Fix a few things regarding redirects

See individual commits
@bors-servo
Copy link
Contributor

bors-servo commented Dec 21, 2019

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Dec 21, 2019

  ▶ Unexpected subtest result in /xhr/send-redirect-to-cors.htm:
  │ FAIL [expected PASS] XMLHttpRequest: send() - Redirect to CORS-enabled resource (303 LALA with string and explicit Content-Type safelisted)
  │   → assert_equals: expected "application/x-pony" but got "NO"
  │ FAIL [expected PASS] XMLHttpRequest: send() - Redirect to CORS-enabled resource (301 POST with string and explicit Content-Type safelisted)
  │   → assert_equals: expected "application/x-pony" but got "NO"
  │ 
  │ redirect/</client.onreadystatechange<@http://web-platform.test:8000/xhr/send-redirect-to-cors.htm:41:17
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1984:25
  └ Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:2009:35
  ▶ Unexpected subtest result in /xhr/send-redirect-to-cors.htm:
  │ FAIL [expected PASS] XMLHttpRequest: send() - Redirect to CORS-enabled resource (301 POST with string and explicit Content-Type)
  │   → assert_equals: expected 0 but got 200
  │ FAIL [expected PASS] XMLHttpRequest: send() - Redirect to CORS-enabled resource (302 POST with string and explicit Content-Type)
  │   → assert_equals: expected 0 but got 200
  │ 
  │ redirect/</client.onreadystatechange<@http://web-platform.test:8000/xhr/send-redirect-to-cors.htm:45:17
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1984:25
  └ Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:2009:35
  ▶ Unexpected subtest result in /xhr/send-redirect-post-upload.htm:
  └ PASS [expected FAIL] XMLHttpRequest: The send() method: POSTing to URL that redirects (301)
  ▶ Unexpected subtest result in /xhr/send-redirect-post-upload.htm:
  └ PASS [expected FAIL] XMLHttpRequest: The send() method: POSTing to URL that redirects (302)
  ▶ Unexpected subtest result in /xhr/send-redirect-post-upload.htm:
  └ PASS [expected FAIL] XMLHttpRequest: The send() method: POSTing to URL that redirects (303)
@Eijebong
Copy link
Member Author

Eijebong commented Apr 18, 2020

So I'm very confused right now. Looking at /xhr/send-redirect-to-cors.htm failures.

I looked at firefox's implementation if the step 11 of redirect-fetch (https://fetch.spec.whatwg.org/#http-redirect-fetch), which is here: https://searchfox.org/mozilla-central/rev/aec63591821712236a522f7f55116f582ed7c920/dom/fetch/FetchDriver.cpp#1318

At first I thought I was going crazy because the condition is exactly the same but firefox passes those tests. But then I removed the line actually skipping those headers in the redirected request at https://searchfox.org/mozilla-central/rev/aec63591821712236a522f7f55116f582ed7c920/dom/fetch/FetchDriver.cpp#1444 and the test still passed. Apparently, firefox never goes through that AsyncOnChannelRedirect method for XHR requests but does for fetch ones. Now the question is: Why ?

The spec here says that for XHR requests, you should be using the fetch API even on XHR (https://xhr.spec.whatwg.org/#the-send()-method) so you should be removing those headers, right ?

Am I missing something important here ? Is the spec wrong ? Are the tests wrong ? Is my code wrong ? Is servo's handling of XHR wrong ?

@jdm
Copy link
Member

jdm commented Apr 21, 2020

Gecko doesn't use Fetch internally for its XHR implementation. Instead it uses XMLHttpRequestMainThread::AsyncOnChannelRedirect.

@jdm
Copy link
Member

jdm commented Apr 21, 2020

Welp. The test doesn't match the specification, and the right behaviour is not clear to me. I have filed web-platform-tests/wpt#23156 upstream about resolving the mismatch between the Fetch and XHR tests somehow; I propose we merge these changes with the expected failures.

@jdm jdm force-pushed the Eijebong:redirects branch from 2ed6ed5 to 552e44e Apr 22, 2020
Eijebong added 3 commits Dec 21, 2019
This doesn't change any expectation because we're not setting
response.redirected properly so all the tests fail later on when it's
asserted to be true.

Fixes #25257
The spec says to ignore both HEAD and GET in step 11
@Eijebong Eijebong force-pushed the Eijebong:redirects branch from 23065ad to d689921 May 5, 2020
@Eijebong
Copy link
Member Author

Eijebong commented May 5, 2020

@bors-servo try=wpt

bors-servo added a commit that referenced this pull request May 5, 2020
Fix a few things regarding redirects

See individual commits
@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2020

Trying commit d689921 with merge 8f2e822...

@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2020

☀️ Test successful - status-taskcluster
State: approved= try=True

@Eijebong Eijebong force-pushed the Eijebong:redirects branch from d689921 to d86a429 May 5, 2020
@jdm
Copy link
Member

jdm commented May 5, 2020

@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2020

📌 Commit d86a429 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2020

Testing commit d86a429 with merge c8c1fec...

bors-servo added a commit that referenced this pull request May 5, 2020
Fix a few things regarding redirects

See individual commits
@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2020

💔 Test failed - status-taskcluster

@Eijebong
Copy link
Member Author

Eijebong commented May 5, 2020

1 unexpected results that are NOT known-intermittents:
  ▶ Unexpected subtest result in /css/css-transitions/properties-value-inherit-003.html:
  │ FAIL [expected PASS] outline-offset length-em(em) / events
  │   → assert_equals: Expected TransitionEnd events triggered on .transition expected "" but got "outline-offset:2s"
  │ 
  │ assertExpectedEventsFunc/<@http://web-platform.test:8000/css/css-transitions/support/generalParallelTest.js:207:26
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1975:25
  │ done@http://web-platform.test:8000/css/css-transitions/properties-value-inherit-003.html:134:34
  │ concludeSlice/</</<@http://web-platform.test:8000/css/css-transitions/support/runParallelAsyncHarness.js:122:59
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1975:25
  │ concludeSlice/</<@http://web-platform.test:8000/css/css-transitions/support/runParallelAsyncHarness.js:121:38
  │ concludeSlice/<@http://web-platform.test:8000/css/css-transitions/support/runParallelAsyncHarness.js:120:23
  └ concludeSlice@http://web-platform.test:8000/css/css-transitions/support/runParallelAsyncHarness.js:118:19

Sounds unrelated

@jdm
Copy link
Member

jdm commented May 5, 2020

@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2020

Testing commit d86a429 with merge 2471e9d...

@bors-servo
Copy link
Contributor

bors-servo commented May 5, 2020

☀️ Test successful - status-taskcluster
Approved by: jdm
Pushing 2471e9d to master...

@bors-servo bors-servo merged commit 2471e9d into servo:master May 5, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
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.

None yet

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