Bug 1647605 - add remotetype to nsiparentchannel (and inheritors) r=kershaw

Differential Revision: https://phabricator.services.mozilla.com/D80887
This commit is contained in:
Frederik Braun 2020-06-25 12:00:52 +00:00
Родитель 7b417b5ef3
Коммит 11d9d8e44d
9 изменённых файлов: 83 добавлений и 0 удалений

Просмотреть файл

@ -63,6 +63,11 @@ SimpleChannelParent::Delete() {
return NS_OK;
}
NS_IMETHODIMP
SimpleChannelParent::GetRemoteType(nsAString& aRemoteType) {
return NS_ERROR_NOT_IMPLEMENTED;
}
void SimpleChannelParent::ActorDestroy(ActorDestroyReason aWhy) {}
NS_IMETHODIMP

Просмотреть файл

@ -73,4 +73,9 @@ interface nsIParentChannel : nsIStreamListener
* Called to invoke deletion of the IPC protocol.
*/
void delete();
/**
* The remote type of the target process for this load.
*/
readonly attribute AString remoteType;
};

Просмотреть файл

@ -1755,6 +1755,21 @@ DocumentLoadListener::Delete() {
return NS_OK;
}
NS_IMETHODIMP
DocumentLoadListener::GetRemoteType(nsAString& aRemoteType) {
RefPtr<CanonicalBrowsingContext> browsingContext = GetBrowsingContext();
if (!browsingContext) {
return NS_ERROR_UNEXPECTED;
}
ErrorResult error;
browsingContext->GetCurrentRemoteType(aRemoteType, error);
if (error.Failed()) {
aRemoteType = VoidString();
}
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsIChannelEventSink
////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -349,6 +349,12 @@ ParentChannelWrapper::NotifyClassificationFlags(uint32_t aClassificationFlags,
NS_IMETHODIMP
ParentChannelWrapper::Delete() { return NS_OK; }
NS_IMETHODIMP
ParentChannelWrapper::GetRemoteType(nsAString& aRemoteType) {
aRemoteType = VoidString();
return NS_OK;
}
} // namespace net
} // namespace mozilla

Просмотреть файл

@ -6,6 +6,8 @@
#include "DataChannelParent.h"
#include "mozilla/Assertions.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/net/NeckoParent.h"
#include "nsNetUtil.h"
#include "nsIChannel.h"
@ -63,6 +65,17 @@ DataChannelParent::Delete() {
return NS_OK;
}
NS_IMETHODIMP
DataChannelParent::GetRemoteType(nsAString& aRemoteType) {
if (!CanSend()) {
return NS_ERROR_UNEXPECTED;
}
dom::PContentParent* pcp = Manager()->Manager();
aRemoteType = static_cast<dom::ContentParent*>(pcp)->GetRemoteType();
return NS_OK;
}
void DataChannelParent::ActorDestroy(ActorDestroyReason why) {}
NS_IMETHODIMP

Просмотреть файл

@ -6,6 +6,8 @@
#include "FileChannelParent.h"
#include "mozilla/Assertions.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/net/NeckoParent.h"
#include "nsNetUtil.h"
#include "nsIChannel.h"
@ -63,6 +65,17 @@ FileChannelParent::Delete() {
return NS_OK;
}
NS_IMETHODIMP
FileChannelParent::GetRemoteType(nsAString& aRemoteType) {
if (!CanSend()) {
return NS_ERROR_UNEXPECTED;
}
dom::PContentParent* pcp = Manager()->Manager();
aRemoteType = static_cast<dom::ContentParent*>(pcp)->GetRemoteType();
return NS_OK;
}
void FileChannelParent::ActorDestroy(ActorDestroyReason why) {}
NS_IMETHODIMP

Просмотреть файл

@ -532,6 +532,17 @@ FTPChannelParent::Delete() {
return NS_OK;
}
NS_IMETHODIMP
FTPChannelParent::GetRemoteType(nsAString& aRemoteType) {
if (!CanSend()) {
return NS_ERROR_UNEXPECTED;
}
dom::PContentParent* pcp = Manager()->Manager();
aRemoteType = static_cast<dom::ContentParent*>(pcp)->GetRemoteType();
return NS_OK;
}
//-----------------------------------------------------------------------------
// FTPChannelParent::nsIInterfaceRequestor
//-----------------------------------------------------------------------------

Просмотреть файл

@ -1992,6 +1992,17 @@ HttpChannelParent::Delete() {
return NS_OK;
}
NS_IMETHODIMP
HttpChannelParent::GetRemoteType(nsAString& aRemoteType) {
if (!CanSend()) {
return NS_ERROR_UNEXPECTED;
}
dom::PContentParent* pcp = Manager()->Manager();
aRemoteType = static_cast<dom::ContentParent*>(pcp)->GetRemoteType();
return NS_OK;
}
//-----------------------------------------------------------------------------
// HttpChannelParent::nsIParentRedirectingChannel
//-----------------------------------------------------------------------------

Просмотреть файл

@ -426,6 +426,10 @@ NS_IMETHODIMP nsExtProtocolChannel::Delete() {
return NS_OK;
}
NS_IMETHODIMP nsExtProtocolChannel::GetRemoteType(nsAString& aRemoteType) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsExtProtocolChannel::OnStartRequest(nsIRequest* aRequest) {
return NS_ERROR_UNEXPECTED;
}