mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
script: Properly handle removed iframes in GlobalScope::get_referrer
(#32782)
Signed-off-by: newmoneybigbucks <newmoneybigbucks@protonmail.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
9cb0e74cdc
commit
3fca6e015f
3 changed files with 31 additions and 8 deletions
|
@ -2428,14 +2428,18 @@ impl GlobalScope {
|
||||||
|
|
||||||
// Substep 3.1.3
|
// Substep 3.1.3
|
||||||
while url.as_str() == "about:srcdoc" {
|
while url.as_str() == "about:srcdoc" {
|
||||||
document = document
|
// Return early if we cannot get a parent document. This might happen if
|
||||||
.browsing_context()
|
// this iframe was already removed from the parent page.
|
||||||
.expect("iframe should have browsing context")
|
let Some(parent_document) =
|
||||||
.parent()
|
document.browsing_context().and_then(|browsing_context| {
|
||||||
.expect("iframes browsing_context should have parent")
|
browsing_context
|
||||||
.document()
|
.parent()
|
||||||
.expect("iframes parent should have document");
|
.and_then(|parent| parent.document())
|
||||||
|
})
|
||||||
|
else {
|
||||||
|
return Referrer::NoReferrer;
|
||||||
|
};
|
||||||
|
document = parent_document;
|
||||||
url = document.url();
|
url = document.url();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
tests/wpt/meta/MANIFEST.json
vendored
7
tests/wpt/meta/MANIFEST.json
vendored
|
@ -6896,6 +6896,13 @@
|
||||||
null,
|
null,
|
||||||
{}
|
{}
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
"srcdoc-removed-iframe-crash.html": [
|
||||||
|
"ebf4e1330a772ecffb5500d493c3225cae018d79",
|
||||||
|
[
|
||||||
|
null,
|
||||||
|
{}
|
||||||
|
]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"the-img-element": {
|
"the-img-element": {
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<title>iframe with srcdoc content that loads after iframe is removed from the document</title>
|
||||||
|
<link rel="author" title="Martin Robinson" href="mrobinson@igalia.com">
|
||||||
|
<link rel="help" href="https://github.com/servo/servo/issues/32432">
|
||||||
|
<iframe srcdoc="contents"></iframe>
|
||||||
|
<script>
|
||||||
|
document.querySelector('iframe').remove();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue