Repository navigation
Closed
Description
Version
1.63.0 (Java, bundled driver)
Steps to reproduce
- Serve a page with
<iframe src="/hang">, where/hangnever answers. - Navigate with
waitUntil: DOMCONTENTLOADED: the child frame exists,frame.url()is""(no document committed). - Call
childFrame.content(). - From another thread, close the tab through the browser's DevTools endpoint (
/json/close/<targetId>): the browser answersTarget is closing,page.isClosed()becomestrue.
Self-contained repro (JDK HttpServer + Playwright Java):
import com.microsoft.playwright.*;
import com.microsoft.playwright.options.WaitUntilState;
import com.sun.net.httpserver.HttpServer;
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.concurrent.*;
public class Repro {
public static void main(String[] args) throws Exception {
long t0 = System.currentTimeMillis();
HttpServer server = HttpServer.create(new InetSocketAddress("127.0.0.1", 0), 0);
server.setExecutor(Executors.newCachedThreadPool());
server.createContext("/page", ex -> {
byte[] b = "<html><body><iframe src='/hang'></iframe></body></html>".getBytes();
ex.sendResponseHeaders(200, b.length); ex.getResponseBody().write(b); ex.close();
});
server.createContext("/hang", ex -> { try { Thread.sleep(600_000); } catch (InterruptedException e) { } });
server.start();
int cdpPort = 9333;
try (Playwright pw = Playwright.create()) {
Browser browser = pw.chromium().launch(new BrowserType.LaunchOptions()
.setArgs(List.of("--remote-debugging-port=" + cdpPort)));
Page page = browser.newPage();
page.navigate("http://127.0.0.1:" + server.getAddress().getPort() + "/page",
new Page.NavigateOptions().setWaitUntil(WaitUntilState.DOMCONTENTLOADED));
Frame child = page.frames().get(1);
System.out.println("child frame url='" + child.url() + "'");
// Close the tab from another thread, through the browser's own DevTools endpoint.
HttpClient http = HttpClient.newHttpClient();
String targets = http.send(HttpRequest.newBuilder(URI.create("http://127.0.0.1:" + cdpPort + "/json/list")).build(),
HttpResponse.BodyHandlers.ofString()).body();
String targetId = targets.replaceAll("(?s).*\"id\": \"([0-9A-F]+)\",\\s*\"title\": \"[^\"]*\",\\s*\"type\": \"page\".*", "$1");
ScheduledExecutorService closer = Executors.newSingleThreadScheduledExecutor();
closer.schedule(() -> {
try {
String r = http.send(HttpRequest.newBuilder(URI.create("http://127.0.0.1:" + cdpPort + "/json/close/" + targetId)).build(),
HttpResponse.BodyHandlers.ofString()).body();
System.out.println((System.currentTimeMillis() - t0) + " ms: tab closed -> " + r);
} catch (Exception e) { System.out.println("close failed " + e); }
}, 5, TimeUnit.SECONDS);
closer.schedule(() -> {
System.out.println((System.currentTimeMillis() - t0) + " ms: content() still pending, page.isClosed()=" + page.isClosed());
System.exit(1);
}, 65, TimeUnit.SECONDS);
System.out.println((System.currentTimeMillis() - t0) + " ms: calling child.content()");
String html = child.content(); // never returns
System.out.println("content() returned " + html.length() + " chars");
System.exit(0);
}
}
}Output:
child frame url=''
1780 ms: calling child.content()
6798 ms: tab closed -> Target is closing
66787 ms: content() still pending, page.isClosed()=true
Expected behavior
content() returns the frame's initial empty document, or fails once its page is closed ("Target page, context or browser has been closed").
Actual behavior
content() never returns — still pending 60 s after the tab was closed. The Frame.content call carries no timeout, and closing the page does not reject it, so nothing bounds it.
Additional context
- Same result when the iframe is created by a script after
load, and whencontent()is called 32 s after the frame was created. - The same hang is seen for an uncommitted frame nested in a cross-origin iframe.
Environment
- OS: macOS 27 (arm64)
- Browser: Chromium headless shell bundled with Playwright 1.63.0
- Language: Java 21
Metadata
Metadata
Assignees
Labels
No labels
Activity
sunny-kavixo commentedon Oct 26, 2026
Hi Playwright maintainers,
I'd like to contribute to Issue #43647, and I've started investigating the reported
frame.content()hang when an iframe's document never commits, including the case where the owning page is subsequently closed.My investigation will focus on:
frame.content()behavior.I'll also check for existing fixes or overlapping contributions to avoid duplicating work.
Could you please confirm whether this issue is available for contribution and whether I may proceed with a focused fix and PR once the issue is independently reproduced?
I'll follow the repository's contribution guidelines and share verified findings before claiming a resolution.
Thank you for your consideration.
Best regards,
Putluru Sandeep
GitHub: Putluru Sandeep (@sunny-kavixo)
github-actions commentedon Oct 26, 2026
Hi, I'm the Playwright bot and I reproduced this on Linux.
Reproduced in Chromium and WebKit on
1.65.0-next(e478109de5542aa6bd69f817d6cb054523af9ce4). Firefox completes in this case. The pending execution-context wait does not stop when its page closes. A verified fix makes it reject on page closure and preserves the target-closed error.Draft fix: #43650
Triaged on Linux by the Playwright bot - agent run
chore: mark v0.1.24 (#529)