Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion components/script/dom/document/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,11 @@ pub(crate) struct Document {

/// Data necessary for maintaining the accessibility tree.
accessibility_data: DomRefCell<AccessibilityData>,

/// <https://html.spec.whatwg.org/multipage/#iframe-load-in-progress>
iframe_load_in_progress: Cell<bool>,
/// <https://html.spec.whatwg.org/multipage/#mute-iframe-load>
mute_iframe_load: Cell<bool>,
}

impl Document {
Expand Down Expand Up @@ -3672,6 +3677,8 @@ impl Document {
default_single_line_container_name: Default::default(),
css_styling_flag: Default::default(),
accessibility_data: Default::default(),
iframe_load_in_progress: Default::default(),
mute_iframe_load: Default::default(),
}
}

Expand Down Expand Up @@ -4773,6 +4780,14 @@ impl Document {
pub(crate) fn set_css_styling_flag(&self, value: bool) {
self.css_styling_flag.set(value)
}

pub(crate) fn mute_iframe_load_flag(&self) -> bool {
self.mute_iframe_load.get()
}

pub(crate) fn set_iframe_load_in_progress(&self, value: bool) {
self.iframe_load_in_progress.set(value)
}
}

impl DocumentMethods<crate::DomTypeHolder> for Document {
Expand Down Expand Up @@ -6194,7 +6209,9 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {

// Step 14. If document's iframe load in progress flag is set, then set document's mute
// iframe load flag.
// TODO: https://github.com/servo/servo/issues/21938
if self.iframe_load_in_progress.get() {
self.mute_iframe_load.set(true);
}

// Step 15: Set document to no-quirks mode.
self.set_quirks_mode(QuirksMode::NoQuirks);
Expand Down
22 changes: 19 additions & 3 deletions components/script/dom/html/htmliframeelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,17 +805,33 @@ impl HTMLIFrameElement {
pub(crate) fn run_iframe_load_event_steps(&self, cx: &mut JSContext) {
// TODO 1. Assert: element's content navigable is not null.

// TODO 2-4 Mark resource timing.
// Step 2. Let childDocument be element's content navigable's active document.
let child_document = self.GetContentDocument();

// Step 3. If childDocument has its mute iframe load flag set, then return.
// Step 5. Set childDocument's iframe load in progress flag.
if let Some(document) = child_document {
if document.mute_iframe_load_flag() {
let blocker = &self.load_blocker;
LoadBlocker::terminate(blocker, cx);
return;
}
document.set_iframe_load_in_progress(true);
}

// TODO 5 Set childDocument's iframe load in progress flag.
// Step 4. If element's pending resource-timing start time is not null, then:
// TODO

// Step 6. Fire an event named load at element.
self.upcast::<EventTarget>().fire_event(cx, atom!("load"));

let blocker = &self.load_blocker;
LoadBlocker::terminate(blocker, cx);

// TODO Step 7 - unset child document `mute iframe load` flag
// Step 7. Unset childDocument's iframe load in progress flag
if let Some(child_document) = self.GetContentDocument() {
child_document.set_iframe_load_in_progress(false);
}
}

/// Parse the `sandbox` attribute value given the [`Attr`]. This sets the `sandboxing_flag_set`
Expand Down

This file was deleted.