Bug 1596409 - P5: Enable necessary XPCOM components for using nsHttpTransaction in socket process r=dragana

Differential Revision: https://phabricator.services.mozilla.com/D54165

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kershaw Chang 2019-12-03 13:45:19 +00:00
parent 23e2261f84
commit e686a3ff31
5 changed files with 40 additions and 18 deletions

View File

@ -17,8 +17,10 @@
#include "mozilla/InputStreamLengthHelper.h"
#include "mozilla/SlicedInputStream.h"
#include "mozilla/InputStreamLengthWrapper.h"
#include "nsBufferedStreams.h"
#include "nsComponentManagerUtils.h"
#include "nsDebug.h"
#include "nsFileStreams.h"
#include "nsIAsyncInputStream.h"
#include "nsIAsyncOutputStream.h"
#include "nsID.h"
@ -294,25 +296,39 @@ already_AddRefed<nsIInputStream> InputStreamHelper::DeserializeInputStream(
nsCOMPtr<nsIIPCSerializableInputStream> serializable;
switch (aParams.type()) {
case InputStreamParams::TStringInputStreamParams:
serializable = do_CreateInstance(kStringInputStreamCID);
break;
case InputStreamParams::TStringInputStreamParams: {
nsCOMPtr<nsIInputStream> stream;
NS_NewCStringInputStream(getter_AddRefs(stream), EmptyCString());
serializable = do_QueryInterface(stream);
} break;
case InputStreamParams::TFileInputStreamParams:
serializable = do_CreateInstance(kFileInputStreamCID);
break;
case InputStreamParams::TFileInputStreamParams: {
nsCOMPtr<nsIFileInputStream> stream;
nsFileInputStream::Create(nullptr, NS_GET_IID(nsIFileInputStream),
getter_AddRefs(stream));
serializable = do_QueryInterface(stream);
} break;
case InputStreamParams::TBufferedInputStreamParams:
serializable = do_CreateInstance(kBufferedInputStreamCID);
break;
case InputStreamParams::TBufferedInputStreamParams: {
nsCOMPtr<nsIBufferedInputStream> stream;
nsBufferedInputStream::Create(nullptr, NS_GET_IID(nsIBufferedInputStream),
getter_AddRefs(stream));
serializable = do_QueryInterface(stream);
} break;
case InputStreamParams::TMIMEInputStreamParams:
serializable = do_CreateInstance(kMIMEInputStreamCID);
break;
case InputStreamParams::TMIMEInputStreamParams: {
nsCOMPtr<nsIMIMEInputStream> stream;
nsMIMEInputStreamConstructor(nullptr, NS_GET_IID(nsIMIMEInputStream),
getter_AddRefs(stream));
serializable = do_QueryInterface(stream);
} break;
case InputStreamParams::TMultiplexInputStreamParams:
serializable = do_CreateInstance(kMultiplexInputStreamCID);
break;
case InputStreamParams::TMultiplexInputStreamParams: {
nsCOMPtr<nsIMultiplexInputStream> stream;
nsMultiplexInputStreamConstructor(
nullptr, NS_GET_IID(nsIMultiplexInputStream), getter_AddRefs(stream));
serializable = do_QueryInterface(stream);
} break;
case InputStreamParams::TSlicedInputStreamParams:
serializable = new SlicedInputStream();

View File

@ -201,6 +201,7 @@ LOCAL_INCLUDES += [
'/dom/storage',
'/media/webrtc/trunk',
'/media/webrtc/trunk/webrtc',
'/netwerk/base',
'/xpcom/build',
]

View File

@ -20,6 +20,7 @@
#include "mozilla/StoragePrincipalHelper.h"
#include "mozilla/TaskQueue.h"
#include "mozilla/Telemetry.h"
#include "nsBufferedStreams.h"
#include "nsCategoryCache.h"
#include "nsContentUtils.h"
#include "nsFileStreams.h"
@ -1263,9 +1264,9 @@ MOZ_MUST_USE nsresult NS_NewBufferedInputStream(
uint32_t aBufferSize) {
nsCOMPtr<nsIInputStream> inputStream = std::move(aInputStream);
nsresult rv;
nsCOMPtr<nsIBufferedInputStream> in =
do_CreateInstance(NS_BUFFEREDINPUTSTREAM_CONTRACTID, &rv);
nsCOMPtr<nsIBufferedInputStream> in;
nsresult rv = nsBufferedInputStream::Create(
nullptr, NS_GET_IID(nsIBufferedInputStream), getter_AddRefs(in));
if (NS_SUCCEEDED(rv)) {
rv = in->Init(inputStream, aBufferSize);
if (NS_SUCCEEDED(rv)) {

View File

@ -143,6 +143,7 @@ Classes = [
'contract_ids': ['@mozilla.org/network/http-activity-distributor;1'],
'type': 'mozilla::net::nsHttpActivityDistributor',
'headers': ['/netwerk/protocol/http/nsHttpActivityDistributor.h'],
'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS,
},
{
'cid': '{36b63ef3-e0fa-4c49-9fd4-e065e85568f4}',
@ -287,12 +288,14 @@ Classes = [
'contract_ids': ['@mozilla.org/network/protocol;1?name=http'],
'singleton': True,
'type': 'mozilla::net::nsHttpHandler',
'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS,
},
{
'cid': '{dccbe7e4-7750-466b-a557-5ea36c8ff24e}',
'contract_ids': ['@mozilla.org/network/protocol;1?name=https'],
'singleton': True,
'type': 'mozilla::net::nsHttpsHandler',
'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS,
},
{
'cid': '{aea16cd0-f020-4138-b068-0716c4a15b5a}',

View File

@ -18,6 +18,7 @@ Classes = [
] + crash_reporter,
'legacy_constructor': 'mozilla::AppInfoConstructor',
'headers': ['nsAppRunner.h'],
'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS,
},
{
'cid': '{471f4944-1dd2-11b2-87ac-90be0a51d609}',