mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 01:25:53 -04:00
update comments according to abortFrame change
This commit is contained in:
@@ -632,7 +632,8 @@ pub fn navigate(self: *Frame, request_url: [:0]const u8, opts: NavigateOpts) !vo
|
||||
// Session.initiateRootNavigation) flags both the notification and the
|
||||
// HTTP request itself: CDP skips its node-registry reset until commit,
|
||||
// and the in-flight transfer survives the OLD page's frame.deinit which
|
||||
// calls http_client.abort() during commitPendingPage.
|
||||
// calls http_client.abortFrame(frame_id) on the shared frame_id during
|
||||
// commitPendingPage.
|
||||
const is_pending_root = self._page._state == .pending;
|
||||
|
||||
// We dispatch frame_navigate event before sending the request.
|
||||
@@ -971,11 +972,13 @@ fn frameHeaderDoneCallback(response: HttpClient.Response) !bool {
|
||||
// tears down the OLD page, flips the pointer, and dispatches
|
||||
// frame_created against the new (now active) frame.
|
||||
//
|
||||
// The OLD page's frame.deinit calls http_client.abort() — our transfer
|
||||
// The OLD page's frame.deinit calls http_client.abortFrame(frame_id) on
|
||||
// the frame_id it shares with the (now-active) pending page; our transfer
|
||||
// survives because Session.initiateRootNavigation flagged the request
|
||||
// protect_from_abort. Once we are past commit, that protection is no
|
||||
// longer needed and may interfere with subsequent aborts (e.g. another
|
||||
// navigation while we are still streaming the body), so clear it.
|
||||
// protect_from_abort, which abortFrame's default .normal scope honors.
|
||||
// Once we are past commit, that protection is no longer needed and may
|
||||
// interfere with subsequent aborts (e.g. another navigation while we are
|
||||
// still streaming the body), so clear it.
|
||||
if (self._page._state == .pending) {
|
||||
try self._session.commitPendingPage();
|
||||
switch (response.inner) {
|
||||
|
||||
@@ -54,9 +54,9 @@ pub const InterceptionLayer = @import("../network/layer/InterceptionLayer.zig");
|
||||
//
|
||||
// The app has other secondary http needs, like telemetry. While we want to
|
||||
// share some things (namely the ca blob, and maybe some configuration
|
||||
// (TODO: ??? should proxy settings be global ???)), we're able to do call
|
||||
// client.abort() to abort the transfers being made by a frame, without impacting
|
||||
// those other http requests.
|
||||
// (TODO: ??? should proxy settings be global ???)), we're able to call
|
||||
// client.abortFrame() to abort the transfers being made by a frame, without
|
||||
// impacting those other http requests.
|
||||
pub const Client = @This();
|
||||
|
||||
// Count of active ws requests
|
||||
@@ -892,9 +892,11 @@ pub const RequestParams = struct {
|
||||
|
||||
// Set on an in-flight root-navigation transfer that was issued against a
|
||||
// pending Page. The old Page's frame.deinit (called from Session.commit
|
||||
// PendingPage when response headers arrive) calls http_client.abort() —
|
||||
// that abort_all path skips transfers with this flag so the callback
|
||||
// chain we are sitting inside isn't killed mid-flight.
|
||||
// PendingPage when response headers arrive) calls abortFrame() on the
|
||||
// shared frame_id; abortFrame's default .normal scope skips transfers
|
||||
// with this flag so the callback chain we are sitting inside isn't killed
|
||||
// mid-flight. Session.discardPendingPage uses .full scope to override
|
||||
// the flag in failure paths.
|
||||
protect_from_abort: bool = false,
|
||||
|
||||
const ResourceType = enum {
|
||||
|
||||
@@ -585,9 +585,11 @@ pub fn initiateRootNavigation(self: *Session, frame_id: u32, url: [:0]const u8,
|
||||
// onHttpResponseHeadersDone moments earlier and must survive).
|
||||
// 4. pending_page = null. Order matters: step 3 reads it.
|
||||
// 5. OLD Page.deinit + free LAST. Its frame.deinit calls
|
||||
// http_client.abort() unconditionally — the in-flight navigation
|
||||
// transfer (whose callback we are inside) is shielded by
|
||||
// protect_from_abort, which the caller clears AFTER we return.
|
||||
// http_client.abortFrame(frame_id) on the frame_id that the OLD
|
||||
// page shares with the now-active pending page; the in-flight
|
||||
// navigation transfer (whose callback we are inside) is shielded
|
||||
// by protect_from_abort, which abortFrame's default .normal scope
|
||||
// honors. The caller clears the flag AFTER we return.
|
||||
pub fn commitPendingPage(self: *Session) !void {
|
||||
const pending_idx = self._pending_idx orelse {
|
||||
lp.assert(false, "Session.commitPendingPage - no pending page", .{});
|
||||
@@ -629,8 +631,9 @@ pub fn commitPendingPage(self: *Session) !void {
|
||||
// Step 5: tear down the OLD page LAST. Anything in steps 1-4 that
|
||||
// needed to walk the OLD page's state (CDP node_registry, inspector
|
||||
// context group, isolated worlds) has already done so. The OLD page's
|
||||
// frame.deinit calls http_client.abort() unconditionally; the in-flight
|
||||
// transfer survives via protect_from_abort.
|
||||
// frame.deinit calls http_client.abortFrame(frame_id) on the frame_id
|
||||
// shared with the pending page; the in-flight transfer survives via
|
||||
// protect_from_abort.
|
||||
self._pages[old_idx].?.deinit();
|
||||
self.freeSlot(old_idx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user