Repository navigation
net: Do not unconditionally overwrite origin when handling CORS - #48793
Conversation
|
🔨 Triggering try run (#38040990776) for Linux (WPT) |
|
Test results for linux-wpt from try job (#38040990776): Flaky unexpected result (21)
Stable unexpected results that are known to be intermittent (14)
Stable unexpected results (6)
|
|
|
|
Okay, I figured out why this is happening. Basically we are missing the following from https://www.w3.org/TR/navigation-timing-2/#performancenavigation-redirectcount :
That should be set by step 15 of https://html.spec.whatwg.org/multipage/document-lifecycle.html#initialise-the-document-object but we don't implement that yet. Instead, we set that timing in servo/components/net/http_loader.rs Lines 1037 to 1041 in 3dcc4e0 servo/components/script/dom/servoparser/mod.rs Line 1657 in 3dcc4e0 To make that happen, we first need to implement the FetchController concept to hold this information. Working on that first. #rabbithole |
This is the first step to make various information available on the controller to be used for redirect computation. That's required to be able to fix the current navigation timing to set the redirectCount to zero when appropriate, see servo#48793 It also removes the unused canceller from `Document` and moves it to a separate file in `net_traits`. Testing: it compiles Signed-off-by: Tim van der Lippe <[email protected]>
This is the first step to make various information available on the controller to be used for redirect computation. That's required to be able to fix the current navigation timing to set the redirectCount to zero when appropriate, see servo#48793 It also removes the unused canceller from `Document` and moves it to a separate file in `net_traits`. Testing: it compiles Signed-off-by: Tim van der Lippe <[email protected]>
This is the first step to make various information available on the controller to be used for redirect computation. That's required to be able to fix the current navigation timing to set the redirectCount to zero when appropriate, see servo#48793 It also removes the unused canceller from `Document` and moves it to a separate file in `net_traits`. Testing: it compiles Signed-off-by: Tim van der Lippe <[email protected]>
This is the first step to make various information available on the controller to be used for redirect computation. That's required to be able to fix the current navigation timing to set the redirectCount to zero when appropriate, see servo#48793 It also removes the unused canceller from `Document` and moves it to a separate file in `net_traits`. Testing: it compiles Signed-off-by: Tim van der Lippe <[email protected]>
When the cors_flag would be set, we would always set the origin back to an opaque origin. This causes same-site and cross-site computation to break, since we would incorrectly reset the origin back to an opaque for perfectly fine origins. Instead, remove that step (which also wasn't in the spec) and rewrite the logic to only perform when the request mode is actually Cors. This also required clearing the `redirect_count` when the response taint is not same-origin, since we now correctly handle origins. Testing: most fetch metadata tests now pass Signed-off-by: Tim van der Lippe <[email protected]>
ea08d07 to
40c1933
Compare
|
🔨 Triggering try run (#41028402350) for Linux (WPT) |
|
Test results for linux-wpt from try job (#41028402350): Flaky unexpected result (21)
Stable unexpected results that are known to be intermittent (5)
|
|
|
|
One job failed on bootstrap dependencies, but probably it's all fine. This supersedes the other PR about fetch controller and can be landed as-is without regressions like before. |
Co-authored-by: Martin Robinson <[email protected]> Signed-off-by: Tim van der Lippe <[email protected]>
When the cors_flag would be set, we would always set the origin back to an opaque origin. This causes same-site and cross-site computation to break, since we would incorrectly reset the origin back to an opaque for perfectly fine origins.
Instead, remove that step (which also wasn't in the spec) and rewrite the logic to only perform when the request mode is actually Cors.
Closes #49262 (no longer required)
Closes #49263 (now obsolete)
Testing: most fetch metadata tests now pass