? network/module/nsNetFactory.cpp

Added nsNetFactory implementation. This allows users to retrieve nsINetService pointers from the service factory manager.

M dom/src/base/nsGlobalWindow.cpp
M gfx/src/nsImageNetContextSync.cpp
M layout/html/document/src/nsHTMLDocument.cpp
M network/module/nsURL.cpp
Replaced NS_NewINetService() calls with nsServiceManager::GetService() calls.

M network/module/Makefile
M network/module/makefile.win
Added nsNetFactory.cpp to the builds.

M network/module/nsINetService.h
Added a #define for the class id of the nsNetService.

M network/module/nsIStreamListener.h
Removed the NS_DEFINE_IID of kIStreamListenerIID from the header file. Each module that wants this will need to delcare it themselves.

M network/module/nsNetFile.cpp
Fixed memory leak.

M network/module/nsNetService.cpp
Globalized the gNetlibService variable so the NetFactory can access it.

M webshell/src/nsDocLoader.cpp
M webshell/src/nsPluginViewer.cpp
NS_DEFINE_IID of kIStreamListenerIID

M webshell/tests/viewer/nsSetupRegistry.cpp
Added the netlib library to the list of libraries in the registry and register the nsNetFactory with the appropriate iid and clsids.
This commit is contained in:
valeski%netscape.com 1998-09-17 00:55:35 +00:00
Родитель ff9e11370f
Коммит 81cdcbe581
16 изменённых файлов: 326 добавлений и 236 удалений

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

@ -41,6 +41,7 @@
#include "nsIScriptGlobalObject.h"
#include "nsContentList.h"
#include "nsINetService.h"
#include "nsIServiceManager.h"
#include "nsIFormManager.h"
#include "nsRepository.h"
#include "nsParserCIID.h"
@ -67,6 +68,8 @@ static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
static NS_DEFINE_IID(kIDOMHTMLDocumentIID, NS_IDOMHTMLDOCUMENT_IID);
static NS_DEFINE_IID(kIDOMNSHTMLDocumentIID, NS_IDOMNSHTMLDOCUMENT_IID);
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
NS_LAYOUT nsresult
NS_NewHTMLDocument(nsIDocument** aInstancePtrResult)
@ -684,9 +687,9 @@ NS_IMETHODIMP
nsHTMLDocument::GetCookie(nsString& aCookie)
{
nsINetService *service;
nsresult res = NS_OK;
res = NS_NewINetService(&service, nsnull);
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
if ((NS_OK == res) && (nsnull != service)) {
res = service->GetCookieString(mDocumentURL, aCookie);
@ -701,9 +704,9 @@ NS_IMETHODIMP
nsHTMLDocument::SetCookie(const nsString& aCookie)
{
nsINetService *service;
nsresult res = NS_OK;
res = NS_NewINetService(&service, nsnull);
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
if ((NS_OK == res) && (nsnull != service)) {
res = service->SetCookieString(mDocumentURL, aCookie);

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

@ -27,6 +27,7 @@
#include "nsIScriptContext.h"
#include "nsIDOMDocument.h"
#include "nsINetService.h"
#include "nsIServiceManager.h"
#include "nsINetContainerApplication.h"
#include "nsITimer.h"
#include "nsEventListenerManager.h"
@ -71,6 +72,8 @@ static NS_DEFINE_IID(kIDOMEventReceiverIID, NS_IDOMEVENTRECEIVER_IID);
static NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID);
static NS_DEFINE_IID(kIScriptContextOwnerIID, NS_ISCRIPTCONTEXTOWNER_IID);
static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID);
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
GlobalWindowImpl::GlobalWindowImpl()
{
@ -1548,27 +1551,29 @@ NavigatorImpl::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
NS_IMETHODIMP
NavigatorImpl::GetUserAgent(nsString& aUserAgent)
{
nsINetService *service;
nsresult res = NS_OK;
nsINetService *service = nsnull;
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
res = NS_NewINetService(&service, nsnull);
if ((NS_OK == res) && (nsnull != service)) {
nsINetContainerApplication *container;
nsINetContainerApplication *container;
res = service->GetContainerApplication(&container);
if ((NS_OK == res) && (nsnull != container)) {
nsAutoString appVersion;
container->GetAppCodeName(aUserAgent);
container->GetAppVersion(appVersion);
if (NS_OK == (res = container->GetAppCodeName(aUserAgent)) ) {
nsAutoString appVersion;
if (NS_OK == (res = container->GetAppVersion(appVersion)) ) {
aUserAgent.Append('/');
aUserAgent.Append(appVersion);
}
}
NS_RELEASE(container);
}
NS_RELEASE(service);
}
return res;
}
@ -1576,20 +1581,22 @@ NS_IMETHODIMP
NavigatorImpl::GetAppCodeName(nsString& aAppCodeName)
{
nsINetService *service;
nsresult res = NS_OK;
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
res = NS_NewINetService(&service, nsnull);
if ((NS_OK == res) && (nsnull != service)) {
nsINetContainerApplication *container;
nsINetContainerApplication *container;
res = service->GetContainerApplication(&container);
if ((NS_OK == res) && (nsnull != container)) {
res = container->GetAppCodeName(aAppCodeName);
NS_RELEASE(container);
}
NS_RELEASE(service);
}
return res;
}
@ -1597,20 +1604,22 @@ NS_IMETHODIMP
NavigatorImpl::GetAppVersion(nsString& aAppVersion)
{
nsINetService *service;
nsresult res = NS_OK;
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
res = NS_NewINetService(&service, nsnull);
if ((NS_OK == res) && (nsnull != service)) {
nsINetContainerApplication *container;
nsINetContainerApplication *container;
res = service->GetContainerApplication(&container);
if ((NS_OK == res) && (nsnull != container)) {
res = container->GetAppVersion(aAppVersion);
NS_RELEASE(container);
}
NS_RELEASE(service);
}
return res;
}
@ -1618,20 +1627,22 @@ NS_IMETHODIMP
NavigatorImpl::GetAppName(nsString& aAppName)
{
nsINetService *service;
nsresult res = NS_OK;
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
res = NS_NewINetService(&service, nsnull);
if ((NS_OK == res) && (nsnull != service)) {
nsINetContainerApplication *container;
nsINetContainerApplication *container;
res = service->GetContainerApplication(&container);
if ((NS_OK == res) && (nsnull != container)) {
res = container->GetAppName(aAppName);
NS_RELEASE(container);
}
NS_RELEASE(service);
}
return res;
}
@ -1639,20 +1650,22 @@ NS_IMETHODIMP
NavigatorImpl::GetLanguage(nsString& aLanguage)
{
nsINetService *service;
nsresult res = NS_OK;
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
res = NS_NewINetService(&service, nsnull);
if ((NS_OK == res) && (nsnull != service)) {
nsINetContainerApplication *container;
nsINetContainerApplication *container;
res = service->GetContainerApplication(&container);
if ((NS_OK == res) && (nsnull != container)) {
res = container->GetLanguage(aLanguage);
NS_RELEASE(container);
}
NS_RELEASE(service);
}
return res;
}
@ -1660,20 +1673,22 @@ NS_IMETHODIMP
NavigatorImpl::GetPlatform(nsString& aPlatform)
{
nsINetService *service;
nsresult res = NS_OK;
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
res = NS_NewINetService(&service, nsnull);
if ((NS_OK == res) && (nsnull != service)) {
nsINetContainerApplication *container;
nsINetContainerApplication *container;
res = service->GetContainerApplication(&container);
if ((NS_OK == res) && (nsnull != container)) {
res = container->GetPlatform(aPlatform);
NS_RELEASE(container);
}
NS_RELEASE(service);
}
return res;
}

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

@ -27,9 +27,12 @@
#include "plstr.h"
#include "il_strm.h"
#include "nsINetService.h"
#include "nsIServiceManager.h"
static NS_DEFINE_IID(kIImageNetContextIID, IL_INETCONTEXT_IID);
static NS_DEFINE_IID(kIURLIID, NS_IURL_IID);
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
class ImageNetContextSyncImpl : public ilINetContext {
public:
@ -158,8 +161,11 @@ ImageNetContextSyncImpl::GetURL(ilIURL* aURL,
// Get a network service interface which we'll use to create a stream
nsINetService *service;
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
if (NS_SUCCEEDED(NS_NewINetService(&service, nsnull))) {
if (NS_SUCCEEDED(res)) {
nsIInputStream* stream = nsnull;
// Initiate a synchronous URL load

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

@ -41,6 +41,7 @@
#include "nsIScriptGlobalObject.h"
#include "nsContentList.h"
#include "nsINetService.h"
#include "nsIServiceManager.h"
#include "nsIFormManager.h"
#include "nsRepository.h"
#include "nsParserCIID.h"
@ -67,6 +68,8 @@ static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
static NS_DEFINE_IID(kIDOMHTMLDocumentIID, NS_IDOMHTMLDOCUMENT_IID);
static NS_DEFINE_IID(kIDOMNSHTMLDocumentIID, NS_IDOMNSHTMLDOCUMENT_IID);
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
NS_LAYOUT nsresult
NS_NewHTMLDocument(nsIDocument** aInstancePtrResult)
@ -684,9 +687,9 @@ NS_IMETHODIMP
nsHTMLDocument::GetCookie(nsString& aCookie)
{
nsINetService *service;
nsresult res = NS_OK;
res = NS_NewINetService(&service, nsnull);
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
if ((NS_OK == res) && (nsnull != service)) {
res = service->GetCookieString(mDocumentURL, aCookie);
@ -701,9 +704,9 @@ NS_IMETHODIMP
nsHTMLDocument::SetCookie(const nsString& aCookie)
{
nsINetService *service;
nsresult res = NS_OK;
res = NS_NewINetService(&service, nsnull);
nsresult res = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&service);
if ((NS_OK == res) && (nsnull != service)) {
res = service->SetCookieString(mDocumentURL, aCookie);

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

@ -30,6 +30,7 @@ CPPSRCS = \
nsNetStubs.cpp \
nsNetIDs.cpp \
nsLoadAttribs.cpp \
nsNetFactory.cpp \
$(NULL)
REQUIRES = raptor js dbm nspr security pref xpcom util img \

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

@ -72,6 +72,7 @@ OBJS= \
.\$(OBJDIR)\nsNetIDs.obj \
.\$(OBJDIR)\nsNetFile.obj \
.\$(OBJDIR)\nsLoadAttribs.obj \
.\$(OBJDIR)\nsNetFactory.obj \
$(NULL)
#//------------------------------------------------------------------------

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

@ -34,6 +34,12 @@
{ 0xcfb1a480, 0xc78f, 0x11d1, \
{0xbe, 0xa2, 0x00, 0x80, 0x5f, 0x8a, 0x66, 0xdc} }
/* {3F1BFE70-4D9C-11d2-9E7E-006008BF092E} */
#define NS_NETSERVICE_CID \
{ 0x3f1bfe70, 0x4d9c, 0x11d2, \
{0x9e, 0x7e, 0x00, 0x60, 0x08, 0xbf, 0x09, 0x2e} }
class nsINetContainerApplication;
/**

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

@ -1,124 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIStreamListener_h___
#define nsIStreamListener_h___
#include "prtypes.h"
#include "nsISupports.h"
/* forward declaration */
class nsIInputStream;
class nsString;
class nsIURL;
/* 97566110-ff60-11d1-beb9-00805f8a66dc */
#define NS_ISTREAMOBSERVER_IID \
{ 0x97566110, 0xff60, 0x11d1, \
{0xbe, 0xb9, 0x00, 0x80, 0x5f, 0x8a, 0x66, 0xdc} }
class nsIStreamObserver : public nsISupports {
public:
/**
* Notify the observer that the URL has started to load. This method is
* called only once, at the beginning of a URL load.<BR><BR>
*
* @return The return value is currently ignored. In the future it may be
* used to cancel the URL load..
*/
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType) = 0;
/**
* Notify the observer that progress as occurred for the URL load.<BR>
*/
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax) = 0;
/**
* Notify the observer with a status message for the URL load.<BR>
*/
NS_IMETHOD OnStatus(nsIURL* aURL, const nsString &aMsg) = 0;
/**
* Notify the observer that the URL has finished loading. This method is
* called once when the networking library has finished processing the
* URL transaction initiatied via the nsINetService::Open(...) call.<BR><BR>
*
* This method is called regardless of whether the URL loaded successfully.<BR><BR>
*
* @param status Status code for the URL load.
* @param msg A text string describing the error.
* @return The return value is currently ignored.
*/
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString &aMsg) = 0;
};
/* Generic status codes for OnStopBinding */
#define NS_BINDING_SUCCEEDED NS_OK
#define NS_BINDING_FAILED ((nsresult)-1)
#define NS_BINDING_ABORTED ((nsresult)-2)
/* 45d234d0-c6c9-11d1-bea2-00805f8a66dc */
#define NS_ISTREAMLISTENER_IID \
{ 0x45d234d0, 0xc6c9, 0x11d1, \
{0xbe, 0xa2, 0x00, 0x80, 0x5f, 0x8a, 0x66, 0xdc} }
NS_DECLARE_ID(kIStreamListenerIID, 0x45d234d0, 0xc6c9, 0x11d1,
0xbe, 0xa2, 0x00, 0x80, 0x5f, 0x8a, 0x66, 0xdc);
/**
* The nsIStreamListener interface provides the necessary notifications
* during both synchronous and asynchronous URL loading.
* This is a preliminary interface which <B>will</B> change over time!
* <BR><BR>
* An instance of this interface is passed to nsINetService::Open(...) to
* allow the client to receive status and notifications during the loading
* of the URL.
* <BR><BR>
* Over time this interface will provide the same functionality as the
* IBindStatusCallback interface in the MS INET-SDK...
*/
class nsIStreamListener : public nsIStreamObserver {
public:
/**
* Return information regarding the current URL load.<BR>
*
* This method is currently not called.
*/
NS_IMETHOD GetBindInfo(nsIURL* aURL) = 0;
/**
* Notify the client that data is available in the input stream. This
* method is called whenver data is written into the input stream by the
* networking library...<BR><BR>
*
* @param pIStream The input stream containing the data. This stream can
* be either a blocking or non-blocking stream.
* @param length The amount of data that was just pushed into the stream.
* @return The return value is currently ignored.
*/
NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *aIStream,
PRInt32 aLength) = 0;
};
#endif /* nsIStreamListener_h___ */

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

@ -0,0 +1,163 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nscore.h"
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsINetService.h"
#include "nsNetService.h"
/* This implementation of the network service factory is presently
* only taking advantage of the service retrieval benefit that the
* nsINetService interface provides. The module initialization and
* unloading is still bound to main program execution and closing.
* Once we break this dependence, the
* nsNetFactory will also appropriately handle loading/initializing/
* unloading of the library.
*/
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
extern nsNetlibService *gNetlibService; // See nsNetService.cpp
class nsNetFactory : public nsIFactory
{
public:
// nsISupports methods
NS_IMETHOD QueryInterface(const nsIID &aIID,
void **aResult);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
// nsIFactory methods
NS_IMETHOD CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
nsNetFactory(const nsCID &aClass);
protected:
virtual ~nsNetFactory();
private:
nsrefcnt mRefCnt;
nsCID mClassID;
};
nsNetFactory::nsNetFactory(const nsCID &aClass)
{
mRefCnt = 0;
mClassID = aClass;
}
nsNetFactory::~nsNetFactory()
{
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
}
nsresult nsNetFactory::QueryInterface(const nsIID &aIID,
void **aResult)
{
if (aResult == NULL) {
return NS_ERROR_NULL_POINTER;
}
// Always NULL result, in case of failure
*aResult = NULL;
if (aIID.Equals(kISupportsIID)) {
*aResult = (void *)(nsISupports*)this;
} else if (aIID.Equals(kIFactoryIID)) {
*aResult = (void *)(nsIFactory*)this;
}
if (*aResult == NULL) {
return NS_NOINTERFACE;
}
AddRef(); // Increase reference count for caller
return NS_OK;
}
nsrefcnt nsNetFactory::AddRef()
{
return ++mRefCnt;
}
nsrefcnt nsNetFactory::Release()
{
if (--mRefCnt == 0) {
delete this;
return 0; // Don't access mRefCnt after deleting!
}
return mRefCnt;
}
nsresult nsNetFactory::CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult)
{
nsresult res;
if (aResult == NULL) {
return NS_ERROR_NULL_POINTER;
}
*aResult = NULL;
if (mClassID.Equals(kNetServiceCID)) {
// No need create a new one if we've already got one.
if (!gNetlibService) {
res = NS_InitINetService(nsnull);
if (res != NS_OK)
return NS_ERROR_FAILURE;
}
// Hook the caller up.
res = NS_NewINetService((nsINetService**)aResult, aOuter);
}
return res;
}
nsresult nsNetFactory::LockFactory(PRBool aLock)
{
// Not implemented in simplest case.
return NS_OK;
}
// return the proper factory to the caller
#ifdef XP_MAC
extern "C" NS_NET nsresult NSGetFactory_DOM_DLL(const nsCID &aClass, nsIFactory **aFactory)
#else
extern "C" NS_NET nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory)
#endif
{
if (nsnull == aFactory) {
return NS_ERROR_NULL_POINTER;
}
*aFactory = new nsNetFactory(aClass);
if (nsnull == aFactory) {
return NS_ERROR_OUT_OF_MEMORY;
}
return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory);
}

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

@ -718,7 +718,7 @@ nsresult nsNetFile::FileRemove(const char *aPath) {
// We should never be deleting a relative file.
NS_PRECONDITION( ( (*path != mDirDel) && (*path && (*path+1 != ':'))), "Deleting a relative path.");
if (PR_Delete(aPath) == PR_FAILURE)
if (PR_Delete(path) == PR_FAILURE)
return NS_ERROR_FAILURE;
return NS_OK;

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

@ -637,8 +637,8 @@ nsresult PerformNastyWindowsAsyncDNSHack(URL_Struct *URL_s, nsIURL* aURL)
}
#endif /* XP_WIN */
static nsNetlibService *gNetlibService = nsnull;
// This is global so it can be accessed by the NetFactory (nsNetFactory.cpp)
nsNetlibService *gNetlibService = nsnull;
//
// Class to manage static initialization of the Netlib DLL...

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

@ -18,6 +18,7 @@
#include "nsIURL.h"
#include "nsIInputStream.h"
#include "nsINetService.h"
#include "nsIServiceManager.h"
#include "nsIHttpUrl.h" /* NS_NewHttpUrl(...) */
#include "nsString.h"
#include <stdlib.h>
@ -614,11 +615,14 @@ nsresult URLImpl::ParseURL(const nsIURL* aURL, const nsString& aSpec)
return NS_OK;
}
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
nsIInputStream* URLImpl::Open(PRInt32* aErrorCode)
{
nsresult rv;
nsIInputStream* in = nsnull;
nsINetService *inet;
nsINetService *inet = nsnull;
// XXX: Rewrite the resource: URL into a file: URL
if (PL_strcmp(mProtocol, "resource") == 0) {
@ -629,7 +633,12 @@ nsIInputStream* URLImpl::Open(PRInt32* aErrorCode)
PR_Free(fileName);
}
rv = NS_NewINetService(&inet, nsnull);
nsINetService *service;
rv = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&inet);
if (NS_OK == rv) {
rv = inet->OpenBlockingStream(this, NULL, &in);
}
@ -653,7 +662,9 @@ nsresult URLImpl::Open(nsIStreamListener *aListener)
PR_Free(fileName);
}
rv = NS_NewINetService(&inet, nsnull);
rv = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&inet);
if (NS_OK == rv) {
rv = inet->OpenStream(this, aListener);
}

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

@ -71,8 +71,7 @@ NS_DEFINE_IID(kIDocumentLoadInfoIID, NS_IDOCUMENTLOADINFO_IID);
NS_DEFINE_IID(kRefreshURLIID, NS_IREFRESHURL_IID);
NS_DEFINE_IID(kHTTPURLIID, NS_IHTTPURL_IID);
NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID);
/*
* The nsDocumentBindInfo contains the state required when a single document

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

@ -71,8 +71,7 @@ NS_DEFINE_IID(kIDocumentLoadInfoIID, NS_IDOCUMENTLOADINFO_IID);
NS_DEFINE_IID(kRefreshURLIID, NS_IREFRESHURL_IID);
NS_DEFINE_IID(kHTTPURLIID, NS_IHTTPURL_IID);
NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID);
/*
* The nsDocumentBindInfo contains the state required when a single document

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

@ -38,6 +38,8 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIPluginHostIID, NS_IPLUGINHOST_IID);
static NS_DEFINE_IID(kIPluginInstanceOwnerIID, NS_IPLUGININSTANCEOWNER_IID);
static NS_DEFINE_IID(kILinkHandlerIID, NS_ILINKHANDLER_IID);
static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID);
class PluginViewerImpl;

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

@ -37,6 +37,7 @@
#include "nsParserCIID.h"
#include "nsDOMCID.h"
#include "nsINetService.h"
#ifdef XP_PC
#define WIDGET_DLL "raptorwidget.dll"
@ -47,6 +48,7 @@
#define PREF_DLL "xppref32.dll"
#define PARSER_DLL "raptorhtmlpars.dll"
#define DOM_DLL "jsdom.dll"
#define NETLIB_DLL "netlib.dll"
#else
#ifdef XP_MAC
#include "nsMacRepository.h"
@ -59,6 +61,7 @@
#define PREF_DLL "libpref.so"
#define PARSER_DLL "libraptorhtmlpars.so"
#define DOM_DLL "libjsdom.so"
#define NETLIB_DLL "netlib.so"
#endif
#endif
@ -94,6 +97,7 @@ static NS_DEFINE_IID(kCPluginHostCID, NS_PLUGIN_HOST_CID);
static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID);
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
static NS_DEFINE_IID(kCDOMScriptObjectFactory, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
extern "C" void
@ -130,4 +134,5 @@ NS_SetupRegistry()
nsRepository::RegisterFactory(kCPluginHostCID, PLUGIN_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCParserCID, PARSER_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCDOMScriptObjectFactory, DOM_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kNetServiceCID, NETLIB_DLL, PR_FALSE, PR_FALSE);
}