4 <title>Test for Recursive Loads
</title>
6 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
10 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1597427">Mozilla Bug
1597427</a>
12 <div id=
"content" style=
"display: none">
16 <script type=
"application/javascript">
18 { // too many recursive iframes
19 frameId:
"recursiveFrame",
21 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
22 "http://example.com/tests/docshell/test/navigation/frame_recursive.html",
23 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
24 "http://example.com/tests/docshell/test/navigation/frame_recursive.html",
28 { // too many recursive iframes
29 frameId:
"twoRecursiveIframes",
31 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
32 "http://example.com/tests/docshell/test/navigation/frame_load_as_example_com.html",
33 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
34 "http://example.org/tests/docshell/test/navigation/frame_load_as_example_org.html",
35 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
36 "http://example.com/tests/docshell/test/navigation/frame_load_as_example_com.html",
37 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
38 "http://example.org/tests/docshell/test/navigation/frame_load_as_example_org.html",
42 { // too many recursive iframes
43 frameId:
"threeRecursiveIframes",
45 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
46 "http://sub1.test1.mochi.test:8888/tests/docshell/test/navigation/frame_load_as_host1.html",
47 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
48 "http://example.com/tests/docshell/test/navigation/frame_load_as_host2.html",
49 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
50 "http://test1.mochi.test:8888/tests/docshell/test/navigation/frame_load_as_host3.html",
51 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
52 "http://sub1.test1.mochi.test:8888/tests/docshell/test/navigation/frame_load_as_host1.html",
53 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
54 "http://example.com/tests/docshell/test/navigation/frame_load_as_host2.html",
55 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
56 "http://test1.mochi.test:8888/tests/docshell/test/navigation/frame_load_as_host3.html",
60 { // too many nested iframes
61 frameId:
"sixRecursiveIframes",
63 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
64 "http://example.com/tests/docshell/test/navigation/frame_1_out_of_6.html",
65 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
66 "http://test1.mochi.test:8888/tests/docshell/test/navigation/frame_2_out_of_6.html",
67 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
68 "http://sub1.test1.mochi.test:8888/tests/docshell/test/navigation/frame_3_out_of_6.html",
69 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
70 "http://sub2.xn--lt-uia.mochi.test:8888/tests/docshell/test/navigation/frame_4_out_of_6.html",
71 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
72 "http://test2.mochi.test:8888/tests/docshell/test/navigation/frame_5_out_of_6.html",
73 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
74 "http://example.org/tests/docshell/test/navigation/frame_6_out_of_6.html",
75 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
76 "http://example.com/tests/docshell/test/navigation/frame_1_out_of_6.html",
77 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
78 "http://test1.mochi.test:8888/tests/docshell/test/navigation/frame_2_out_of_6.html",
81 { // too many recursive objects
82 frameId:
"recursiveObject",
84 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
85 "http://sub2.xn--lt-uia.mochi.test:8888/tests/docshell/test/navigation/object_recursive_load.html",
86 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
87 "http://sub2.xn--lt-uia.mochi.test:8888/tests/docshell/test/navigation/object_recursive_load.html",
90 { //
3 nested srcdocs, should show all of them
91 frameId:
"nestedSrcdoc",
94 // eslint-disable-next-line @microsoft/sdl/no-insecure-url
95 "http://example.com/tests/docshell/test/navigation/file_nested_srcdoc.html",
102 async function checkRecursiveLoad(level) {
103 let el = content.document.getElementById(
"static");
104 let documentURI = await SpecialPowers.spawn(
107 () =
> this.content.document.documentURI
109 if (documentURI ==
"about:blank") {
110 // If we had too many recursive frames, the most inner iframe's uri will be about:blank
111 return [documentURI];
113 if (documentURI ==
"about:srcdoc" && level ==
3) {
114 // Check that we have the correct most inner srcdoc iframe
115 let innerText = await SpecialPowers.spawn(
118 () =
> this.content.document.body.innerText
120 is(innerText,
"Third nested srcdoc",
"correct most inner srcdoc iframe");
122 let nestedIfrOrObjectURI = [];
124 // Throws an error when we have too many nested frames/objects, because we
125 // claim to have no content window for the inner most frame/object.
126 nestedIfrOrObjectURI = await SpecialPowers.spawn(
133 `Tried to spawn another task in the iframe/object, but got err: ${err}, must have had too many nested iframes/objects\n`
136 return [documentURI, ...nestedIfrOrObjectURI];
139 add_task(async () =
> {
140 for (const testCase of TEST_CASES) {
141 let el = document.getElementById(testCase.frameId);
142 let loc = await SpecialPowers.spawn(
145 () =
> this.content.location.href
147 let locations = await SpecialPowers.spawn(el, [
1], checkRecursiveLoad);
150 testCase.expectedLocations,
151 "iframes/object loaded in correct order"
159 <iframe style=
"height: 100vh; width:25%;" id=
"recursiveFrame" src=
"http://example.com/tests/docshell/test/navigation/frame_recursive.html"></iframe>
160 <iframe style=
"height: 100vh; width:25%;" id=
"twoRecursiveIframes" src=
"http://example.com/tests/docshell/test/navigation/frame_load_as_example_com.html"></iframe>
161 <iframe style=
"height: 100vh; width:25%;" id=
"threeRecursiveIframes" src=
"http://sub1.test1.mochi.test:8888/tests/docshell/test/navigation/frame_load_as_host1.html"></iframe>
162 <iframe style=
"height: 100vh; width:25%;" id=
"sixRecursiveIframes" src=
"http://example.com/tests/docshell/test/navigation/frame_1_out_of_6.html"></iframe>
163 <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>
164 <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>