зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1170937 - Set the URL on the Response object created from a fetch() properly if the underlying channel gets redirected; r=baku
This commit is contained in:
Родитель
d51649d86a
Коммит
65e7f38303
|
@ -548,14 +548,16 @@ FetchDriver::ContinueHttpFetchAfterNetworkFetch()
|
|||
}
|
||||
|
||||
already_AddRefed<InternalResponse>
|
||||
FetchDriver::BeginAndGetFilteredResponse(InternalResponse* aResponse)
|
||||
FetchDriver::BeginAndGetFilteredResponse(InternalResponse* aResponse, nsIURI* aFinalURI)
|
||||
{
|
||||
MOZ_ASSERT(aResponse);
|
||||
if (!aResponse->FinalURL()) {
|
||||
nsAutoCString reqURL;
|
||||
nsAutoCString reqURL;
|
||||
if (aFinalURI) {
|
||||
aFinalURI->GetSpec(reqURL);
|
||||
} else {
|
||||
mRequest->GetURL(reqURL);
|
||||
aResponse->SetUrl(reqURL);
|
||||
}
|
||||
aResponse->SetUrl(reqURL);
|
||||
|
||||
// FIXME(nsm): Handle mixed content check, step 7 of fetch.
|
||||
|
||||
|
@ -584,7 +586,7 @@ FetchDriver::BeginAndGetFilteredResponse(InternalResponse* aResponse)
|
|||
void
|
||||
FetchDriver::BeginResponse(InternalResponse* aResponse)
|
||||
{
|
||||
nsRefPtr<InternalResponse> r = BeginAndGetFilteredResponse(aResponse);
|
||||
nsRefPtr<InternalResponse> r = BeginAndGetFilteredResponse(aResponse, nullptr);
|
||||
// Release the ref.
|
||||
}
|
||||
|
||||
|
@ -716,9 +718,17 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest,
|
|||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
response->InitChannelInfo(channel);
|
||||
|
||||
nsCOMPtr<nsIURI> channelURI;
|
||||
rv = channel->GetURI(getter_AddRefs(channelURI));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
FailWithNetworkError();
|
||||
// Cancel request.
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Resolves fetch() promise which may trigger code running in a worker. Make
|
||||
// sure the Response is fully initialized before calling this.
|
||||
mResponse = BeginAndGetFilteredResponse(response);
|
||||
mResponse = BeginAndGetFilteredResponse(response, channelURI);
|
||||
|
||||
nsCOMPtr<nsIEventTarget> sts = do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
|
|
@ -88,8 +88,9 @@ private:
|
|||
nsresult HttpFetch(bool aCORSFlag = false, bool aCORSPreflightFlag = false, bool aAuthenticationFlag = false);
|
||||
nsresult ContinueHttpFetchAfterNetworkFetch();
|
||||
// Returns the filtered response sent to the observer.
|
||||
// Callers who don't have access to a channel can pass null for aFinalURI.
|
||||
already_AddRefed<InternalResponse>
|
||||
BeginAndGetFilteredResponse(InternalResponse* aResponse);
|
||||
BeginAndGetFilteredResponse(InternalResponse* aResponse, nsIURI* aFinalURI);
|
||||
// Utility since not all cases need to do any post processing of the filtered
|
||||
// response.
|
||||
void BeginResponse(InternalResponse* aResponse);
|
||||
|
|
|
@ -27,12 +27,10 @@ skip-if = buildapp == 'b2g' # Bug 1137683
|
|||
skip-if = buildapp == 'b2g' # Bug 1137683
|
||||
[test_fetch_basic_http.html]
|
||||
[test_fetch_basic_http_sw_reroute.html]
|
||||
skip-if = true # Bug 1170937, need fully support for redirects
|
||||
#skip-if = buildapp == 'b2g' # Bug 1137683
|
||||
skip-if = buildapp == 'b2g' # Bug 1137683
|
||||
[test_fetch_cors.html]
|
||||
[test_fetch_cors_sw_reroute.html]
|
||||
skip-if = true # Bug 1170937, need fully support for redirects
|
||||
#skip-if = buildapp == 'b2g' # Bug 1137683
|
||||
skip-if = buildapp == 'b2g' # Bug 1137683
|
||||
[test_formdataparsing.html]
|
||||
[test_formdataparsing_sw_reroute.html]
|
||||
skip-if = buildapp == 'b2g' # Bug 1137683
|
||||
|
|
Загрузка…
Ссылка в новой задаче