implement windowproxy "delay-load-event-mode", and partially document "completely-loaded"

This commit is contained in:
Gregory Terzian 2018-12-12 21:16:07 +08:00
parent 483bf245df
commit eb82e781a3
10 changed files with 156 additions and 19 deletions

View file

@ -94,6 +94,9 @@ pub struct WindowProxy {
/// The parent browsing context's window proxy, if this is a nested browsing context
parent: Option<Dom<WindowProxy>>,
/// https://html.spec.whatwg.org/multipage/#delaying-load-events-mode
delaying_load_events_mode: Cell<bool>,
}
impl WindowProxy {
@ -118,6 +121,7 @@ impl WindowProxy {
disowned: Cell::new(false),
frame_element: frame_element.map(Dom::from_ref),
parent: parent.map(Dom::from_ref),
delaying_load_events_mode: Cell::new(false),
opener,
}
}
@ -314,6 +318,26 @@ impl WindowProxy {
None
}
/// https://html.spec.whatwg.org/multipage/#delaying-load-events-mode
pub fn is_delaying_load_events_mode(&self) -> bool {
self.delaying_load_events_mode.get()
}
/// https://html.spec.whatwg.org/multipage/#delaying-load-events-mode
pub fn start_delaying_load_events_mode(&self) {
self.delaying_load_events_mode.set(true);
}
/// https://html.spec.whatwg.org/multipage/#delaying-load-events-mode
pub fn stop_delaying_load_events_mode(&self) {
self.delaying_load_events_mode.set(false);
if let Some(document) = self.document() {
if !document.loader().events_inhibited() {
ScriptThread::mark_document_with_no_blocked_loads(&document);
}
}
}
// https://html.spec.whatwg.org/multipage/#disowned-its-opener
pub fn disown(&self) {
self.disowned.set(true);