v156 · dom · feature removal
Agent boundary matrix
Chrome does not drop the events for every subframe. ChildFrameDisconnector::ShouldFireUnloadEvents() omits them only when the frame being destroyed is in the same agent as the document whose DOM is being mutated — the only frames whose handlers could synchronously re-enter it. This matrix removes eight real frame configurations and checks each one against both models.
--enable-blink-features=OmitSubframeDetachmentEventsOnRemoval on Chrome 156+
(Finch name --enable-features=OmitSubframeDetachmentEventsOnRemoval; not covered by
--enable-experimental-web-platform-features). Opaque frames report through a MessageChannel:
a parent.postMessage() sent from a frame that is being destroyed is dropped, but a transferred port still delivers.
Run the matrix
Probe frames load here, then get removed.
Not run yet.
| configuration | same agent as parent? | legacy Chrome | 156 gate (flag on) | observed here | matches | run |
|---|
what the gate is
// third_party/blink/renderer/core/dom/child_frame_disconnector.cc (main, 2026-11)
bool ChildFrameDisconnector::ShouldFireUnloadEvents(const Document& document) {
if (!RuntimeEnabledFeatures::OmitSubframeDetachmentEventsOnRemovalEnabled())
return true;
for (disconnector = last_; disconnector; disconnector = disconnector->previous_) {
if (disconnector->disconnect_reason_ == kDisconnectSelf &&
InSameAgent(document, disconnector->Root().GetDocument()))
return false; // same agent → no pagehide / visibilitychange / unload
}
return true; // other agent (cross-origin, opaque) → events still fire
}
The HTML Standard omits the events for every subframe. Chrome’s narrower gate is a compatibility choice: cross-origin and opaque frames can’t touch the parent’s DOM synchronously anyway, and their handlers carry most of the real-world telemetry (the compat study found ~1.2% of mobile pages affected by the all-frames option vs ~0.026% for the same-agent gate). So the sandbox without allow-same-origin and data: rows are expected to keep firing even with the flag on, while the spec says they shouldn’t.