mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1931418 - Test that navigation isn't blocked due to recursive iframes. r=jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D229586
This commit is contained in:
parent
b9d8dbcb9e
commit
b0a345167c
32
docshell/test/navigation/frame_recursive_target.html
Normal file
32
docshell/test/navigation/frame_recursive_target.html
Normal file
@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<iframe id="static"></iframe>
|
||||
<script>
|
||||
const name = "frame_recursive_target";
|
||||
const url = location.href;
|
||||
const iframe = document.querySelector("iframe");
|
||||
let isCrossOrigin = false;
|
||||
try {
|
||||
window.parent.location.hostname;
|
||||
} catch (_) {
|
||||
isCrossOrigin = true;
|
||||
}
|
||||
|
||||
addEventListener("load", async () => {
|
||||
await new Promise(resolve => {
|
||||
iframe.addEventListener("load", resolve);
|
||||
if (!isCrossOrigin) {
|
||||
iframe.name = name;
|
||||
}
|
||||
|
||||
iframe.src = url;
|
||||
});
|
||||
|
||||
if (isCrossOrigin) {
|
||||
const innerWin = iframe.contentWindow.document.querySelector("iframe");
|
||||
await new Promise(resolve => {
|
||||
innerWin.addEventListener("load", resolve);
|
||||
window.open(url, name);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
@ -87,6 +87,7 @@ support-files = [
|
||||
"frame_6_out_of_6.html",
|
||||
"frame_recursive.html",
|
||||
"frame_recursive_dynamic.html",
|
||||
"frame_recursive_target.html",
|
||||
"object_recursive_load.html",
|
||||
"file_nested_srcdoc.html",
|
||||
]
|
||||
|
@ -107,6 +107,16 @@
|
||||
"about:blank"
|
||||
],
|
||||
},
|
||||
{ // navigating shouldn't be blocked by recursion check
|
||||
frameId: "navigationIsNotRecursive",
|
||||
expectedLocations: [
|
||||
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
|
||||
"http://example.com/tests/docshell/test/navigation/frame_recursive_target.html",
|
||||
"http://example.com/tests/docshell/test/navigation/frame_recursive_target.html",
|
||||
"http://example.com/tests/docshell/test/navigation/frame_recursive_target.html",
|
||||
"about:blank"
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
async function checkRecursiveLoad(level) {
|
||||
@ -172,6 +182,7 @@
|
||||
<object width="400" height="300" id="recursiveObject" data="http://sub2.xn--lt-uia.mochi.test:8888/tests/docshell/test/navigation/object_recursive_load.html"></object>
|
||||
<iframe id="nestedSrcdoc" srcdoc="Srcdoc that will embed an iframe <iframe id="static" src="http://example.com/tests/docshell/test/navigation/file_nested_srcdoc.html"></iframe>"></iframe>
|
||||
<iframe style="height: 100vh; width:25%;" id="dynamicrecursive" src="http://example.com/tests/docshell/test/navigation/frame_recursive_dynamic.html"></iframe>
|
||||
<iframe style="height: 100vh; width:25%;" id="navigationIsNotRecursive" src="http://example.com/tests/docshell/test/navigation/frame_recursive_target.html"></iframe>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user