зеркало из https://github.com/mozilla/pjs.git
bug 74489, fix semantics of enumerate, r=valeski, sr=alecf
This commit is contained in:
Родитель
44c3b7eeed
Коммит
49ef48d25d
|
@ -56,17 +56,21 @@ class nsPermissionEnumerator : public nsISimpleEnumerator
|
|||
char *host;
|
||||
PRBool capability;
|
||||
PRInt32 type;
|
||||
(void) PERMISSION_Enumerate
|
||||
nsresult rv = PERMISSION_Enumerate
|
||||
(mHostCount, mTypeCount++, &host, &type, &capability);
|
||||
if (mTypeCount == PERMISSION_TypeCount(mHostCount)) {
|
||||
mTypeCount = 0;
|
||||
mHostCount++;
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (mTypeCount == PERMISSION_TypeCount(mHostCount)) {
|
||||
mTypeCount = 0;
|
||||
mHostCount++;
|
||||
}
|
||||
nsIPermission *permission =
|
||||
new nsPermission(host, type, capability);
|
||||
*result = permission;
|
||||
NS_ADDREF(*result);
|
||||
} else {
|
||||
*result = nsnull;
|
||||
}
|
||||
nsIPermission *permission =
|
||||
new nsPermission(host, type, capability);
|
||||
*result = permission;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
virtual ~nsPermissionEnumerator()
|
||||
|
|
|
@ -555,9 +555,12 @@ PERMISSION_TypeCount(PRInt32 host) {
|
|||
return hostStruct->permissionList->Count();
|
||||
}
|
||||
|
||||
PUBLIC void
|
||||
PUBLIC nsresult
|
||||
PERMISSION_Enumerate
|
||||
(PRInt32 hostNumber, PRInt32 typeNumber, char **host, PRInt32 *type, PRBool *capability) {
|
||||
if (hostNumber > PERMISSION_HostCount() || typeNumber > PERMISSION_TypeCount(hostNumber)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
permission_HostStruct *hostStruct;
|
||||
permission_TypeStruct * typeStruct;
|
||||
|
||||
|
@ -571,6 +574,7 @@ PERMISSION_Enumerate
|
|||
(permission_TypeStruct*, hostStruct->permissionList->ElementAt(typeNumber));
|
||||
*capability = typeStruct->permission;
|
||||
*type = typeStruct->type;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRIVATE void
|
||||
|
|
|
@ -44,7 +44,7 @@ extern void PERMISSION_DeletePersistentUserData(void);
|
|||
|
||||
extern PRInt32 PERMISSION_HostCount();
|
||||
extern PRInt32 PERMISSION_TypeCount(PRInt32 host);
|
||||
extern void PERMISSION_Enumerate
|
||||
extern nsresult PERMISSION_Enumerate
|
||||
(PRInt32 hostNumber, PRInt32 typeNumber, char **host, PRInt32 *type, PRBool *capability);
|
||||
extern void PERMISSION_Remove(const char* host, PRInt32 type);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче