-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Websockets do not prevent bfcache #39872
Description
We implement a subset of checks from https://html.spec.whatwg.org/#unloading-document-cleanup-steps right now, which influence whether a document is considered salvageable or not:
servo/components/script/dom/document.rs
Lines 2462 to 2466 in 1489de1
let event_sources_canceled = self.window.as_global_scope().close_event_sources(); if loads_cancelled || event_sources_canceled { // If any loads were canceled. self.salvageable.set(false); }; servo/components/script/dom/document.rs
Lines 2102 to 2107 in 1489de1
// https://html.spec.whatwg.org/multipage/#unloading-document-cleanup-steps if !self.salvageable.get() { // Step 1 of clean-up steps. global_scope.close_event_sources(); let msg = ScriptToConstellationMessage::DiscardDocument; let _ = global_scope.script_to_constellation_chan().send(msg);
Unsalvageable documents do not get put in the bfcache. There are a bunch of WPT tests that rely on the websocket checks to force a document to be kept out of the bfcache, and we don't implement that right now.
We should use a similar model as the EventSource code in globalscope.rs for tracking all WebSocket objects so we can implement the checks correctly.