зеркало из https://github.com/mozilla/gecko-dev.git
bug 74489, fix semantics of enumerate, r=valeski, sr=alecf
This commit is contained in:
Родитель
66345ca194
Коммит
2392e5b0c4
|
@ -56,8 +56,9 @@ class nsPermissionEnumerator : public nsISimpleEnumerator
|
|||
char *host;
|
||||
PRBool capability;
|
||||
PRInt32 type;
|
||||
(void) PERMISSION_Enumerate
|
||||
nsresult rv = PERMISSION_Enumerate
|
||||
(mHostCount, mTypeCount++, &host, &type, &capability);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (mTypeCount == PERMISSION_TypeCount(mHostCount)) {
|
||||
mTypeCount = 0;
|
||||
mHostCount++;
|
||||
|
@ -66,7 +67,10 @@ class nsPermissionEnumerator : public nsISimpleEnumerator
|
|||
new nsPermission(host, type, capability);
|
||||
*result = permission;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
} else {
|
||||
*result = nsnull;
|
||||
}
|
||||
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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче