зеркало из https://github.com/mozilla/pjs.git
backing out fix for bug 47437 due to memory leak
This commit is contained in:
Родитель
aef383e044
Коммит
1b92bfbfe2
|
@ -51,8 +51,6 @@
|
|||
#include "nsIPref.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsNetCID.h"
|
||||
|
||||
#define MAX_NUMBER_OF_COOKIES 300
|
||||
#define MAX_COOKIES_PER_SERVER 20
|
||||
|
@ -134,7 +132,6 @@ PRIVATE char* cookie_P3P = nsnull;
|
|||
#define cookie_P3P_Default "drdraaaa"
|
||||
|
||||
PRIVATE nsVoidArray * cookie_list=0;
|
||||
PRIVATE nsCOMPtr<nsIIOService> IOService = nsnull;
|
||||
|
||||
static
|
||||
time_t
|
||||
|
@ -180,7 +177,6 @@ COOKIE_RemoveAll()
|
|||
delete cookie_list;
|
||||
cookie_list = nsnull;
|
||||
Recycle(cookie_P3P);
|
||||
IOService = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -610,17 +606,8 @@ COOKIE_GetCookie(char * address) {
|
|||
if (cookie_list == nsnull) {
|
||||
return nsnull;
|
||||
}
|
||||
char *host = nsnull;
|
||||
char *path = nsnull;
|
||||
PRUint32 start, end;
|
||||
// Get host and path
|
||||
nsresult result;
|
||||
NS_ASSERTION(IOService, "IOService not available");
|
||||
result = IOService->ExtractUrlPart(address, nsIIOService::url_Host |
|
||||
nsIIOService::url_Port, &start, &end,
|
||||
&host);
|
||||
result = IOService->ExtractUrlPart(address, nsIIOService::url_Path,
|
||||
&start, &end, &path);
|
||||
char *host = CKutil_ParseURL(address, GET_HOST_PART);
|
||||
char *path = CKutil_ParseURL(address, GET_PATH_PART);
|
||||
for (PRInt32 i = 0; i <cookie_list->Count(); i++) {
|
||||
cookie_s = NS_STATIC_CAST(cookie_CookieStruct*, cookie_list->ElementAt(i));
|
||||
NS_ASSERTION(cookie_s, "corrupt cookie list");
|
||||
|
@ -743,18 +730,8 @@ cookie_isForeign (char * curURL, char * firstURL) {
|
|||
if (!firstURL) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
char *curHost = nsnull;
|
||||
char *firstHost = nsnull;
|
||||
PRUint32 start,end;
|
||||
nsresult rv;
|
||||
NS_ASSERTION(IOService, "IOService not available");
|
||||
// Get hosts
|
||||
rv = IOService->ExtractUrlPart(curURL, nsIIOService::url_Host |
|
||||
nsIIOService::url_Port, &start, &end,
|
||||
&curHost);
|
||||
rv = IOService->ExtractUrlPart(firstURL, nsIIOService::url_Host |
|
||||
nsIIOService::url_Port, &start, &end,
|
||||
&firstHost);
|
||||
char * curHost = CKutil_ParseURL(curURL, GET_HOST_PART);
|
||||
char * firstHost = CKutil_ParseURL(firstURL, GET_HOST_PART);
|
||||
char * curHostColon = 0;
|
||||
char * firstHostColon = 0;
|
||||
|
||||
|
@ -898,17 +875,8 @@ cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCook
|
|||
cookie_CookieStruct * prev_cookie;
|
||||
char *path_from_header=nsnull, *host_from_header=nsnull;
|
||||
char *name_from_header=nsnull, *cookie_from_header=nsnull;
|
||||
char *cur_host = nsnull;
|
||||
char *cur_path = nsnull;
|
||||
PRUint32 start,end;
|
||||
nsresult rv;
|
||||
NS_ASSERTION(IOService, "IOService not available");
|
||||
// Get host and path
|
||||
rv = IOService->ExtractUrlPart(curURL, nsIIOService::url_Host |
|
||||
nsIIOService::url_Port, &start, &end,
|
||||
&cur_host);
|
||||
rv = IOService->ExtractUrlPart(curURL, nsIIOService::url_Path,
|
||||
&start, &end, &cur_path);
|
||||
char *cur_path = CKutil_ParseURL(curURL, GET_PATH_PART);
|
||||
char *cur_host = CKutil_ParseURL(curURL, GET_HOST_PART);
|
||||
char *semi_colon, *ptr, *equal;
|
||||
char *setCookieHeaderInternal = (char *) setCookieHeader;
|
||||
PRBool isSecure=PR_FALSE, isDomain=PR_FALSE;
|
||||
|
@ -1433,15 +1401,12 @@ COOKIE_Read() {
|
|||
if (cookie_list) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult rv = NS_OK;
|
||||
IOService = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
cookie_CookieStruct *new_cookie, *tmp_cookie_ptr;
|
||||
size_t new_len;
|
||||
nsAutoString buffer;
|
||||
PRBool added_to_list;
|
||||
nsFileSpec dirSpec;
|
||||
rv = CKutil_ProfileDirectory(dirSpec);
|
||||
nsresult rv = CKutil_ProfileDirectory(dirSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "nsIPref.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIIOService.h"
|
||||
|
||||
#define image_behaviorPref "network.image.imageBehavior"
|
||||
#define image_warningPref "network.image.warnAboutImages"
|
||||
|
@ -198,17 +197,11 @@ IMAGE_CheckForPermission
|
|||
}
|
||||
|
||||
PUBLIC nsresult
|
||||
IMAGE_Block(const char* imageURL,
|
||||
nsIIOService* ioService) {
|
||||
IMAGE_Block(const char* imageURL) {
|
||||
if (!imageURL || !(*imageURL)) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsresult rv = NS_OK;
|
||||
char *host = nsnull;
|
||||
PRUint32 start,end;
|
||||
NS_ASSERTION(ioService, "IOService not available");
|
||||
rv = ioService->ExtractUrlPart(imageURL, nsIIOService::url_Host |
|
||||
nsIIOService::url_Port, &start, &end, &host);
|
||||
char *host = CKutil_ParseURL(imageURL, GET_HOST_PART);
|
||||
Permission_AddHost(host, PR_FALSE, IMAGEPERMISSION, PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
extern nsresult IMAGE_CheckForPermission
|
||||
(const char * hostname, const char * firstHostname, PRBool *permission);
|
||||
extern nsresult IMAGE_Block(const char * imageURL, nsIIOService *ioService);
|
||||
extern nsresult IMAGE_Block(const char * imageURL);
|
||||
extern void IMAGE_RegisterPrefCallbacks(void);
|
||||
|
||||
#endif /* IMAGES_H */
|
||||
|
|
|
@ -43,10 +43,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -70,17 +66,13 @@ nsImgManager::~nsImgManager(void)
|
|||
nsresult nsImgManager::Init()
|
||||
{
|
||||
IMAGE_RegisterPrefCallbacks();
|
||||
nsresult rv;
|
||||
rv = nsServiceManager::GetService(kIOServiceCID,
|
||||
NS_GET_IID(nsIIOService),
|
||||
getter_AddRefs(mIOService));
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsImgManager::Block(const char * imageURL)
|
||||
{
|
||||
::IMAGE_Block(imageURL,mIOService);
|
||||
::IMAGE_Block(imageURL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
|
||||
#include "nsIImgManager.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIIOService.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -59,11 +57,7 @@ public:
|
|||
nsImgManager();
|
||||
virtual ~nsImgManager(void);
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
// cached IOService
|
||||
nsCOMPtr<nsIIOService> mIOService;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsImgManager_h__ */
|
||||
|
|
|
@ -47,9 +47,6 @@
|
|||
#include "nsIPrompt.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsPermission.h"
|
||||
#include "nsNetCID.h"
|
||||
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -129,15 +126,13 @@ nsresult nsPermissionManager::Init()
|
|||
observerService->AddObserver(this, NS_LITERAL_STRING("profile-before-change").get());
|
||||
observerService->AddObserver(this, NS_LITERAL_STRING("profile-do-change").get());
|
||||
}
|
||||
rv = nsServiceManager::GetService(kIOServiceCID,
|
||||
NS_GET_IID(nsIIOService),
|
||||
getter_AddRefs(mIOService));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPermissionManager::Add
|
||||
(const char * objectURL, PRBool permission, PRInt32 type) {
|
||||
::PERMISSION_Add(objectURL, permission, type, mIOService);
|
||||
::PERMISSION_Add(objectURL, permission, type);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,6 @@
|
|||
#include "nsIPermissionManager.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIIOService.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -60,10 +58,6 @@ public:
|
|||
nsPermissionManager();
|
||||
virtual ~nsPermissionManager(void);
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
// cached IOService
|
||||
nsCOMPtr<nsIIOService> mIOService;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -51,8 +51,6 @@
|
|||
#include "xp_core.h"
|
||||
#include "prmem.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsNetCID.h"
|
||||
|
||||
static const char *kCookiesPermFileName = "cookperm.txt";
|
||||
|
||||
|
@ -686,17 +684,11 @@ PERMISSION_DeletePersistentUserData(void)
|
|||
}
|
||||
|
||||
PUBLIC void
|
||||
PERMISSION_Add(const char * objectURL, PRBool permission, PRInt32 type,
|
||||
nsIIOService* ioService) {
|
||||
PERMISSION_Add(const char * objectURL, PRBool permission, PRInt32 type) {
|
||||
if (!objectURL) {
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_OK;
|
||||
char *host = nsnull;
|
||||
PRUint32 start,end;
|
||||
NS_ASSERTION(ioService, "IOService not available");
|
||||
rv = ioService->ExtractUrlPart(objectURL, nsIIOService::url_Host |
|
||||
nsIIOService::url_Port, &start, &end, &host);
|
||||
char *host = CKutil_ParseURL(objectURL, GET_HOST_PART);
|
||||
|
||||
/*
|
||||
* if permission is false, it will be added to the permission list
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#define PERMISSIONS_H
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIIOService.h"
|
||||
|
||||
#define COOKIEPERMISSION 0
|
||||
#define IMAGEPERMISSION 1
|
||||
|
@ -56,7 +55,7 @@ typedef enum {
|
|||
class nsIPrompt;
|
||||
|
||||
extern nsresult PERMISSION_Read();
|
||||
extern void PERMISSION_Add(const char * objectURL, PRBool permission, PRInt32 type, nsIIOService* ioService);
|
||||
extern void PERMISSION_Add(const char * objectURL, PRBool permission, PRInt32 type);
|
||||
extern void PERMISSION_RemoveAll();
|
||||
extern void PERMISSION_DeletePersistentUserData(void);
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
#define MAX_HOST_NAME_LEN 64
|
||||
#define BUFSIZE 128
|
||||
#define LOCALIZATION "chrome://communicator/locale/wallet/cookie.properties"
|
||||
|
||||
|
@ -99,6 +100,184 @@ CKutil_GetLine(nsInputFileStream& strm, nsString& aLine) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
PUBLIC char *
|
||||
CKutil_ParseURL (const char *url, int parts_requested) {
|
||||
char *rv=0,*colon, *slash, *ques_mark, *hash_mark;
|
||||
char *atSign, *host, *passwordColon, *gtThan;
|
||||
assert(url);
|
||||
if(!url) {
|
||||
return(CKutil_StrAllocCat(rv, ""));
|
||||
}
|
||||
colon = PL_strchr(url, ':'); /* returns a const char */
|
||||
/* Get the protocol part, not including anything beyond the colon */
|
||||
if (parts_requested & GET_PROTOCOL_PART) {
|
||||
if(colon) {
|
||||
char val = *(colon+1);
|
||||
*(colon+1) = '\0';
|
||||
CKutil_StrAllocCopy(rv, url);
|
||||
*(colon+1) = val;
|
||||
/* If the user wants more url info, tack on extra slashes. */
|
||||
if( (parts_requested & GET_HOST_PART)
|
||||
|| (parts_requested & GET_USERNAME_PART)
|
||||
|| (parts_requested & GET_PASSWORD_PART)) {
|
||||
if( *(colon+1) == '/' && *(colon+2) == '/') {
|
||||
CKutil_StrAllocCat(rv, "//");
|
||||
}
|
||||
/* If there's a third slash consider it file:/// and tack on the last slash. */
|
||||
if( *(colon+3) == '/' ) {
|
||||
CKutil_StrAllocCat(rv, "/");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the username if one exists */
|
||||
if (parts_requested & GET_USERNAME_PART) {
|
||||
if (colon && (*(colon+1) == '/') && (*(colon+2) == '/') && (*(colon+3) != '\0')) {
|
||||
if ( (slash = PL_strchr(colon+3, '/')) != NULL) {
|
||||
*slash = '\0';
|
||||
}
|
||||
if ( (atSign = PL_strchr(colon+3, '@')) != NULL) {
|
||||
*atSign = '\0';
|
||||
if ( (passwordColon = PL_strchr(colon+3, ':')) != NULL) {
|
||||
*passwordColon = '\0';
|
||||
}
|
||||
CKutil_StrAllocCat(rv, colon+3);
|
||||
|
||||
/* Get the password if one exists */
|
||||
if (parts_requested & GET_PASSWORD_PART) {
|
||||
if (passwordColon) {
|
||||
CKutil_StrAllocCat(rv, ":");
|
||||
CKutil_StrAllocCat(rv, passwordColon+1);
|
||||
}
|
||||
}
|
||||
if (parts_requested & GET_HOST_PART) {
|
||||
CKutil_StrAllocCat(rv, "@");
|
||||
}
|
||||
if (passwordColon) {
|
||||
*passwordColon = ':';
|
||||
}
|
||||
*atSign = '@';
|
||||
}
|
||||
if (slash) {
|
||||
*slash = '/';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the host part */
|
||||
if (parts_requested & GET_HOST_PART) {
|
||||
if(colon) {
|
||||
if(*(colon+1) == '/' && *(colon+2) == '/') {
|
||||
slash = PL_strchr(colon+3, '/');
|
||||
if(slash) {
|
||||
*slash = '\0';
|
||||
}
|
||||
if( (atSign = PL_strchr(colon+3, '@')) != NULL) {
|
||||
host = atSign+1;
|
||||
} else {
|
||||
host = colon+3;
|
||||
}
|
||||
ques_mark = PL_strchr(host, '?');
|
||||
if(ques_mark) {
|
||||
*ques_mark = '\0';
|
||||
}
|
||||
gtThan = PL_strchr(host, '>');
|
||||
if (gtThan) {
|
||||
*gtThan = '\0';
|
||||
}
|
||||
|
||||
/* limit hostnames to within MAX_HOST_NAME_LEN characters to keep from crashing */
|
||||
if(PL_strlen(host) > MAX_HOST_NAME_LEN) {
|
||||
char * cp;
|
||||
char old_char;
|
||||
cp = host+MAX_HOST_NAME_LEN;
|
||||
old_char = *cp;
|
||||
*cp = '\0';
|
||||
CKutil_StrAllocCat(rv, host);
|
||||
*cp = old_char;
|
||||
} else {
|
||||
CKutil_StrAllocCat(rv, host);
|
||||
}
|
||||
if(slash) {
|
||||
*slash = '/';
|
||||
}
|
||||
if(ques_mark) {
|
||||
*ques_mark = '?';
|
||||
}
|
||||
if (gtThan) {
|
||||
*gtThan = '>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the path part */
|
||||
if (parts_requested & GET_PATH_PART) {
|
||||
if(colon) {
|
||||
if(*(colon+1) == '/' && *(colon+2) == '/') {
|
||||
/* skip host part */
|
||||
slash = PL_strchr(colon+3, '/');
|
||||
} else {
|
||||
/* path is right after the colon */
|
||||
slash = colon+1;
|
||||
}
|
||||
if(slash) {
|
||||
ques_mark = PL_strchr(slash, '?');
|
||||
hash_mark = PL_strchr(slash, '#');
|
||||
if(ques_mark) {
|
||||
*ques_mark = '\0';
|
||||
}
|
||||
if(hash_mark) {
|
||||
*hash_mark = '\0';
|
||||
}
|
||||
CKutil_StrAllocCat(rv, slash);
|
||||
if(ques_mark) {
|
||||
*ques_mark = '?';
|
||||
}
|
||||
if(hash_mark) {
|
||||
*hash_mark = '#';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(parts_requested & GET_HASH_PART) {
|
||||
hash_mark = PL_strchr(url, '#'); /* returns a const char * */
|
||||
if(hash_mark) {
|
||||
ques_mark = PL_strchr(hash_mark, '?');
|
||||
if(ques_mark) {
|
||||
*ques_mark = '\0';
|
||||
}
|
||||
CKutil_StrAllocCat(rv, hash_mark);
|
||||
if(ques_mark) {
|
||||
*ques_mark = '?';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(parts_requested & GET_SEARCH_PART) {
|
||||
ques_mark = PL_strchr(url, '?'); /* returns a const char * */
|
||||
if(ques_mark) {
|
||||
hash_mark = PL_strchr(ques_mark, '#');
|
||||
if(hash_mark) {
|
||||
*hash_mark = '\0';
|
||||
}
|
||||
CKutil_StrAllocCat(rv, ques_mark);
|
||||
if(hash_mark) {
|
||||
*hash_mark = '#';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* copy in a null string if nothing was copied in */
|
||||
if(!rv) {
|
||||
CKutil_StrAllocCopy(rv, "");
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRUnichar *
|
||||
CKutil_Localize(const PRUnichar *genericString) {
|
||||
nsresult ret;
|
||||
|
|
|
@ -42,7 +42,17 @@
|
|||
#include "nsString.h"
|
||||
#include "nsFileStream.h"
|
||||
|
||||
//#define GET_ALL_PARTS 127
|
||||
#define GET_PASSWORD_PART 64
|
||||
#define GET_USERNAME_PART 32
|
||||
#define GET_PROTOCOL_PART 16
|
||||
#define GET_HOST_PART 8
|
||||
#define GET_PATH_PART 4
|
||||
#define GET_HASH_PART 2
|
||||
#define GET_SEARCH_PART 1
|
||||
|
||||
extern PRInt32 CKutil_GetLine(nsInputFileStream& strm, nsString& aLine);
|
||||
extern char * CKutil_ParseURL (const char *url, int parts_requested);
|
||||
extern PRUnichar* CKutil_Localize(const PRUnichar *genericString);
|
||||
extern nsresult CKutil_ProfileDirectory(nsFileSpec& dirSpec);
|
||||
extern char * CKutil_StrAllocCopy(char *&destination, const char *source);
|
||||
|
|
|
@ -183,7 +183,6 @@ interface nsIIOService : nsISupports
|
|||
const short url_Query = (1<<8);
|
||||
const short url_Ref = (1<<9);
|
||||
const short url_Path = (1<<10);
|
||||
const short url_Port = (1<<11);
|
||||
|
||||
/**
|
||||
* Get port from string.
|
||||
|
|
|
@ -539,9 +539,8 @@ nsIOService::ExtractUrlPart(const char *urlString, PRInt16 flag, PRUint32 *start
|
|||
rv = GetParserForScheme(scheme, getter_AddRefs(parser));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRInt32 port = -1;
|
||||
PRInt32 port;
|
||||
nsXPIDLCString dummyScheme, username, password, host, path;
|
||||
char* portstr = nsnull;
|
||||
|
||||
rv = parser->ParseAtScheme(urlString,
|
||||
getter_Copies(dummyScheme),
|
||||
|
@ -574,33 +573,6 @@ nsIOService::ExtractUrlPart(const char *urlString, PRInt16 flag, PRUint32 *start
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (flag == url_Port) {
|
||||
if (port != -1) {
|
||||
portstr = PR_smprintf("%d", port);
|
||||
CalculateStartEndPos(urlString, portstr, startPos, endPos);
|
||||
} else {
|
||||
startPos = 0;
|
||||
endPos = 0;
|
||||
}
|
||||
if (urlPart)
|
||||
*urlPart = nsCRT::strdup(portstr);
|
||||
PR_smprintf_free(portstr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (flag == (url_Host | url_Port)) {
|
||||
nsCAutoString hostport(host);
|
||||
if (port != -1) {
|
||||
portstr = PR_smprintf(":%d", port);
|
||||
hostport += portstr;
|
||||
}
|
||||
if (urlPart)
|
||||
*urlPart = ToNewCString(hostport);
|
||||
CalculateStartEndPos(urlString, *urlPart, startPos, endPos);
|
||||
PR_smprintf_free(portstr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (flag == url_Path) {
|
||||
CalculateStartEndPos(urlString, path, startPos, endPos);
|
||||
if (urlPart)
|
||||
|
@ -608,6 +580,7 @@ nsIOService::ExtractUrlPart(const char *urlString, PRInt16 flag, PRUint32 *start
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsXPIDLCString directory, fileBaseName, fileExtension, param, query, ref;
|
||||
|
||||
rv = parser->ParseAtDirectory(path,
|
||||
|
@ -620,6 +593,7 @@ nsIOService::ExtractUrlPart(const char *urlString, PRInt16 flag, PRUint32 *start
|
|||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
if (flag == url_Directory) {
|
||||
CalculateStartEndPos(urlString, directory, startPos, endPos);
|
||||
if (urlPart)
|
||||
|
@ -662,6 +636,7 @@ nsIOService::ExtractUrlPart(const char *urlString, PRInt16 flag, PRUint32 *start
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -876,7 +851,8 @@ nsIOService::AllowPort(PRInt32 inPort, const char *scheme, PRBool *_retval)
|
|||
NS_IMETHODIMP
|
||||
nsIOService::ExtractPort(const char *str, PRInt32 *result)
|
||||
{
|
||||
*result = ExtractPortFrom(str);
|
||||
PRInt32 returnValue = -1;
|
||||
*result = (0 < PR_sscanf(str, "%d", &returnValue)) ? returnValue : -1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче