You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Page.stopLoading neither cancels an in-flight navigation nor stops a streaming document #2765
moli v1.1.23 (aarch64-apple-darwin), moli serve; the code path is unchanged on current main (cbf4d0149f)
Reference: Google Chrome 157.0.8103.52 headless
Case 1: stop during a provisional navigation
The server's /home returns <p id=home>home page</p>. Its /slow waits 8 s and then returns <p id=slow>slow page</p>.
Page.navigate /home, then wait 1 s.
Send Page.navigate /slow without awaiting it.
After 1 s, send Page.stopLoading.
Evaluate location.href + " | " + document.body.innerHTML after 10 s.
Expected (Chromium):Page.navigate resolves with errorText: "net::ERR_ABORTED", frameStoppedLoading fires, and the page stays /home | <p id="home">home page</p>.
Actual:stopLoading returns {} and Page.navigate stays pending. Then /slow commits: a second frameNavigated (/slow) and loadEventFired arrive, and the page becomes /slow | <p id="slow">slow page</p>.
Root cause:moli-protocol/src/domains/page/termination.rs:183-195 (PreparedPageStopLoading::prepare) stops only the loaded document's lifecycle and Fetch-paused work. It never cancels the slot's uncommitted navigation. cancel_pending_document_navigation already exists at moli-protocol/src/conn/state/page_slot.rs:724.
Case 2: stop while a document is still streaming
/stream sends <html><body><p id=prefix>committed prefix</p> as a chunk, waits 8 s, then sends <p id=tail>tail</p></body></html>.
Navigate, wait 2 s, send Page.stopLoading, and evaluate document.body.innerHTML immediately and again after 8 s.
Expected (Chromium): both reads give <p id="prefix">committed prefix</p>, and frameStoppedLoading fires.
Actual: immediately after the stop the body is the prefix, but 8 s later it is <p id="prefix">committed prefix</p><p id="tail">tail</p>. No frameStoppedLoading is sent.
Root cause:moli-renderer-v8/src/script_vm/main_document_lifecycle_body.rs:46-64 sets readyState to complete but leaves the streaming parser input open.
Impact
An agent that stops a slow navigation is later navigated away anyway, and the DOM keeps changing after a stop, so post-stop snapshots are not stable. Puppeteer and Playwright clients that use stop to cancel a navigation get neither the abort nor a stable page.
Addendum on commit timing. When a response's headers arrive but its body is held (an application/xml body or an HTTP 500 body), moli resolves Page.navigate and emits frameNavigated as soon as the headers arrive. Chrome keeps the navigation provisional until body bytes arrive, so a Page.stopLoading in that window gives errorText: net::ERR_ABORTED and Network.loadingFailed {canceled:true}, and the page stays on the previous URL. On moli, stopping a held 500 still ends at /err500 | held body, and stopping a held XML body crashes the process (#2796). The fix here should account for commit timing as well as cancellation.
One more part of the Chromium stop contract, found while reviewing #2802: Page.stopLoading should also cancel in-flight subresource requests of the stopped document. Chrome ends a pending stylesheet with Network.loadingFailed {errorText:"net::ERR_ABORTED", canceled:true}. In moli the stylesheet keeps loading after the stop and is applied when it arrives.
Remaining after #2800 (provisional navigation) and #2817 (streaming input after stop). These came out of the #2817 review; they existed before and are not regressions:
Bytes buffered before the stop but not yet tokenized are still parsed when the parser resumes, for example <p>x</p> waiting behind a slow <script src>. This belongs with subresource cancellation on stop (above).
Closing the input runs the normal end-of-parse path, so deferred scripts in the committed prefix may still run after a stop. Chrome does not run them (unverified on moli).
frameStoppedLoading is still not sent when a committed streaming document is stopped.
Activity
lanyue-llk commentedon Nov 12, 2026
Addendum on commit timing. When a response's headers arrive but its body is held (an
application/xmlbody or an HTTP 500 body), moli resolvesPage.navigateand emitsframeNavigatedas soon as the headers arrive. Chrome keeps the navigation provisional until body bytes arrive, so aPage.stopLoadingin that window giveserrorText: net::ERR_ABORTEDandNetwork.loadingFailed {canceled:true}, and the page stays on the previous URL. On moli, stopping a held 500 still ends at/err500 | held body, and stopping a held XML body crashes the process (#2796). The fix here should account for commit timing as well as cancellation.lanyue-llk commentedon Nov 12, 2026
One more part of the Chromium stop contract, found while reviewing #2802:
Page.stopLoadingshould also cancel in-flight subresource requests of the stopped document. Chrome ends a pending stylesheet withNetwork.loadingFailed {errorText:"net::ERR_ABORTED", canceled:true}. In moli the stylesheet keeps loading after the stop and is applied when it arrives.lanyue-llk commentedon Nov 12, 2026
Remaining after #2800 (provisional navigation) and #2817 (streaming input after stop). These came out of the #2817 review; they existed before and are not regressions:
<p>x</p>waiting behind a slow<script src>. This belongs with subresource cancellation on stop (above).frameStoppedLoadingis still not sent when a committed streaming document is stopped.