Closed shaseley closed 1 year ago
I think I lean toward a variant of (1). Which is, we don't necessarily have to associate every NavigateEvent
with an AbortController
: we only need to do that for spec-created ones. Because the spec only ever wants to signal-abort on spec-created NavigateEvent
s.
Another way of thinking about this, is that we change the spec code from having a handle to a NavigateEvent
, to having a handle to a NavigateEvent
+ AbortController
. We could even, in the spec, store it alongside the NavigateEvent
; see https://whatpr.org/html/8502/nav-history-apis.html#ongoing-navigation-tracking .
That way, the interface of NavigateEvent
itself remains: it just gets a signal
. It doesn't know whether that signal came from other parts of the spec that create AbortController
s, or from userland AbortController
s. It remains like other events, a dumb property-bag.
Okay yeah, makes sense; storing an AbortController
alongside the NavigateEvent
is pretty clean and makes sense conceptually (vs. storing it on the event).
Currently,
NavigateEvent
's signal is aborted directly via "signal abort", but we'd like to stop exporting "signal abort", having specs abort via a controller (like in userland). The tricky bit here is how to handle userland-createdNavigateEvent
s. We could:Leave
NavigateEventInit
alone, makeNavigateEvent
have an internalAbortController
, setNavigateEventInit
'ssignal
to the controller's signal. This doesn't change the API at all, but it's a little gross (need to store both a controller and signal, common case signal == controller.signal).Remove
signal
fromNavigateEventInit
, makeNavigateEvent
have an internalAbortController
, haveNavigateEvent
'ssignal
property return the controller's signal. This is the cleanest IMO, but IIUC it could break some unit test functionality?NavigateEventInit
takes anAbortController
andNavigateEvent
ssignal
attribute return the controller's signal (credit: @natechapin). This is probably cleaner than (1), but changes the API shape and is a bit unusual (passing a controller).@domenic thoughts on what you'd prefer here?