зеркало из https://github.com/mozilla/pjs.git
Fix for bug 25321 "Crash at start w/o internet connection" on Mac. Added additional check for failure of GetService() on nsIOService. r=brade, a=jar.
This commit is contained in:
Родитель
aa9cb674b5
Коммит
6d1972b0be
|
@ -29,24 +29,24 @@
|
||||||
static NS_DEFINE_IID(kIPersistentPropertiesIID, NS_IPERSISTENTPROPERTIES_IID);
|
static NS_DEFINE_IID(kIPersistentPropertiesIID, NS_IPERSISTENTPROPERTIES_IID);
|
||||||
static NS_DEFINE_IID(kIOServiceCID, NS_IOSERVICE_CID);
|
static NS_DEFINE_IID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||||
|
|
||||||
nsIIOService* nsURLProperties::gIOService;
|
nsIIOService* nsURLProperties::gIOService = nsnull;
|
||||||
nsrefcnt nsURLProperties::gRefCnt = 0;
|
nsrefcnt nsURLProperties::gRefCnt = 0;
|
||||||
|
|
||||||
nsURLProperties::nsURLProperties(nsString& aUrl)
|
nsURLProperties::nsURLProperties(nsString& aUrl)
|
||||||
{
|
{
|
||||||
if (gRefCnt++ == 0) {
|
|
||||||
nsresult rv;
|
|
||||||
rv = nsServiceManager::GetService(kIOServiceCID,
|
|
||||||
NS_GET_IID(nsIIOService),
|
|
||||||
(nsISupports**)&gIOService);
|
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "can't get nsIOService");
|
|
||||||
}
|
|
||||||
|
|
||||||
mDelegate = nsnull;
|
mDelegate = nsnull;
|
||||||
nsresult res = NS_OK;
|
nsresult res = NS_OK;
|
||||||
nsIURI* url = nsnull;
|
nsIURI* url = nsnull;
|
||||||
nsIInputStream* in = nsnull;
|
nsIInputStream* in = nsnull;
|
||||||
|
|
||||||
|
if (gRefCnt == 0) {
|
||||||
|
res = nsServiceManager::GetService(kIOServiceCID,
|
||||||
|
NS_GET_IID(nsIIOService),
|
||||||
|
(nsISupports**)&gIOService);
|
||||||
|
if (NS_FAILED(res)) return;
|
||||||
|
gRefCnt++;
|
||||||
|
}
|
||||||
|
|
||||||
nsCAutoString aUrlCString(aUrl);
|
nsCAutoString aUrlCString(aUrl);
|
||||||
res = gIOService->NewURI(aUrlCString.GetBuffer(), nsnull, &url);
|
res = gIOService->NewURI(aUrlCString.GetBuffer(), nsnull, &url);
|
||||||
if (NS_FAILED(res)) return;
|
if (NS_FAILED(res)) return;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче