Skip to content

Commit 1a4dec8

Browse files
authored
chore: remove route handlers with times=0 (#652)
1 parent c802c87 commit 1a4dec8

File tree

1 file changed

+7
-0
lines changed
  • playwright/src/main/java/com/microsoft/playwright/impl

1 file changed

+7
-0
lines changed

playwright/src/main/java/com/microsoft/playwright/impl/Router.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ boolean handle(Route route) {
5050
handler.accept(route);
5151
return true;
5252
}
53+
54+
boolean isDone() {
55+
return times != null && times <= 0;
56+
}
5357
}
5458

5559
void add(UrlMatcher matcher, Consumer<Route> handler, Integer times) {
@@ -69,6 +73,9 @@ int size() {
6973
boolean handle(Route route) {
7074
for (RouteInfo info : routes) {
7175
if (info.handle(route)) {
76+
if (info.isDone()) {
77+
routes.remove(info);
78+
}
7279
return true;
7380
}
7481
}

0 commit comments

Comments
 (0)