mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
516d358f36
- partial of Bug 1153658 - browser_compartments.js logspam. r=yoric (8e2c21aa5) - Bug 1178653 - Refactor construction code to use an interface consistent with the spec, with the one exception using an out-of-the-way, differently-named method. r=efaust (d316259d7) - Bug 1175098 - PerformanceStats for e10s. r=felipe, r=mconley (515acb8d7) - Bug 1147664 - Detailed mode for PerformanceStats (low-level). r=jandem (dda8d84de) - Bug 1147664 - Detailed mode for PerformanceStats (high-level). r=mossop (b86076568) - Bug 1164304 - Run all fetch tests in the service worker context as well; r=nsm (e20fa8bfd) - Bug 1143981 - Reroute all fetch tests through a transparent service worker; r=nsm (5196acc57) - Bug 1122161 - Redirected channels should respect skip service worker flag. r=nsm (f4288392e) - Bug 1170937 - Set the URL on the Response object created from a fetch() properly if the underlying channel gets redirected; r=baku (45febabb3) - Bug 1173029 - Remove mFinalURL from InternalResponse; r=baku a=KWierso (6bdc1083b) - Bug 1137683 - Use a loadgroup derived from the document's when updating a ServiceWorker; r=bkelly (fabaa2602) - Bug 1164397 - Part 1: Use the original channel URI for constructing the cache entry key when we're dealing with an intercepted channel; r=mcmanus (b20ab36c7) - Bug 1164397 - Part 2: Add an API for overriding the original URI on HttpChannelBase; r=mcmanus (20021722f) - Bug 1164397 - Part 3: Add an API for overriding the original URI on nsJARChannel; r=jdm (492b6fd6f) - Bug 1164397 - Part 4: Add infromation about whether a channel was redirected to ChannelInfo; r=jdm (e2ce84660) - Bug 1164397 - Part 5: Save the redirected flag and the redirected URI in the DOM cache; r=bkelly (7d2d1fc92) - Bug 1162018 - Add an automated test to ensure that a redirected Request won't be visible to a service worker if it had triggered the original fetch(); r=jdm (0397a073f) - Bug 1164397 - Part 6: Add a test case for the service worker responding with a redirected Response; r=jdm (e83e0bee4) - Bug 1164397 - Part 7: Add a test case for the redirected Response object being stored in the DOM Cache; r=jdm (7a82916d8) - Bug 1169296 - Intercepting top-level document loads is not working with JAR channels. Tests. r=jdm (fe8f128c5) - Bug 1171285 - Part 1: Add a script for regenerating the application.zip used by test_app_protocol.html; r=jdm (ec303b3b2) - Bug 1171285 - Part 2: Fix test_app_protocol.html to finish both index.html and controlled.html tests; r=jdm (2e68e6665) - Bug 1169613 - Use content type of synthesized response for JAR channel requests if available. Tests. r=jdm (b0095fc3b) - Bug 1164397 - Part 8: Add a test case for the service worker for an app:// URI responding with a redirected Response; r=jdm (460e834c9) - Bug 1169044 - Patch 3 - Store and set principal with script URI on ServiceWorkers. r=ehsan (6e0b0102a) - Bug 1164397 - Part 9: Add a test case for the service worker for an app:// URI responding with a redirected HTTPS response; r=jdm (1be195f5a) - Bug 1164397 - Part 10: Add a test case for the service worker for an app:// URI responding with cached HTTP and HTTPS responses; r=jdm# Please enter the commit message for your changes. Lines starting (56432b7b5) - Bug 1164397 - Part 11: Add a test case for the service worker responding to HTTPS normal and cached Responses; r=jdm (6ec238455) - Bug 1164397 - Part 12: Add a test case for the service worker responding to normal and cached HTTP->HTTPS responses; r=jdm (925a1970f) - Bug 1190074 - PerformanceGroup now uses mozilla::RefPtr;r=jandem (53dc0a640) - Bug 1169086 followup: Add missing 'override' annotation to VerifyTraceProtoAndIfaceCacheCalledTracer::trace() method decl. rs=ehsan (cdedce447) - Bug 1172824: Initialize a few members in CompartmentCheckTracer (CID 1304705); r=terrence (3db40160c) - missing bit of 1166678 (9fb0cceeb) - Bug 1139473: File some metadata for the js/src/ subdirectory; r=jorendorff (9dc4a29a7) - Bug 1173889 - Strongly type the CallbackTracer dispatch function; r=jonco, r=mccr8 (19b47dc70)
120 lines
3.5 KiB
C++
120 lines
3.5 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "InternalResponse.h"
|
|
|
|
#include "mozilla/dom/InternalHeaders.h"
|
|
#include "mozilla/dom/cache/CacheTypes.h"
|
|
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
|
#include "nsStreamUtils.h"
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
|
|
InternalResponse::InternalResponse(uint16_t aStatus, const nsACString& aStatusText)
|
|
: mType(ResponseType::Default)
|
|
, mStatus(aStatus)
|
|
, mStatusText(aStatusText)
|
|
, mHeaders(new InternalHeaders(HeadersGuardEnum::Response))
|
|
{
|
|
}
|
|
|
|
InternalResponse::~InternalResponse()
|
|
{
|
|
}
|
|
|
|
already_AddRefed<InternalResponse>
|
|
InternalResponse::Clone()
|
|
{
|
|
nsRefPtr<InternalResponse> clone = CreateIncompleteCopy();
|
|
|
|
clone->mHeaders = new InternalHeaders(*mHeaders);
|
|
if (mWrappedResponse) {
|
|
clone->mWrappedResponse = mWrappedResponse->Clone();
|
|
MOZ_ASSERT(!mBody);
|
|
return clone.forget();
|
|
}
|
|
|
|
if (!mBody) {
|
|
return clone.forget();
|
|
}
|
|
|
|
nsCOMPtr<nsIInputStream> clonedBody;
|
|
nsCOMPtr<nsIInputStream> replacementBody;
|
|
|
|
nsresult rv = NS_CloneInputStream(mBody, getter_AddRefs(clonedBody),
|
|
getter_AddRefs(replacementBody));
|
|
if (NS_WARN_IF(NS_FAILED(rv))) { return nullptr; }
|
|
|
|
clone->mBody.swap(clonedBody);
|
|
if (replacementBody) {
|
|
mBody.swap(replacementBody);
|
|
}
|
|
|
|
return clone.forget();
|
|
}
|
|
|
|
already_AddRefed<InternalResponse>
|
|
InternalResponse::BasicResponse()
|
|
{
|
|
MOZ_ASSERT(!mWrappedResponse, "Can't BasicResponse a already wrapped response");
|
|
nsRefPtr<InternalResponse> basic = CreateIncompleteCopy();
|
|
basic->mType = ResponseType::Basic;
|
|
basic->mHeaders = InternalHeaders::BasicHeaders(Headers());
|
|
basic->mWrappedResponse = this;
|
|
return basic.forget();
|
|
}
|
|
|
|
already_AddRefed<InternalResponse>
|
|
InternalResponse::CORSResponse()
|
|
{
|
|
MOZ_ASSERT(!mWrappedResponse, "Can't CORSResponse a already wrapped response");
|
|
nsRefPtr<InternalResponse> cors = CreateIncompleteCopy();
|
|
cors->mType = ResponseType::Cors;
|
|
cors->mHeaders = InternalHeaders::CORSHeaders(Headers());
|
|
cors->mWrappedResponse = this;
|
|
return cors.forget();
|
|
}
|
|
|
|
void
|
|
InternalResponse::SetPrincipalInfo(UniquePtr<mozilla::ipc::PrincipalInfo> aPrincipalInfo)
|
|
{
|
|
mPrincipalInfo = Move(aPrincipalInfo);
|
|
}
|
|
|
|
already_AddRefed<InternalResponse>
|
|
InternalResponse::OpaqueResponse()
|
|
{
|
|
MOZ_ASSERT(!mWrappedResponse, "Can't OpaqueResponse a already wrapped response");
|
|
nsRefPtr<InternalResponse> response = new InternalResponse(0, EmptyCString());
|
|
response->mType = ResponseType::Opaque;
|
|
response->mTerminationReason = mTerminationReason;
|
|
response->mURL = mURL;
|
|
response->mChannelInfo = mChannelInfo;
|
|
if (mPrincipalInfo) {
|
|
response->mPrincipalInfo = MakeUnique<mozilla::ipc::PrincipalInfo>(*mPrincipalInfo);
|
|
}
|
|
response->mWrappedResponse = this;
|
|
return response.forget();
|
|
}
|
|
|
|
already_AddRefed<InternalResponse>
|
|
InternalResponse::CreateIncompleteCopy()
|
|
{
|
|
nsRefPtr<InternalResponse> copy = new InternalResponse(mStatus, mStatusText);
|
|
copy->mType = mType;
|
|
copy->mTerminationReason = mTerminationReason;
|
|
copy->mURL = mURL;
|
|
copy->mChannelInfo = mChannelInfo;
|
|
if (mPrincipalInfo) {
|
|
copy->mPrincipalInfo = MakeUnique<mozilla::ipc::PrincipalInfo>(*mPrincipalInfo);
|
|
}
|
|
return copy.forget();
|
|
}
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|