mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-18 23:15:38 +00:00
Removed the nsINetContainerApplication interface. The methods that were part of this interface are now implemented by nsINetService.
Changed mozilla\network\module\makefiles so they no longer export nsINetContainerApplication.h. M dom/src/base/nsGlobalWindow.cpp Changed javascript so it retreives the user-agent tokens via nsINetService. M network/module/nsINetService.h Added the application user-agent token methods to the nsINetService interface. M network/module/nsNetFactory.cpp The netservice constructor no longer takes a pointer to a nsINetContainerApplication. M network/module/nsNetService.cpp M network/module/nsNetService.h Added the implementation of the application user-agent token methods. M webshell/tests/viewer/nsViewerApp.cpp M webshell/tests/viewer/nsViewerApp.h Removed old containerapplication implementation M xpfe/xpviewer/src/nsViewerApp.cpp M xpfe/xpviewer/src/nsViewerApp.h Removed old containerapplication implementation
This commit is contained in:
parent
594b97f546
commit
8ba523d9f7
@ -29,7 +29,6 @@
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsINetService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsINetContainerApplication.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
@ -1880,20 +1879,12 @@ NavigatorImpl::GetUserAgent(nsString& aUserAgent)
|
||||
(nsISupports **)&service);
|
||||
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
|
||||
nsINetContainerApplication *container;
|
||||
res = service->GetContainerApplication(&container);
|
||||
if ((NS_OK == res) && (nsnull != container)) {
|
||||
|
||||
if (NS_OK == (res = container->GetAppCodeName(aUserAgent)) ) {
|
||||
|
||||
nsAutoString appVersion;
|
||||
if (NS_OK == (res = container->GetAppVersion(appVersion)) ) {
|
||||
aUserAgent.Append('/');
|
||||
aUserAgent.Append(appVersion);
|
||||
}
|
||||
if (NS_OK == (res = service->GetAppCodeName(aUserAgent)) ) {
|
||||
nsAutoString appVersion;
|
||||
if (NS_OK == (res = service->GetAppVersion(appVersion)) ) {
|
||||
aUserAgent.Append('/');
|
||||
aUserAgent.Append(appVersion);
|
||||
}
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
NS_RELEASE(service);
|
||||
}
|
||||
@ -1909,14 +1900,7 @@ NavigatorImpl::GetAppCodeName(nsString& aAppCodeName)
|
||||
(nsISupports **)&service);
|
||||
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
|
||||
nsINetContainerApplication *container;
|
||||
res = service->GetContainerApplication(&container);
|
||||
if ((NS_OK == res) && (nsnull != container)) {
|
||||
|
||||
res = container->GetAppCodeName(aAppCodeName);
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
res = service->GetAppCodeName(aAppCodeName);
|
||||
NS_RELEASE(service);
|
||||
}
|
||||
|
||||
@ -1932,14 +1916,7 @@ NavigatorImpl::GetAppVersion(nsString& aAppVersion)
|
||||
(nsISupports **)&service);
|
||||
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
|
||||
nsINetContainerApplication *container;
|
||||
res = service->GetContainerApplication(&container);
|
||||
if ((NS_OK == res) && (nsnull != container)) {
|
||||
|
||||
res = container->GetAppVersion(aAppVersion);
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
res = service->GetAppVersion(aAppVersion);
|
||||
NS_RELEASE(service);
|
||||
}
|
||||
|
||||
@ -1955,14 +1932,7 @@ NavigatorImpl::GetAppName(nsString& aAppName)
|
||||
(nsISupports **)&service);
|
||||
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
|
||||
nsINetContainerApplication *container;
|
||||
res = service->GetContainerApplication(&container);
|
||||
if ((NS_OK == res) && (nsnull != container)) {
|
||||
|
||||
res = container->GetAppName(aAppName);
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
res = service->GetAppName(aAppName);
|
||||
NS_RELEASE(service);
|
||||
}
|
||||
|
||||
@ -1978,14 +1948,7 @@ NavigatorImpl::GetLanguage(nsString& aLanguage)
|
||||
(nsISupports **)&service);
|
||||
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
|
||||
nsINetContainerApplication *container;
|
||||
res = service->GetContainerApplication(&container);
|
||||
if ((NS_OK == res) && (nsnull != container)) {
|
||||
|
||||
res = container->GetLanguage(aLanguage);
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
res = service->GetLanguage(aLanguage);
|
||||
NS_RELEASE(service);
|
||||
}
|
||||
|
||||
@ -2001,14 +1964,7 @@ NavigatorImpl::GetPlatform(nsString& aPlatform)
|
||||
(nsISupports **)&service);
|
||||
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
|
||||
nsINetContainerApplication *container;
|
||||
res = service->GetContainerApplication(&container);
|
||||
if ((NS_OK == res) && (nsnull != container)) {
|
||||
|
||||
res = container->GetPlatform(aPlatform);
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
res = service->GetPlatform(aPlatform);
|
||||
NS_RELEASE(service);
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ nsIRelatedLinks.h
|
||||
nsIURL.h
|
||||
nsIPostToServer.h
|
||||
nsIHttpUrl.h
|
||||
nsINetContainerApplication.h
|
||||
nsIRefreshUrl.h
|
||||
nsIConnectionInfo.h
|
||||
nsILoadAttribs.h
|
||||
|
@ -45,7 +45,6 @@ EXPORTS = nsIStreamListener.h \
|
||||
nsIRelatedLinks.h \
|
||||
nsIPostToServer.h \
|
||||
nsIHttpUrl.h \
|
||||
nsINetContainerApplication.h \
|
||||
nsIRefreshUrl.h \
|
||||
nsIConnectionInfo.h \
|
||||
nsILoadAttribs.h \
|
||||
|
@ -50,7 +50,6 @@ EXPORTS = nsIStreamListener.h \
|
||||
nsIRelatedLinks.h \
|
||||
nsIPostToServer.h \
|
||||
nsIHttpUrl.h \
|
||||
nsINetContainerApplication.h \
|
||||
nsIRefreshUrl.h \
|
||||
nsIConnectionInfo.h \
|
||||
nsILoadAttribs.h \
|
||||
|
@ -29,7 +29,6 @@ EXPORTS = nsIStreamListener.h \
|
||||
nsIPostToServer.h \
|
||||
nsIHttpUrl.h \
|
||||
nsIRelatedLinks.h \
|
||||
nsINetContainerApplication.h \
|
||||
nsIRefreshUrl.h \
|
||||
nsIConnectionInfo.h \
|
||||
nsINetFile.h \
|
||||
|
@ -1,78 +0,0 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsINetContainerApplication_h__
|
||||
#define nsINetContainerApplication_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#define NS_INETCONTAINERAPPLICATION_IID \
|
||||
{ 0xca2610f0, 0x1054, 0x11d2, \
|
||||
{ 0xb3, 0x26, 0x00, 0x80, 0x5f, 0x8a, 0x38, 0x59 } }
|
||||
|
||||
class nsINetContainerApplication : public nsISupports {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Get the application name string that will be used as part
|
||||
* of a HTTP request.
|
||||
*
|
||||
* @param aAppCodeName The application name string.
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName)=0;
|
||||
|
||||
/**
|
||||
* Get the application version string that will be used as part
|
||||
* of a HTTP request.
|
||||
*
|
||||
* @param aAppVersion The application version string.
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD GetAppVersion(nsString& aAppVersion)=0;
|
||||
|
||||
/**
|
||||
* Get the application name.
|
||||
*
|
||||
* @param aAppName The application name.
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD GetAppName(nsString& aAppName)=0;
|
||||
|
||||
/**
|
||||
* Get the translation of the application. The value for language
|
||||
* is usually a 2-letter code such as "en" and occasionally a
|
||||
* five-character code to indicate a language subtype, such as "zh_CN".
|
||||
*
|
||||
* @param aLanguage The application language.
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD GetLanguage(nsString& aLanguage)=0;
|
||||
|
||||
/**
|
||||
* Get the current platform (machine type).
|
||||
*
|
||||
* @param aPlatform The current platform.
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD GetPlatform(nsString& aPlatform)=0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsINetContainerApplication_h__
|
@ -40,8 +40,6 @@
|
||||
{0x9e, 0x7e, 0x00, 0x60, 0x08, 0xbf, 0x09, 0x2e} }
|
||||
|
||||
|
||||
class nsINetContainerApplication;
|
||||
|
||||
/**
|
||||
* The nsINetService interface provides an API to the networking service.
|
||||
* This is a preliminary interface which <B>will</B> change over time!
|
||||
@ -75,15 +73,6 @@ struct nsINetService : public nsISupports
|
||||
nsIStreamListener *aConsumer,
|
||||
nsIInputStream **aNewStream) = 0;
|
||||
|
||||
/**
|
||||
* Get the container application for the net service.
|
||||
*
|
||||
* @param aContainer An output parameter to receive the container
|
||||
* application.
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD GetContainerApplication(nsINetContainerApplication **aContainer)=0;
|
||||
|
||||
/**
|
||||
* Get the complete cookie string associated with the URL
|
||||
*
|
||||
@ -137,6 +126,60 @@ struct nsINetService : public nsISupports
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD SetHTTPOneOne(PRBool aSendOneOne)=0;
|
||||
|
||||
/**
|
||||
* Get the application name string that will be used as part
|
||||
* of a HTTP request.
|
||||
*
|
||||
* @param aAppCodeName The application name string.
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName)=0;
|
||||
|
||||
/**
|
||||
* Get the application version string that will be used as part
|
||||
* of a HTTP request.
|
||||
*
|
||||
* @param aAppVersion The application version string.
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD GetAppVersion(nsString& aAppVersion)=0;
|
||||
|
||||
/**
|
||||
* Get the application name.
|
||||
*
|
||||
* @param aAppName The application name.
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD GetAppName(nsString& aAppName)=0;
|
||||
|
||||
/**
|
||||
* Get the translation of the application. The value for language
|
||||
* is usually a 2-letter code such as "en" and occasionally a
|
||||
* five-character code to indicate a language subtype, such as "zh_CN".
|
||||
*
|
||||
* @param aLanguage The application language.
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD GetLanguage(nsString& aLanguage)=0;
|
||||
|
||||
/**
|
||||
* Get the current platform (machine type).
|
||||
*
|
||||
* @param aPlatform The current platform.
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD GetPlatform(nsString& aPlatform)=0;
|
||||
|
||||
/**
|
||||
* Add a string to the user agent AppVersion.
|
||||
*
|
||||
* @param aCustom The string to be inserted into the AppVersion portion
|
||||
* of the user agent string. A user-agent of the form:
|
||||
* Mozilla/x.x [en] (OS; I) becomes Mozilla/x.x [en]C-aCustom (OS; I)
|
||||
* @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
|
||||
*/
|
||||
NS_IMETHOD SetCustomUserAgent(nsString aCustom)=0;
|
||||
};
|
||||
|
||||
|
||||
@ -147,7 +190,7 @@ struct nsINetService : public nsISupports
|
||||
extern "C" NS_NET nsresult NS_NewINetService(nsINetService** aInstancePtrResult,
|
||||
nsISupports* aOuter);
|
||||
|
||||
extern "C" NS_NET nsresult NS_InitINetService(nsINetContainerApplication *aContainer);
|
||||
extern "C" NS_NET nsresult NS_InitINetService();
|
||||
|
||||
extern "C" NS_NET nsresult NS_ShutdownINetService();
|
||||
|
||||
|
@ -125,7 +125,7 @@ nsresult nsNetFactory::CreateInstance(nsISupports *aOuter,
|
||||
if (mClassID.Equals(kNetServiceCID)) {
|
||||
// No need create a new one if we've already got one.
|
||||
if (!gNetlibService) {
|
||||
res = NS_InitINetService(nsnull);
|
||||
res = NS_InitINetService();
|
||||
if (res != NS_OK)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ extern "C" {
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIProtocolConnection.h"
|
||||
#include "nsINetContainerApplication.h"
|
||||
|
||||
#ifdef XP_PC
|
||||
#include <windows.h>
|
||||
@ -99,7 +98,7 @@ extern const char *XP_AppPlatform;
|
||||
static NS_DEFINE_IID(kIProtocolConnectionIID, NS_IPROTOCOLCONNECTION_IID);
|
||||
|
||||
|
||||
nsNetlibService::nsNetlibService(nsINetContainerApplication *aContainerApp)
|
||||
nsNetlibService::nsNetlibService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
@ -107,7 +106,6 @@ nsNetlibService::nsNetlibService(nsINetContainerApplication *aContainerApp)
|
||||
m_stubContext = new_stub_context();
|
||||
*/
|
||||
mPollingTimer = nsnull;
|
||||
mContainer = nsnull;
|
||||
|
||||
mNetlibThread = new nsNetlibThread();
|
||||
if (nsnull != mNetlibThread) {
|
||||
@ -136,35 +134,33 @@ nsNetlibService::nsNetlibService(nsINetContainerApplication *aContainerApp)
|
||||
PREF_SetDefaultCharPref(pref_padPacURL, "");
|
||||
PREF_SetDefaultCharPref(pref_scriptName, "");
|
||||
|
||||
if (NULL != aContainerApp) {
|
||||
XP_AppCodeName = NULL;
|
||||
XP_AppVersion = NULL;
|
||||
XP_AppName = NULL;
|
||||
XP_AppLanguage = NULL;
|
||||
XP_AppPlatform = NULL;
|
||||
// XXX: Where should the defaults really come from
|
||||
XP_AppCodeName = PL_strdup("Mozilla");
|
||||
XP_AppName = PL_strdup("Netscape");
|
||||
|
||||
SetContainerApplication(aContainerApp);
|
||||
}
|
||||
else {
|
||||
// XXX: Where should the defaults really come from
|
||||
XP_AppCodeName = PL_strdup("Mozilla");
|
||||
XP_AppVersion = PL_strdup("5.0 Netscape/5.0 (Windows;I;x86;en)");
|
||||
XP_AppName = PL_strdup("Netscape");
|
||||
|
||||
/*
|
||||
* XXX: Some of these should come from resources and/or
|
||||
* platform-specific code.
|
||||
*/
|
||||
XP_AppLanguage = PL_strdup("en");
|
||||
/*
|
||||
* XXX: Some of these should come from resources and/or
|
||||
* platform-specific code.
|
||||
*/
|
||||
XP_AppLanguage = PL_strdup("en");
|
||||
#ifdef XP_WIN
|
||||
XP_AppPlatform = PL_strdup("Win32");
|
||||
XP_AppPlatform = PL_strdup("Win32s");
|
||||
#elif defined(XP_MAC)
|
||||
XP_AppPlatform = PL_strdup("MacPPC");
|
||||
XP_AppPlatform = PL_strdup("MacPPC");
|
||||
#elif defined(XP_UNIX)
|
||||
/* XXX: Need to differentiate between various Unisys */
|
||||
XP_AppPlatform = PL_strdup("Unix");
|
||||
/* XXX: Need to differentiate between various Unisys */
|
||||
XP_AppPlatform = PL_strdup("Unix");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Build up the appversion. */
|
||||
char buf[64];
|
||||
sprintf(buf, "%s/4.05 [%s] (%s; I)",
|
||||
XP_AppCodeName,
|
||||
XP_AppLanguage,
|
||||
XP_AppPlatform);
|
||||
if (XP_AppVersion)
|
||||
PR_Free(XP_AppVersion);
|
||||
XP_AppVersion = PL_strdup(buf);
|
||||
}
|
||||
|
||||
|
||||
@ -184,7 +180,6 @@ nsNetlibService::~nsNetlibService()
|
||||
*/
|
||||
|
||||
NS_IF_RELEASE(mPollingTimer);
|
||||
NS_IF_RELEASE(mContainer);
|
||||
|
||||
if (nsnull != mNetlibThread) {
|
||||
mNetlibThread->Stop();
|
||||
@ -490,62 +485,6 @@ loser:
|
||||
return NS_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetlibService::GetContainerApplication(nsINetContainerApplication **aContainer)
|
||||
{
|
||||
NS_LOCK_INSTANCE();
|
||||
*aContainer = mContainer;
|
||||
NS_IF_ADDREF(*aContainer);
|
||||
NS_UNLOCK_INSTANCE();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNetlibService::SetContainerApplication(nsINetContainerApplication *aContainer)
|
||||
{
|
||||
NS_LOCK_INSTANCE();
|
||||
|
||||
NS_IF_RELEASE(mContainer);
|
||||
|
||||
mContainer = aContainer;
|
||||
NS_IF_ADDREF(mContainer);
|
||||
NS_VERIFY_THREADSAFE_INTERFACE(mContainer);
|
||||
|
||||
if (mContainer) {
|
||||
nsAutoString str;
|
||||
|
||||
if (XP_AppCodeName) {
|
||||
PR_Free((void *)XP_AppCodeName);
|
||||
}
|
||||
mContainer->GetAppCodeName(str);
|
||||
XP_AppCodeName = str.ToNewCString();
|
||||
if (XP_AppVersion) {
|
||||
PR_Free((void *)XP_AppVersion);
|
||||
}
|
||||
mContainer->GetAppVersion(str);
|
||||
XP_AppVersion = str.ToNewCString();
|
||||
if (XP_AppName) {
|
||||
PR_Free((void *)XP_AppName);
|
||||
}
|
||||
mContainer->GetAppName(str);
|
||||
XP_AppName = str.ToNewCString();
|
||||
if (XP_AppPlatform) {
|
||||
PR_Free((void *)XP_AppPlatform);
|
||||
}
|
||||
mContainer->GetPlatform(str);
|
||||
XP_AppPlatform = str.ToNewCString();
|
||||
if (XP_AppLanguage) {
|
||||
PR_Free((void *)XP_AppLanguage);
|
||||
}
|
||||
mContainer->GetLanguage(str);
|
||||
XP_AppLanguage = str.ToNewCString();
|
||||
}
|
||||
|
||||
NS_UNLOCK_INSTANCE();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetlibService::GetCookieString(nsIURL *aURL, nsString& aCookie)
|
||||
{
|
||||
@ -669,6 +608,65 @@ nsNetlibService::SetHTTPOneOne(PRBool aSendOneOne) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetlibService::GetAppCodeName(nsString& aAppCodeName)
|
||||
{
|
||||
aAppCodeName.SetString("Mozilla");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetlibService::GetAppVersion(nsString& aAppVersion)
|
||||
{
|
||||
//This seems kinda wrong in x-platform code
|
||||
aAppVersion.SetString("4.05 [en] (WinNT;I)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetlibService::GetAppName(nsString& aAppName)
|
||||
{
|
||||
aAppName.SetString("Netscape");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetlibService::GetLanguage(nsString& aLanguage)
|
||||
{
|
||||
aLanguage.SetString("en");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetlibService::GetPlatform(nsString& aPlatform)
|
||||
{
|
||||
//This seems kinda wrong in x-platform code
|
||||
aPlatform.SetString("Win32");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetlibService::SetCustomUserAgent(nsString aCustom)
|
||||
{
|
||||
PRInt32 inIdx;
|
||||
PRUnichar inChar = ']';
|
||||
|
||||
if (!XP_AppVersion || (0 >= aCustom.Length()) )
|
||||
return NS_FALSE;
|
||||
|
||||
nsString newAppVersion = XP_AppVersion;
|
||||
|
||||
inIdx = newAppVersion.Find(inChar);
|
||||
if (0 > inIdx) {
|
||||
newAppVersion.Insert(aCustom, inIdx + 1);
|
||||
}
|
||||
|
||||
PR_Free(XP_AppVersion);
|
||||
XP_AppVersion = newAppVersion.ToNewCString();
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
void nsNetlibService::SchedulePollingTimer()
|
||||
{
|
||||
#if !defined(NETLIB_THREAD)
|
||||
@ -773,7 +771,7 @@ struct nsNetlibInit {
|
||||
* since a runtime library lock is being held by the mozilla thread
|
||||
* which results in a deadlock when the netlib thread is started...
|
||||
*/
|
||||
(void) NS_InitINetService(nsnull);
|
||||
(void) NS_InitINetService();
|
||||
#endif /* !NETLIB_THREAD */
|
||||
}
|
||||
|
||||
@ -811,39 +809,30 @@ NS_NET nsresult NS_NewINetService(nsINetService** aInstancePtrResult,
|
||||
|
||||
// The Netlib Service is created by the nsNetlibInit class...
|
||||
if (nsnull == gNetlibService) {
|
||||
(void) NS_InitINetService(nsnull);
|
||||
(void) NS_InitINetService();
|
||||
/// return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return gNetlibService->QueryInterface(kINetServiceIID, (void**)aInstancePtrResult);
|
||||
}
|
||||
|
||||
NS_NET nsresult NS_InitINetService(nsINetContainerApplication *aContainer)
|
||||
NS_NET nsresult NS_InitINetService()
|
||||
{
|
||||
/* XXX: For now only allow a single instance of the Netlib Service */
|
||||
if (nsnull == gNetlibService) {
|
||||
gNetlibService = new nsNetlibService(aContainer);
|
||||
gNetlibService = new nsNetlibService();
|
||||
if (nsnull == gNetlibService) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gNetlibService->SetContainerApplication(aContainer);
|
||||
}
|
||||
|
||||
NS_ADDREF(gNetlibService);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_NET nsresult NS_ShutdownINetService()
|
||||
{
|
||||
nsNetlibService *service = gNetlibService;
|
||||
|
||||
// Release the container...
|
||||
if (nsnull != service) {
|
||||
gNetlibService->SetContainerApplication(nsnull);
|
||||
NS_RELEASE(service);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "nsNetThread.h"
|
||||
#include "net.h"
|
||||
|
||||
class nsINetContainerApplication;
|
||||
class nsITimer;
|
||||
|
||||
class nsNetlibService : public nsINetService {
|
||||
@ -35,7 +34,7 @@ class nsNetlibService : public nsINetService {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsNetlibService(nsINetContainerApplication *aContainer);
|
||||
nsNetlibService();
|
||||
|
||||
/* Implementation of the nsINetService interface */
|
||||
NS_IMETHOD OpenStream(nsIURL *aUrl, nsIStreamListener *aConsumer);
|
||||
@ -43,9 +42,6 @@ public:
|
||||
nsIStreamListener *aConsumer,
|
||||
nsIInputStream **aNewStream);
|
||||
|
||||
NS_IMETHOD GetContainerApplication(nsINetContainerApplication **aContainer);
|
||||
nsresult SetContainerApplication(nsINetContainerApplication *aContainer);
|
||||
|
||||
NS_IMETHOD GetCookieString(nsIURL *aURL, nsString& aCookie);
|
||||
NS_IMETHOD SetCookieString(nsIURL *aURL, const nsString& aCookie);
|
||||
|
||||
@ -54,6 +50,13 @@ public:
|
||||
NS_IMETHOD GetHTTPOneOne(PRBool& aOneOne);
|
||||
NS_IMETHOD SetHTTPOneOne(PRBool aSendOneOne);
|
||||
|
||||
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName);
|
||||
NS_IMETHOD GetAppVersion(nsString& aAppVersion);
|
||||
NS_IMETHOD GetAppName(nsString& aAppName);
|
||||
NS_IMETHOD GetLanguage(nsString& aLanguage);
|
||||
NS_IMETHOD GetPlatform(nsString& aPlatform);
|
||||
NS_IMETHOD SetCustomUserAgent(nsString aCustom);
|
||||
|
||||
protected:
|
||||
virtual ~nsNetlibService();
|
||||
|
||||
@ -72,7 +75,6 @@ private:
|
||||
void SetupURLStruct(nsIURL *aURL, URL_Struct *aURL_s);
|
||||
/* XXX: This is temporary until bamwrap.cpp is removed... */
|
||||
void *m_stubContext;
|
||||
nsINetContainerApplication *mContainer;
|
||||
nsIPref *mPref;
|
||||
|
||||
nsITimer* mPollingTimer;
|
||||
|
@ -66,8 +66,6 @@ static NS_DEFINE_IID(kBrowserWindowCID, NS_BROWSER_WINDOW_CID);
|
||||
|
||||
static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID);
|
||||
static NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID);
|
||||
static NS_DEFINE_IID(kINetContainerApplicationIID,
|
||||
NS_INETCONTAINERAPPLICATION_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
|
||||
@ -103,11 +101,6 @@ nsViewerApp::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kINetContainerApplicationIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIBrowserWindow*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsISupports*)((nsIBrowserWindow*)this));
|
||||
NS_ADDREF_THIS();
|
||||
@ -183,7 +176,7 @@ nsViewerApp::Initialize(int argc, char** argv)
|
||||
mPrefs->Startup("prefs.js");
|
||||
|
||||
// Setup networking library
|
||||
rv = NS_InitINetService((nsINetContainerApplication*) this);
|
||||
rv = NS_InitINetService();
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
@ -505,48 +498,6 @@ nsViewerApp::OpenWindow(PRUint32 aNewChromeMask, nsIBrowserWindow*& aNewWindow)
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
// nsINetContainerApplication implementation
|
||||
// XXX: These methods are called by the netlib thread...
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewerApp::GetAppCodeName(nsString& aAppCodeName)
|
||||
{
|
||||
aAppCodeName.SetString("Mozilla");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewerApp::GetAppVersion(nsString& aAppVersion)
|
||||
{
|
||||
//This seems kinda wrong in x-platform code
|
||||
aAppVersion.SetString("4.05 [en] (WinNT;I)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewerApp::GetAppName(nsString& aAppName)
|
||||
{
|
||||
aAppName.SetString("Netscape");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewerApp::GetLanguage(nsString& aLanguage)
|
||||
{
|
||||
aLanguage.SetString("en");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewerApp::GetPlatform(nsString& aPlatform)
|
||||
{
|
||||
//This seems kinda wrong in x-platform code
|
||||
aPlatform.SetString("Win32");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
// nsDispatchListener implementation
|
||||
|
||||
void
|
||||
|
@ -19,7 +19,6 @@
|
||||
#ifndef nsViewerApp_h___
|
||||
#define nsViewerApp_h___
|
||||
|
||||
#include "nsINetContainerApplication.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
@ -30,8 +29,7 @@ class nsWebCrawler;
|
||||
class nsBrowserWindow;
|
||||
class nsIBrowserWindow;
|
||||
|
||||
class nsViewerApp : public nsINetContainerApplication,
|
||||
public nsDispatchListener
|
||||
class nsViewerApp : public nsDispatchListener
|
||||
{
|
||||
public:
|
||||
void* operator new(size_t sz) {
|
||||
@ -45,13 +43,6 @@ public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsINetContainerApplication
|
||||
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName);
|
||||
NS_IMETHOD GetAppVersion(nsString& aAppVersion);
|
||||
NS_IMETHOD GetAppName(nsString& aAppName);
|
||||
NS_IMETHOD GetLanguage(nsString& aLanguage);
|
||||
NS_IMETHOD GetPlatform(nsString& aPlatform);
|
||||
|
||||
// nsDispatchListener
|
||||
virtual void AfterDispatch();
|
||||
|
||||
|
@ -66,8 +66,6 @@ static NS_DEFINE_IID(kBrowserWindowCID, NS_BROWSER_WINDOW_CID);
|
||||
|
||||
static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID);
|
||||
static NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID);
|
||||
static NS_DEFINE_IID(kINetContainerApplicationIID,
|
||||
NS_INETCONTAINERAPPLICATION_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
|
||||
@ -103,11 +101,6 @@ nsViewerApp::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kINetContainerApplicationIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIBrowserWindow*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsISupports*)((nsIBrowserWindow*)this));
|
||||
NS_ADDREF_THIS();
|
||||
@ -183,7 +176,7 @@ nsViewerApp::Initialize(int argc, char** argv)
|
||||
mPrefs->Startup("prefs.js");
|
||||
|
||||
// Setup networking library
|
||||
rv = NS_InitINetService((nsINetContainerApplication*) this);
|
||||
rv = NS_InitINetService();
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
@ -498,48 +491,6 @@ nsViewerApp::OpenWindow(PRUint32 aNewChromeMask, nsIBrowserWindow*& aNewWindow)
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
// nsINetContainerApplication implementation
|
||||
// XXX: These methods are called by the netlib thread...
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewerApp::GetAppCodeName(nsString& aAppCodeName)
|
||||
{
|
||||
aAppCodeName.SetString("Mozilla");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewerApp::GetAppVersion(nsString& aAppVersion)
|
||||
{
|
||||
//This seems kinda wrong in x-platform code
|
||||
aAppVersion.SetString("4.05 [en] (WinNT;I)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewerApp::GetAppName(nsString& aAppName)
|
||||
{
|
||||
aAppName.SetString("Netscape");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewerApp::GetLanguage(nsString& aLanguage)
|
||||
{
|
||||
aLanguage.SetString("en");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewerApp::GetPlatform(nsString& aPlatform)
|
||||
{
|
||||
//This seems kinda wrong in x-platform code
|
||||
aPlatform.SetString("Win32");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
// nsDispatchListener implementation
|
||||
|
||||
void
|
||||
|
@ -19,7 +19,6 @@
|
||||
#ifndef nsViewerApp_h___
|
||||
#define nsViewerApp_h___
|
||||
|
||||
#include "nsINetContainerApplication.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
@ -30,8 +29,7 @@ class nsIPref;
|
||||
class nsBrowserWindow;
|
||||
class nsIBrowserWindow;
|
||||
|
||||
class nsViewerApp : public nsINetContainerApplication,
|
||||
public nsDispatchListener
|
||||
class nsViewerApp : public nsDispatchListener
|
||||
{
|
||||
public:
|
||||
void* operator new(size_t sz) {
|
||||
@ -46,13 +44,6 @@ public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsINetContainerApplication
|
||||
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName);
|
||||
NS_IMETHOD GetAppVersion(nsString& aAppVersion);
|
||||
NS_IMETHOD GetAppName(nsString& aAppName);
|
||||
NS_IMETHOD GetLanguage(nsString& aLanguage);
|
||||
NS_IMETHOD GetPlatform(nsString& aPlatform);
|
||||
|
||||
// nsDispatchListener
|
||||
virtual void AfterDispatch();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user