Skip to content
Snippets Groups Projects
Commit e6e58c96 authored by Nicolas Chevobbe's avatar Nicolas Chevobbe
Browse files

Bug 1790105 - Fix test_permmanager_getAllByTypes.js intermittent failures. r=pbz.

It seems that getAllByTypes results aren't in a stable order when
the test is run with --verify.

Differential Revision: https://phabricator.services.mozilla.com/D157120
parent c3f891b5
No related branches found
No related tags found
No related merge requests found
......@@ -12,20 +12,21 @@ function check_enumerator(permissionTypes, expectedPermissions) {
)}`
);
permissions.forEach((perm, i) => {
info(`Checking permission #${i}`);
const [
expectedPrincipal,
expectedType,
expectedCapability,
] = expectedPermissions[i];
for (const perm of permissions) {
Assert.ok(perm != null);
Assert.ok(perm.principal.equals(expectedPrincipal));
Assert.equal(perm.type, expectedType);
Assert.equal(perm.capability, expectedCapability);
// For some reason, the order in which we get the permissions doesn't seem to be
// stable when running the test with --verify. As a result, we need to retrieve the
// expected permission for the origin and type.
const expectedPermission = expectedPermissions.find(
([expectedPrincipal, expectedType]) =>
perm.principal.equals(expectedPrincipal) && perm.type === expectedType
);
Assert.ok(expectedPermission !== null, "Found the expected permission");
Assert.equal(perm.capability, expectedPermission[2]);
Assert.equal(perm.expireType, Services.perms.EXPIRE_NEVER);
});
}
}
function run_test() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment