aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmliframeelement.rs
diff options
context:
space:
mode:
authoryvt <i@yvt.jp>2021-08-03 23:45:35 +0900
committeryvt <i@yvt.jp>2021-08-07 11:41:00 +0900
commit38adb092ad6efdd9770e76eec2d19b6dabf72513 (patch)
tree6163dd0a9d13cf95c354f9ccf20eecfa4a3411fa /components/script/dom/htmliframeelement.rs
parent3090505fd484c661a30a3526c8f5ccb53a48fba9 (diff)
downloadservo-38adb092ad6efdd9770e76eec2d19b6dabf72513.tar.gz
servo-38adb092ad6efdd9770e76eec2d19b6dabf72513.zip
fix(script): "process the iframe attributes" shouldn't invoke the iframe load event steps anymore
This likely originates from a bug that existed in the specification[1]. A `src`-less iframe would fire two `load` events when implemented according to an affected version of the specification. [1]: https://github.com/whatwg/html/commit/f2839722e1b3dc56368c32fd5808f172f3ea3289
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r--components/script/dom/htmliframeelement.rs29
1 files changed, 18 insertions, 11 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index b6f9948874b..1fe04c04518 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -25,7 +25,6 @@ use crate::dom::virtualmethods::VirtualMethods;
use crate::dom::window::ReflowReason;
use crate::dom::windowproxy::WindowProxy;
use crate::script_thread::ScriptThread;
-use crate::task_source::TaskSource;
use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix};
use ipc_channel::ipc;
@@ -239,6 +238,7 @@ impl HTMLIFrameElement {
/// <https://html.spec.whatwg.org/multipage/#process-the-iframe-attributes>
fn process_the_iframe_attributes(&self, mode: ProcessingMode) {
+ // > 1. If `element`'s `srcdoc` attribute is specified, then:
if self
.upcast::<Element>()
.has_attribute(&local_name!("srcdoc"))
@@ -280,22 +280,16 @@ impl HTMLIFrameElement {
}
}
- // https://github.com/whatwg/html/issues/490
if mode == ProcessingMode::FirstTime &&
!self.upcast::<Element>().has_attribute(&local_name!("src"))
{
- let this = Trusted::new(self);
- let pipeline_id = self.pipeline_id().unwrap();
- // FIXME(nox): Why are errors silenced here?
- let _ = window.task_manager().dom_manipulation_task_source().queue(
- task!(iframe_load_event_steps: move || {
- this.root().iframe_load_event_steps(pipeline_id);
- }),
- window.upcast(),
- );
return;
}
+ // > 2. Otherwise, if `element` has a `src` attribute specified, or
+ // > `initialInsertion` is false, then run the shared attribute
+ // > processing steps for `iframe` and `frame` elements given
+ // > `element`.
let url = self.get_url();
// TODO(#25748):
@@ -355,6 +349,19 @@ impl HTMLIFrameElement {
fn create_nested_browsing_context(&self) {
// Synchronously create a new browsing context, which will present
// `about:blank`. (This is not a navigation.)
+ //
+ // The pipeline started here will synchronously "completely finish
+ // loading", which will then asynchronously call
+ // `iframe_load_event_steps`.
+ //
+ // The precise event timing differs between implementations and
+ // remains controversial:
+ //
+ // - [Unclear "iframe load event steps" for initial load of about:blank
+ // in an iframe #490](https://github.com/whatwg/html/issues/490)
+ // - [load event handling for iframes with no src may not be web
+ // compatible #4965](https://github.com/whatwg/html/issues/4965)
+ //
let url = ServoUrl::parse("about:blank").unwrap();
let document = document_from_node(self);
let window = window_from_node(self);