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)
152 lines
4.4 KiB
C++
152 lines
4.4 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 "mozilla/dom/ChannelInfo.h"
|
|
#include "nsCOMPtr.h"
|
|
#include "nsIChannel.h"
|
|
#include "nsIHttpChannel.h"
|
|
#include "nsSerializationHelper.h"
|
|
#include "mozilla/net/HttpBaseChannel.h"
|
|
#include "mozilla/ipc/ChannelInfo.h"
|
|
#include "nsIJARChannel.h"
|
|
#include "nsJARChannel.h"
|
|
#include "nsNetUtil.h"
|
|
|
|
using namespace mozilla;
|
|
using namespace mozilla::dom;
|
|
|
|
void
|
|
ChannelInfo::InitFromChannel(nsIChannel* aChannel)
|
|
{
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
MOZ_ASSERT(!mInited, "Cannot initialize the object twice");
|
|
|
|
nsCOMPtr<nsISupports> securityInfo;
|
|
aChannel->GetSecurityInfo(getter_AddRefs(securityInfo));
|
|
if (securityInfo) {
|
|
SetSecurityInfo(securityInfo);
|
|
}
|
|
|
|
nsLoadFlags loadFlags = 0;
|
|
aChannel->GetLoadFlags(&loadFlags);
|
|
mRedirected = (loadFlags & nsIChannel::LOAD_REPLACE);
|
|
if (mRedirected) {
|
|
// Save the spec and not the nsIURI object itself, since those objects are
|
|
// not thread-safe, and releasing them somewhere other than the main thread
|
|
// is not possible.
|
|
nsCOMPtr<nsIURI> redirectedURI;
|
|
aChannel->GetURI(getter_AddRefs(redirectedURI));
|
|
if (redirectedURI) {
|
|
redirectedURI->GetSpec(mRedirectedURISpec);
|
|
}
|
|
}
|
|
|
|
mInited = true;
|
|
}
|
|
|
|
void
|
|
ChannelInfo::InitFromIPCChannelInfo(const ipc::IPCChannelInfo& aChannelInfo)
|
|
{
|
|
MOZ_ASSERT(!mInited, "Cannot initialize the object twice");
|
|
|
|
mSecurityInfo = aChannelInfo.securityInfo();
|
|
mRedirectedURISpec = aChannelInfo.redirectedURI();
|
|
mRedirected = aChannelInfo.redirected();
|
|
|
|
mInited = true;
|
|
}
|
|
|
|
void
|
|
ChannelInfo::SetSecurityInfo(nsISupports* aSecurityInfo)
|
|
{
|
|
MOZ_ASSERT(mSecurityInfo.IsEmpty(), "security info should only be set once");
|
|
nsCOMPtr<nsISerializable> serializable = do_QueryInterface(aSecurityInfo);
|
|
if (!serializable) {
|
|
NS_WARNING("A non-serializable object was passed to InternalResponse::SetSecurityInfo");
|
|
return;
|
|
}
|
|
NS_SerializeToString(serializable, mSecurityInfo);
|
|
}
|
|
|
|
nsresult
|
|
ChannelInfo::ResurrectInfoOnChannel(nsIChannel* aChannel)
|
|
{
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
MOZ_ASSERT(mInited);
|
|
|
|
// These pointers may be null at this point. They must be checked before
|
|
// being dereferenced.
|
|
nsCOMPtr<nsIHttpChannel> httpChannel =
|
|
do_QueryInterface(aChannel);
|
|
nsCOMPtr<nsIJARChannel> jarChannel =
|
|
do_QueryInterface(aChannel);
|
|
|
|
if (!mSecurityInfo.IsEmpty()) {
|
|
nsCOMPtr<nsISupports> infoObj;
|
|
nsresult rv = NS_DeserializeObject(mSecurityInfo, getter_AddRefs(infoObj));
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
return rv;
|
|
}
|
|
if (httpChannel) {
|
|
net::HttpBaseChannel* httpBaseChannel =
|
|
static_cast<net::HttpBaseChannel*>(httpChannel.get());
|
|
rv = httpBaseChannel->OverrideSecurityInfo(infoObj);
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
return rv;
|
|
}
|
|
} else {
|
|
if (NS_WARN_IF(!jarChannel)) {
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
static_cast<nsJARChannel*>(jarChannel.get())->
|
|
OverrideSecurityInfo(infoObj);
|
|
}
|
|
}
|
|
|
|
if (mRedirected) {
|
|
nsLoadFlags flags = 0;
|
|
aChannel->GetLoadFlags(&flags);
|
|
flags |= nsIChannel::LOAD_REPLACE;
|
|
aChannel->SetLoadFlags(flags);
|
|
|
|
nsCOMPtr<nsIURI> redirectedURI;
|
|
nsresult rv = NS_NewURI(getter_AddRefs(redirectedURI),
|
|
mRedirectedURISpec);
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
return rv;
|
|
}
|
|
if (httpChannel) {
|
|
net::HttpBaseChannel* httpBaseChannel =
|
|
static_cast<net::HttpBaseChannel*>(httpChannel.get());
|
|
httpBaseChannel->OverrideURI(redirectedURI);
|
|
} else {
|
|
if (NS_WARN_IF(!jarChannel)) {
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
static_cast<nsJARChannel*>(jarChannel.get())->OverrideURI(redirectedURI);
|
|
}
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
ipc::IPCChannelInfo
|
|
ChannelInfo::AsIPCChannelInfo() const
|
|
{
|
|
// This may be called when mInited is false, for example if we try to store
|
|
// a synthesized Response object into the Cache. Uninitialized and empty
|
|
// ChannelInfo objects are indistinguishable at the IPC level, so this is
|
|
// fine.
|
|
|
|
IPCChannelInfo ipcInfo;
|
|
|
|
ipcInfo.securityInfo() = mSecurityInfo;
|
|
ipcInfo.redirectedURI() = mRedirectedURISpec;
|
|
ipcInfo.redirected() = mRedirected;
|
|
|
|
return ipcInfo;
|
|
}
|