Skip to content

Commit e56bb6a

Browse files
committed
fix(test): sequential expectNoRedirect
1 parent 6fe39a3 commit e56bb6a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

test/helpers/mv3-test-helper.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,15 @@ export function ensureRequestUntouched (resp): void {
5353
}
5454

5555
/**
56-
* Ensure that the request is not redirected
56+
* Execute webRequest stages in order and ensure that the request
57+
* is not redirected by any of them
5758
*
5859
* @param modifyRequest - Request Modifier
5960
* @param request - Request to be modified
6061
*/
6162
export async function ensureNoRedirect (modifyRequest, request): Promise<void> {
62-
await Promise.all([
63-
modifyRequest.onBeforeRequest(request),
64-
modifyRequest.onHeadersReceived(request)
65-
].map(async (resp) => {
66-
await ensureRequestUntouched(await resp)
67-
}))
63+
// check webRequest stages sequentially in the same order a browser would
64+
// (each stage may modify state and must be inspected idependently, in order)
65+
await ensureRequestUntouched(await modifyRequest.onBeforeRequest(request))
66+
await ensureRequestUntouched(await modifyRequest.onHeadersReceived(request))
6867
}

0 commit comments

Comments
 (0)