Commit cf5b906 1 parent 6fe39a3 commit cf5b906 Copy full SHA for cf5b906
File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -53,16 +53,15 @@ export function ensureRequestUntouched (resp): void {
53
53
}
54
54
55
55
/**
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
57
58
*
58
59
* @param modifyRequest - Request Modifier
59
60
* @param request - Request to be modified
60
61
*/
61
62
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 ) )
68
67
}
You can’t perform that action at this time.
0 commit comments