2020-01-13 03:28:13 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set sw=2 ts=8 et 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/. */
|
|
|
|
|
2020-11-23 19:12:02 +03:00
|
|
|
#include "mozilla/net/DocumentChannel.h"
|
2020-01-13 03:28:13 +03:00
|
|
|
|
2020-11-23 19:12:02 +03:00
|
|
|
#include <inttypes.h>
|
|
|
|
#include <utility>
|
|
|
|
#include "mozIDOMWindow.h"
|
|
|
|
#include "mozilla/AlreadyAddRefed.h"
|
|
|
|
#include "mozilla/Assertions.h"
|
2020-01-13 03:28:13 +03:00
|
|
|
#include "mozilla/LoadInfo.h"
|
2020-11-23 19:12:02 +03:00
|
|
|
#include "mozilla/Logging.h"
|
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "mozilla/TimeStamp.h"
|
|
|
|
#include "mozilla/Unused.h"
|
|
|
|
#include "mozilla/dom/Document.h"
|
2020-04-24 05:22:58 +03:00
|
|
|
#include "mozilla/net/DocumentChannelChild.h"
|
2020-04-24 04:58:23 +03:00
|
|
|
#include "mozilla/net/ParentProcessDocumentChannel.h"
|
2020-11-23 19:12:02 +03:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsDebug.h"
|
2020-02-11 04:22:29 +03:00
|
|
|
#include "nsDocShell.h"
|
2020-01-13 03:28:13 +03:00
|
|
|
#include "nsDocShellLoadState.h"
|
|
|
|
#include "nsHttpHandler.h"
|
2020-11-23 19:12:02 +03:00
|
|
|
#include "nsIContentPolicy.h"
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
|
|
|
#include "nsILoadContext.h"
|
|
|
|
#include "nsILoadGroup.h"
|
|
|
|
#include "nsILoadInfo.h"
|
|
|
|
#include "nsIStreamListener.h"
|
|
|
|
#include "nsIURI.h"
|
2020-08-18 19:49:34 +03:00
|
|
|
#include "nsMimeTypes.h"
|
2020-04-24 05:22:58 +03:00
|
|
|
#include "nsNetUtil.h"
|
2020-11-23 19:12:02 +03:00
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
#include "nsPIDOMWindowInlines.h"
|
|
|
|
#include "nsStringFwd.h"
|
|
|
|
#include "nsThreadUtils.h"
|
|
|
|
#include "nsXULAppAPI.h"
|
|
|
|
#include "nscore.h"
|
2020-01-13 03:28:13 +03:00
|
|
|
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
using namespace mozilla::ipc;
|
|
|
|
|
|
|
|
extern mozilla::LazyLogModule gDocumentChannelLog;
|
|
|
|
#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt)
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// DocumentChannel::nsISupports
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(DocumentChannel)
|
|
|
|
NS_IMPL_RELEASE(DocumentChannel)
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN(DocumentChannel)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIRequest)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIChannel)
|
2020-04-24 04:44:59 +03:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIIdentChannel)
|
2020-01-13 03:28:13 +03:00
|
|
|
NS_INTERFACE_MAP_ENTRY_CONCRETE(DocumentChannel)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIRequest)
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
DocumentChannel::DocumentChannel(nsDocShellLoadState* aLoadState,
|
|
|
|
net::LoadInfo* aLoadInfo,
|
2020-04-27 08:38:15 +03:00
|
|
|
nsLoadFlags aLoadFlags, uint32_t aCacheKey,
|
|
|
|
bool aUriModified, bool aIsXFOError)
|
2021-10-28 03:37:15 +03:00
|
|
|
: mLoadState(aLoadState),
|
2020-01-13 03:28:13 +03:00
|
|
|
mCacheKey(aCacheKey),
|
|
|
|
mLoadFlags(aLoadFlags),
|
|
|
|
mURI(aLoadState->URI()),
|
2020-04-27 08:38:15 +03:00
|
|
|
mLoadInfo(aLoadInfo),
|
|
|
|
mUriModified(aUriModified),
|
|
|
|
mIsXFOError(aIsXFOError) {
|
2020-01-13 03:28:13 +03:00
|
|
|
LOG(("DocumentChannel ctor [this=%p, uri=%s]", this,
|
|
|
|
aLoadState->URI()->GetSpecOrDefault().get()));
|
|
|
|
RefPtr<nsHttpHandler> handler = nsHttpHandler::GetInstance();
|
|
|
|
uint64_t channelId;
|
|
|
|
Unused << handler->NewChannelId(channelId);
|
|
|
|
mChannelId = channelId;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
DocumentChannel::AsyncOpen(nsIStreamListener* aListener) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2020-04-24 05:21:01 +03:00
|
|
|
void DocumentChannel::ShutdownListeners(nsresult aStatusCode) {
|
|
|
|
LOG(("DocumentChannel ShutdownListeners [this=%p, status=%" PRIx32 "]", this,
|
|
|
|
static_cast<uint32_t>(aStatusCode)));
|
|
|
|
mStatus = aStatusCode;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIStreamListener> listener = mListener;
|
|
|
|
if (listener) {
|
|
|
|
listener->OnStartRequest(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
mIsPending = false;
|
|
|
|
|
|
|
|
listener = mListener; // it might have changed!
|
2020-07-21 04:01:05 +03:00
|
|
|
nsCOMPtr<nsILoadGroup> loadGroup = mLoadGroup;
|
|
|
|
|
2020-04-24 05:21:01 +03:00
|
|
|
mListener = nullptr;
|
2020-07-21 04:01:05 +03:00
|
|
|
mLoadGroup = nullptr;
|
2020-04-24 05:21:01 +03:00
|
|
|
mCallbacks = nullptr;
|
|
|
|
|
2020-07-21 04:01:05 +03:00
|
|
|
NS_DispatchToMainThread(NS_NewRunnableFunction(
|
|
|
|
"DocumentChannel::ShutdownListeners", [=, self = RefPtr{this}] {
|
|
|
|
if (listener) {
|
|
|
|
listener->OnStopRequest(self, aStatusCode);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (loadGroup) {
|
|
|
|
loadGroup->RemoveRequest(self, nullptr, aStatusCode);
|
|
|
|
}
|
|
|
|
}));
|
2020-04-24 05:21:01 +03:00
|
|
|
|
|
|
|
DeleteIPDL();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DocumentChannel::DisconnectChildListeners(
|
|
|
|
const nsresult& aStatus, const nsresult& aLoadGroupStatus) {
|
|
|
|
MOZ_ASSERT(NS_FAILED(aStatus));
|
|
|
|
mStatus = aLoadGroupStatus;
|
|
|
|
// Make sure we remove from the load group before
|
|
|
|
// setting mStatus, as existing tests expect the
|
|
|
|
// status to be successful when we disconnect.
|
|
|
|
if (mLoadGroup) {
|
|
|
|
mLoadGroup->RemoveRequest(this, nullptr, aStatus);
|
|
|
|
mLoadGroup = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
ShutdownListeners(aStatus);
|
|
|
|
}
|
|
|
|
|
2020-01-13 03:28:13 +03:00
|
|
|
nsDocShell* DocumentChannel::GetDocShell() {
|
|
|
|
nsCOMPtr<nsILoadContext> loadContext;
|
|
|
|
NS_QueryNotificationCallbacks(this, loadContext);
|
|
|
|
if (!loadContext) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
nsCOMPtr<mozIDOMWindowProxy> domWindow;
|
|
|
|
loadContext->GetAssociatedWindow(getter_AddRefs(domWindow));
|
|
|
|
if (!domWindow) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
auto* pDomWindow = nsPIDOMWindowOuter::From(domWindow);
|
|
|
|
nsIDocShell* docshell = pDomWindow->GetDocShell();
|
|
|
|
return nsDocShell::Cast(docshell);
|
|
|
|
}
|
|
|
|
|
2020-04-24 05:22:58 +03:00
|
|
|
static bool URIUsesDocChannel(nsIURI* aURI) {
|
2020-08-28 20:20:40 +03:00
|
|
|
if (SchemeIsJavascript(aURI)) {
|
2020-04-24 05:22:58 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCString spec = aURI->GetSpecOrDefault();
|
2022-04-04 20:19:24 +03:00
|
|
|
return !spec.EqualsLiteral("about:crashcontent");
|
2020-04-24 05:22:58 +03:00
|
|
|
}
|
|
|
|
|
2020-08-28 20:20:30 +03:00
|
|
|
bool DocumentChannel::CanUseDocumentChannel(nsIURI* aURI) {
|
|
|
|
// We want to use DocumentChannel if we're using a supported scheme.
|
|
|
|
return URIUsesDocChannel(aURI);
|
2020-04-24 05:22:58 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* static */
|
2020-07-21 04:01:05 +03:00
|
|
|
already_AddRefed<DocumentChannel> DocumentChannel::CreateForDocument(
|
2020-04-24 05:22:58 +03:00
|
|
|
nsDocShellLoadState* aLoadState, class LoadInfo* aLoadInfo,
|
|
|
|
nsLoadFlags aLoadFlags, nsIInterfaceRequestor* aNotificationCallbacks,
|
2020-04-27 08:38:15 +03:00
|
|
|
uint32_t aCacheKey, bool aUriModified, bool aIsXFOError) {
|
2020-04-24 04:58:23 +03:00
|
|
|
RefPtr<DocumentChannel> channel;
|
|
|
|
if (XRE_IsContentProcess()) {
|
2020-04-27 08:38:15 +03:00
|
|
|
channel = new DocumentChannelChild(aLoadState, aLoadInfo, aLoadFlags,
|
|
|
|
aCacheKey, aUriModified, aIsXFOError);
|
2020-04-24 04:58:23 +03:00
|
|
|
} else {
|
2020-04-27 08:38:15 +03:00
|
|
|
channel =
|
|
|
|
new ParentProcessDocumentChannel(aLoadState, aLoadInfo, aLoadFlags,
|
|
|
|
aCacheKey, aUriModified, aIsXFOError);
|
2020-04-24 04:58:23 +03:00
|
|
|
}
|
2020-04-24 05:22:58 +03:00
|
|
|
channel->SetNotificationCallbacks(aNotificationCallbacks);
|
|
|
|
return channel.forget();
|
|
|
|
}
|
|
|
|
|
2020-07-21 04:01:05 +03:00
|
|
|
/* static */
|
|
|
|
already_AddRefed<DocumentChannel> DocumentChannel::CreateForObject(
|
|
|
|
nsDocShellLoadState* aLoadState, class LoadInfo* aLoadInfo,
|
|
|
|
nsLoadFlags aLoadFlags, nsIInterfaceRequestor* aNotificationCallbacks) {
|
|
|
|
return CreateForDocument(aLoadState, aLoadInfo, aLoadFlags,
|
|
|
|
aNotificationCallbacks, 0, false, false);
|
|
|
|
}
|
|
|
|
|
2020-01-13 03:28:13 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
DocumentChannel::Cancel(nsresult aStatusCode) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
DocumentChannel::Suspend() {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
DocumentChannel::Resume() {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Remainder of nsIRequest/nsIChannel.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetNotificationCallbacks(
|
|
|
|
nsIInterfaceRequestor** aCallbacks) {
|
|
|
|
nsCOMPtr<nsIInterfaceRequestor> callbacks(mCallbacks);
|
|
|
|
callbacks.forget(aCallbacks);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::SetNotificationCallbacks(
|
|
|
|
nsIInterfaceRequestor* aNotificationCallbacks) {
|
|
|
|
mCallbacks = aNotificationCallbacks;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetLoadGroup(nsILoadGroup** aLoadGroup) {
|
|
|
|
nsCOMPtr<nsILoadGroup> loadGroup(mLoadGroup);
|
|
|
|
loadGroup.forget(aLoadGroup);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::SetLoadGroup(nsILoadGroup* aLoadGroup) {
|
|
|
|
mLoadGroup = aLoadGroup;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetStatus(nsresult* aStatus) {
|
|
|
|
*aStatus = mStatus;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetName(nsACString& aResult) {
|
|
|
|
if (!mURI) {
|
|
|
|
aResult.Truncate();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
nsCString spec;
|
|
|
|
nsresult rv = mURI->GetSpec(spec);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
aResult.AssignLiteral("documentchannel:");
|
|
|
|
aResult.Append(spec);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::IsPending(bool* aResult) {
|
|
|
|
*aResult = mIsPending;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetLoadFlags(nsLoadFlags* aLoadFlags) {
|
|
|
|
*aLoadFlags = mLoadFlags;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
DocumentChannel::GetTRRMode(nsIRequest::TRRMode* aTRRMode) {
|
|
|
|
return GetTRRModeImpl(aTRRMode);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
DocumentChannel::SetTRRMode(nsIRequest::TRRMode aTRRMode) {
|
|
|
|
return SetTRRModeImpl(aTRRMode);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::SetLoadFlags(nsLoadFlags aLoadFlags) {
|
2020-08-18 19:49:34 +03:00
|
|
|
// Setting load flags for TYPE_OBJECT is OK, so long as the channel to parent
|
|
|
|
// isn't opened yet, or we're only setting the `LOAD_DOCUMENT_URI` flag.
|
2020-07-21 04:01:05 +03:00
|
|
|
auto contentPolicy = mLoadInfo->GetExternalContentPolicyType();
|
2021-01-15 15:07:16 +03:00
|
|
|
if (contentPolicy == ExtContentPolicy::TYPE_OBJECT) {
|
2020-08-18 19:49:34 +03:00
|
|
|
if (mWasOpened) {
|
|
|
|
MOZ_DIAGNOSTIC_ASSERT(
|
|
|
|
aLoadFlags == (mLoadFlags | nsIChannel::LOAD_DOCUMENT_URI),
|
|
|
|
"After the channel has been opened, can only set the "
|
|
|
|
"`LOAD_DOCUMENT_URI` flag.");
|
|
|
|
}
|
2020-07-21 04:01:05 +03:00
|
|
|
mLoadFlags = aLoadFlags;
|
2020-08-18 19:49:34 +03:00
|
|
|
return NS_OK;
|
2020-07-21 04:01:05 +03:00
|
|
|
}
|
2020-08-18 19:49:34 +03:00
|
|
|
|
|
|
|
MOZ_CRASH("DocumentChannel::SetLoadFlags: Don't set flags after creation");
|
2020-01-13 03:28:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetOriginalURI(nsIURI** aOriginalURI) {
|
|
|
|
nsCOMPtr<nsIURI> originalURI =
|
|
|
|
mLoadState->OriginalURI() ? mLoadState->OriginalURI() : mLoadState->URI();
|
|
|
|
originalURI.forget(aOriginalURI);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::SetOriginalURI(nsIURI* aOriginalURI) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetURI(nsIURI** aURI) {
|
|
|
|
nsCOMPtr<nsIURI> uri(mURI);
|
|
|
|
uri.forget(aURI);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetOwner(nsISupports** aOwner) {
|
|
|
|
nsCOMPtr<nsISupports> owner(mOwner);
|
|
|
|
owner.forget(aOwner);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::SetOwner(nsISupports* aOwner) {
|
|
|
|
mOwner = aOwner;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetSecurityInfo(nsISupports** aSecurityInfo) {
|
|
|
|
*aSecurityInfo = nullptr;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetContentType(nsACString& aContentType) {
|
2020-08-18 19:49:34 +03:00
|
|
|
// We may be trying to load HTML object data, and have determined that we're
|
|
|
|
// going to be performing a document load. In that case, fake the "text/html"
|
|
|
|
// content type for nsObjectLoadingContent.
|
|
|
|
if ((mLoadFlags & nsIRequest::LOAD_HTML_OBJECT_DATA) &&
|
|
|
|
(mLoadFlags & nsIChannel::LOAD_DOCUMENT_URI)) {
|
|
|
|
aContentType = TEXT_HTML;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2020-07-29 06:13:31 +03:00
|
|
|
NS_ERROR("If we get here, something is broken");
|
2020-01-13 03:28:13 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::SetContentType(const nsACString& aContentType) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetContentCharset(nsACString& aContentCharset) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::SetContentCharset(
|
|
|
|
const nsACString& aContentCharset) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetContentLength(int64_t* aContentLength) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::SetContentLength(int64_t aContentLength) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::Open(nsIInputStream** aStream) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetContentDisposition(
|
|
|
|
uint32_t* aContentDisposition) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::SetContentDisposition(
|
|
|
|
uint32_t aContentDisposition) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetContentDispositionFilename(
|
|
|
|
nsAString& aContentDispositionFilename) {
|
|
|
|
MOZ_CRASH("If we get here, something will be broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::SetContentDispositionFilename(
|
|
|
|
const nsAString& aContentDispositionFilename) {
|
|
|
|
MOZ_CRASH("If we get here, something will be broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetContentDispositionHeader(
|
|
|
|
nsACString& aContentDispositionHeader) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetLoadInfo(nsILoadInfo** aLoadInfo) {
|
|
|
|
nsCOMPtr<nsILoadInfo> loadInfo(mLoadInfo);
|
|
|
|
loadInfo.forget(aLoadInfo);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::SetLoadInfo(nsILoadInfo* aLoadInfo) {
|
|
|
|
MOZ_CRASH("If we get here, something is broken");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetIsDocument(bool* aIsDocument) {
|
|
|
|
return NS_GetIsDocumentChannel(this, aIsDocument);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP DocumentChannel::GetCanceled(bool* aCanceled) {
|
|
|
|
*aCanceled = mCanceled;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// nsIIdentChannel
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
DocumentChannel::GetChannelId(uint64_t* aChannelId) {
|
|
|
|
*aChannelId = mChannelId;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
DocumentChannel::SetChannelId(uint64_t aChannelId) {
|
|
|
|
mChannelId = aChannelId;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2020-07-21 04:01:05 +03:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Helpers
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
uint64_t InnerWindowIDForExtantDoc(nsDocShell* docShell) {
|
|
|
|
if (!docShell) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Document* doc = docShell->GetExtantDocument();
|
|
|
|
if (!doc) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return doc->InnerWindowID();
|
|
|
|
}
|
|
|
|
|
2020-01-13 03:28:13 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#undef LOG
|