mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 05:37:11 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Backed out changeset b7653e3d5f91 (bug 1174381) for widespread assertion failures. (f529b680d) - Bug 1174381 - ServiceWorkerManager::TeardownRunnable should be called when xpcom-shutdown notification is received, r=nsm (c744d9a80) - Bug 1134671 Keep sqlite connection open between Cache API operations. r=ehsan (43a57decc) - Bug 1134671: Add 'override' keyword to method Context::Data::GetConnection() (in DOM Cache code). rs=ehsan (669c6eac3) - Bug 1164100 P1 Cache API should use correct base dir even when reusing sqlite connection. r=ehsan (c1bdf85d3) - Bug 1164100 P2 Fix defunct assertion in Cache API ActionRunnable. r=ehsan (e345b2a76) - Bug 1161288 - Support app:// origins on Fetch API. r=baku,nsm (9c237bcdd) - Bug 1168135 P1 Execute Cache init Action on same target thread used for other Actions. r=ehsan (30fcee443) - Bug 1168135 P2 Add Cache Context::Init() method. r=ehsan (41dfd427a) - Bug 1168135 P3 Cache Context should pass shared Data container to init Action. r=ehsan (2e8f19d7c) - Bug 1169994 Fix Cache to close connection on right thread when init is canceled. r=ehsan (ca7b96b24) - Bug 1174768 Cache should check if QuotaManager is shutting down before calling GetOrCreate. r=janv (7b06ad874) - Bug 1110446 P1 Create marker files when Cache API context is open. r=ehsan (bb94b92ff) - Bug 1146612 - Add a test to ensure that Cache.put() with an existing request will reorder it in the DB; r=bkelly (228ff808c) - Bug 1162365 - Cache API does not calculate usage in QuotaClient::InitOrigin(). r=bkelly (3fa71ee24) - Bug 1156033 - Add some missing error handling to the DOM Cache code; r=bkelly (67cd67987) - Bug 1118298 - Client uses unknown command property session_id. r=ato (081eb8f2d)
This commit is contained in:
+31
-24
@@ -12,6 +12,7 @@
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
#include "nsIHttpHeaderVisitor.h"
|
||||
#include "nsIJARChannel.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIThreadRetargetableRequest.h"
|
||||
#include "nsIUploadChannel2.h"
|
||||
@@ -291,9 +292,9 @@ FetchDriver::BasicFetch()
|
||||
return FailWithNetworkError();
|
||||
}
|
||||
|
||||
if (scheme.LowerCaseEqualsLiteral("file")) {
|
||||
} else if (scheme.LowerCaseEqualsLiteral("http") ||
|
||||
scheme.LowerCaseEqualsLiteral("https")) {
|
||||
if (scheme.LowerCaseEqualsLiteral("http") ||
|
||||
scheme.LowerCaseEqualsLiteral("https") ||
|
||||
scheme.LowerCaseEqualsLiteral("app")) {
|
||||
return HttpFetch();
|
||||
}
|
||||
|
||||
@@ -484,8 +485,10 @@ FetchDriver::HttpFetch(bool aCORSFlag, bool aCORSPreflightFlag, bool aAuthentica
|
||||
// While the spec also gates on the client being a ServiceWorker, we can't
|
||||
// infer that here. Instead we rely on callers to set the flag correctly.
|
||||
if (mRequest->SkipServiceWorker()) {
|
||||
nsCOMPtr<nsIHttpChannelInternal> internalChan = do_QueryInterface(httpChan);
|
||||
internalChan->ForceNoIntercept();
|
||||
if (httpChan) {
|
||||
nsCOMPtr<nsIHttpChannelInternal> internalChan = do_QueryInterface(httpChan);
|
||||
internalChan->ForceNoIntercept();
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIStreamListener> listener = this;
|
||||
@@ -523,7 +526,7 @@ FetchDriver::HttpFetch(bool aCORSFlag, bool aCORSPreflightFlag, bool aAuthentica
|
||||
unsafeHeaders,
|
||||
getter_AddRefs(preflightChannel));
|
||||
} else {
|
||||
rv = chan->AsyncOpen(listener, nullptr);
|
||||
rv = chan->AsyncOpen(listener, nullptr);
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
@@ -656,28 +659,31 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest,
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> channel = do_QueryInterface(aRequest);
|
||||
// For now we only support HTTP.
|
||||
MOZ_ASSERT(channel);
|
||||
nsRefPtr<InternalResponse> response;
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aRequest);
|
||||
if (httpChannel) {
|
||||
uint32_t responseStatus;
|
||||
httpChannel->GetResponseStatus(&responseStatus);
|
||||
|
||||
aRequest->GetStatus(&rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
FailWithNetworkError();
|
||||
return rv;
|
||||
}
|
||||
nsAutoCString statusText;
|
||||
httpChannel->GetResponseStatusText(statusText);
|
||||
|
||||
uint32_t responseStatus;
|
||||
channel->GetResponseStatus(&responseStatus);
|
||||
response = new InternalResponse(responseStatus, statusText);
|
||||
|
||||
nsAutoCString statusText;
|
||||
channel->GetResponseStatusText(statusText);
|
||||
nsRefPtr<FillResponseHeaders> visitor = new FillResponseHeaders(response);
|
||||
rv = httpChannel->VisitResponseHeaders(visitor);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
NS_WARNING("Failed to visit all headers.");
|
||||
}
|
||||
} else {
|
||||
nsCOMPtr<nsIJARChannel> jarChannel = do_QueryInterface(aRequest);
|
||||
// If it is not an http channel, it has to be a jar one.
|
||||
MOZ_ASSERT(jarChannel);
|
||||
|
||||
nsRefPtr<InternalResponse> response = new InternalResponse(responseStatus, statusText);
|
||||
|
||||
nsRefPtr<FillResponseHeaders> visitor = new FillResponseHeaders(response);
|
||||
rv = channel->VisitResponseHeaders(visitor);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
NS_WARNING("Failed to visit all headers.");
|
||||
// We simulate the http protocol for jar/app requests
|
||||
uint32_t responseStatus = 200;
|
||||
nsAutoCString statusText;
|
||||
response = new InternalResponse(responseStatus, NS_LITERAL_CSTRING("OK"));
|
||||
}
|
||||
|
||||
// We open a pipe so that we can immediately set the pipe's read end as the
|
||||
@@ -699,6 +705,7 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest,
|
||||
response->SetBody(pipeInputStream);
|
||||
|
||||
nsCOMPtr<nsISupports> securityInfo;
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
rv = channel->GetSecurityInfo(getter_AddRefs(securityInfo));
|
||||
if (securityInfo) {
|
||||
response->SetSecurityInfo(securityInfo);
|
||||
|
||||
Reference in New Issue
Block a user