зеркало из https://github.com/mozilla/pjs.git
bug 333263 only call Read() when mPermissionsFile is initialized
r=mvl sr=darin
This commit is contained in:
Родитель
f3e4b75683
Коммит
970728dfbc
|
@ -208,17 +208,17 @@ nsresult nsPermissionManager::Init()
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Cache the permissions file
|
||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mPermissionsFile));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = mPermissionsFile->AppendNative(NS_LITERAL_CSTRING(kPermissionsFileName));
|
||||
}
|
||||
|
||||
// Clear the array of type strings
|
||||
memset(mTypeArray, nsnull, sizeof(mTypeArray));
|
||||
|
||||
// Cache the permissions file
|
||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mPermissionsFile));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mPermissionsFile->AppendNative(NS_LITERAL_CSTRING(kPermissionsFileName));
|
||||
|
||||
// Ignore an error. That is not a problem. No cookperm.txt usually.
|
||||
Read();
|
||||
}
|
||||
|
||||
mObserverService = do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -502,10 +502,10 @@ NS_IMETHODIMP nsPermissionManager::Observe(nsISupports *aSubject, const char *aT
|
|||
// Re-get the permissions file
|
||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mPermissionsFile));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = mPermissionsFile->AppendNative(NS_LITERAL_CSTRING(kPermissionsFileName));
|
||||
}
|
||||
mPermissionsFile->AppendNative(NS_LITERAL_CSTRING(kPermissionsFileName));
|
||||
Read();
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -629,9 +629,6 @@ nsPermissionManager::Read()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = NS_NewLocalFileInputStream(getter_AddRefs(fileInputStream), oldPermissionsFile);
|
||||
// An error path is expected when cookperm.txt is not found
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
readingOldFile = PR_TRUE;
|
||||
|
||||
|
@ -642,6 +639,11 @@ nsPermissionManager::Read()
|
|||
* with a=0, b=1 etc
|
||||
*/
|
||||
}
|
||||
// An error path is expected when cookperm.txt is not found either, or when
|
||||
// creating the stream failed for another reason.
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
||||
nsCOMPtr<nsILineInputStream> lineInputStream = do_QueryInterface(fileInputStream, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
Загрузка…
Ссылка в новой задаче