Skip to content

Commit 059667e

Browse files
authored
chore: remove background pages implementation (#1861)
1 parent 98296d9 commit 059667e

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
4646
private final APIRequestContextImpl request;
4747
private final ClockImpl clock;
4848
final List<PageImpl> pages = new ArrayList<>();
49-
final List<PageImpl> backgroundPages = new ArrayList<>();
5049

5150
final Router routes = new Router();
5251
final WebSocketRouter webSocketRoutes = new WebSocketRouter();
@@ -81,7 +80,6 @@ static class HarRecorder {
8180
}
8281

8382
enum EventType {
84-
BACKGROUNDPAGE,
8583
CLOSE,
8684
CONSOLE,
8785
DIALOG,
@@ -133,12 +131,10 @@ String effectiveCloseReason() {
133131

134132
@Override
135133
public void onBackgroundPage(Consumer<Page> handler) {
136-
listeners.add(EventType.BACKGROUNDPAGE, handler);
137134
}
138135

139136
@Override
140137
public void offBackgroundPage(Consumer<Page> handler) {
141-
listeners.remove(EventType.BACKGROUNDPAGE, handler);
142138
}
143139

144140
@Override
@@ -340,7 +336,7 @@ public void addInitScript(Path path) {
340336

341337
@Override
342338
public List<Page> backgroundPages() {
343-
return new ArrayList<>(backgroundPages);
339+
return Collections.emptyList();
344340
}
345341

346342
@Override
@@ -719,10 +715,6 @@ protected void handleEvent(String event, JsonObject params) {
719715
if (page.opener() != null && !page.opener().isClosed()) {
720716
page.opener().notifyPopup(page);
721717
}
722-
} else if ("backgroundPage".equals(event)) {
723-
PageImpl page = connection.getExistingObject(params.getAsJsonObject("page").get("guid").getAsString());
724-
backgroundPages.add(page);
725-
listeners.notify(EventType.BACKGROUNDPAGE, page);
726718
} else if ("bindingCall".equals(event)) {
727719
BindingCall bindingCall = connection.getExistingObject(params.getAsJsonObject("binding").get("guid").getAsString());
728720
BindingCallback binding = bindings.get(bindingCall.name());

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ void notifyPopup(PageImpl popup) {
237237
void didClose() {
238238
isClosed = true;
239239
browserContext.pages.remove(this);
240-
browserContext.backgroundPages.remove(this);
241240
listeners.notify(EventType.CLOSE, this);
242241
}
243242

0 commit comments

Comments
 (0)