diff options
author | CYBAI <cyb.ai.815@gmail.com> | 2020-05-09 00:06:17 +0900 |
---|---|---|
committer | CYBAI <cyb.ai.815@gmail.com> | 2020-05-09 11:33:52 +0900 |
commit | b4089bcd07859f66c39aae986dad44d67332849b (patch) | |
tree | b82139e8c493090be7fbc2f2b991e9bb0a05039a | |
parent | 033156b96125deec10706b9e03643ce2938864a0 (diff) | |
download | servo-b4089bcd07859f66c39aae986dad44d67332849b.tar.gz servo-b4089bcd07859f66c39aae986dad44d67332849b.zip |
Initiate redirect fetching iff the request has a location
Without this checking, we will run into a TIMEOUT request because
http_redirect_fetch will return immediately when location doesn't exist.
4 files changed, 123 insertions, 8 deletions
diff --git a/components/constellation/network_listener.rs b/components/constellation/network_listener.rs index 6a6b7be4561..ccbe00d4940 100644 --- a/components/constellation/network_listener.rs +++ b/components/constellation/network_listener.rs @@ -7,7 +7,7 @@ //! response is received, it is forwarded to the appropriate script thread. use crossbeam_channel::Sender; -use http::header::LOCATION; +use http::HeaderMap; use ipc_channel::ipc; use ipc_channel::router::ROUTER; use msg::constellation_msg::PipelineId; @@ -98,8 +98,12 @@ impl NetworkListener { FetchMetadata::Unfiltered(ref m) => m, }; - match metadata.headers { - Some(ref headers) if headers.contains_key(LOCATION) => { + match metadata.location_url { + // https://html.spec.whatwg.org/multipage/#process-a-navigate-fetch + // Step 7-4. + Some(Ok(ref location_url)) + if matches!(location_url.scheme(), "http" | "https") => + { if self.request_builder.url_list.is_empty() { self.request_builder .url_list @@ -115,10 +119,16 @@ impl NetworkListener { .map(|referrer_url| Referrer::ReferrerUrl(referrer_url)); self.request_builder.referrer_policy = metadata.referrer_policy; + let headers = if let Some(ref headers) = metadata.headers { + headers.clone().into_inner() + } else { + HeaderMap::new() + }; + self.res_init = Some(ResponseInit { url: metadata.final_url.clone(), location_url: metadata.location_url.clone(), - headers: headers.clone().into_inner(), + headers, referrer: metadata.referrer.clone(), status_code: metadata .status @@ -132,7 +142,7 @@ impl NetworkListener { // // Ideally the Fetch code would handle manual redirects on its own self.initiate_fetch(None); - }, + } _ => { // Response should be processed by script thread. self.should_send = true; diff --git a/tests/wpt/metadata/cookies/http-state/domain-tests.html.ini b/tests/wpt/metadata/cookies/http-state/domain-tests.html.ini index bf248de15e0..cba99c1097d 100644 --- a/tests/wpt/metadata/cookies/http-state/domain-tests.html.ini +++ b/tests/wpt/metadata/cookies/http-state/domain-tests.html.ini @@ -1,2 +1,67 @@ [domain-tests.html] - expected: TIMEOUT + [domain0036 - domain0036] + expected: FAIL + + [domain0035 - domain0035] + expected: FAIL + + [domain0029 - domain0029] + expected: FAIL + + [domain0022 - domain0022] + expected: FAIL + + [domain0005 - domain0005] + expected: FAIL + + [optional-domain0041 - optional-domain0041] + expected: FAIL + + [domain0003 - domain0003] + expected: FAIL + + [domain0019 - domain0019] + expected: FAIL + + [domain0040 - domain0040] + expected: FAIL + + [domain0025 - domain0025] + expected: FAIL + + [domain0020 - domain0020] + expected: FAIL + + [domain0001 - domain0001] + expected: FAIL + + [domain0038 - domain0038] + expected: FAIL + + [domain0039 - domain0039] + expected: FAIL + + [domain0033 - domain0033] + expected: FAIL + + [domain0031 - domain0031] + expected: FAIL + + [domain0023 - domain0023] + expected: FAIL + + [domain0012 - domain0012] + expected: FAIL + + [domain0008 - domain0008] + expected: FAIL + + [domain0009 - domain0009] + expected: FAIL + + [domain0026 - domain0026] + expected: FAIL + + [domain0004 - domain0004] + expected: FAIL + diff --git a/tests/wpt/metadata/cookies/http-state/ordering-tests.html.ini b/tests/wpt/metadata/cookies/http-state/ordering-tests.html.ini index 1de22d6efb7..b4ed860df91 100644 --- a/tests/wpt/metadata/cookies/http-state/ordering-tests.html.ini +++ b/tests/wpt/metadata/cookies/http-state/ordering-tests.html.ini @@ -1,2 +1,4 @@ [ordering-tests.html] - expected: TIMEOUT + [ordering0001 - ordering0001] + expected: FAIL + diff --git a/tests/wpt/metadata/cookies/http-state/path-tests.html.ini b/tests/wpt/metadata/cookies/http-state/path-tests.html.ini index facc56bed6f..404ef0201e4 100644 --- a/tests/wpt/metadata/cookies/http-state/path-tests.html.ini +++ b/tests/wpt/metadata/cookies/http-state/path-tests.html.ini @@ -1,2 +1,40 @@ [path-tests.html] - expected: TIMEOUT + [path0015 - path0015] + expected: FAIL + + [path0002 - path0002] + expected: FAIL + + [path0003 - path0003] + expected: FAIL + + [path0004 - path0004] + expected: FAIL + + [path0001 - path0001] + expected: FAIL + + [path0016 - path0016] + expected: FAIL + + [path0026 - path0026] + expected: FAIL + + [path0017 - path0017] + expected: FAIL + + [path0032 - path0032] + expected: FAIL + + [path0029 - path0029] + expected: FAIL + + [disabled-path0029 - disabled-path0029] + expected: FAIL + + [path0010 - path0010] + expected: FAIL + + [path0007 - path0007] + expected: FAIL + |