Skip to content

Commit

Permalink
拦截捕获中的跳转请求
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinlic committed Nov 23, 2023
1 parent f872714 commit 13e32d4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,11 @@ export default class Page extends EventEmitter {
*/
#requestHandle(request) {
(async () => {
// 如果是捕获中产生的跳转请求则终止
if (this.isCapturing() && request.isNavigationRequest() && request.frame() === this.target.mainFrame()) {
request.abort("aborted");
return;
}
const method = request.method();
const url = request.url();
const { pathname } = new URL(url);
Expand Down

0 comments on commit 13e32d4

Please sign in to comment.