Closed
Bug 780493
Opened 13 years ago
Closed 13 years ago
nested iframes do not load under certain conditions
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: ed.boas, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.0; rv:14.0) Gecko/20100101 Firefox/14.0.1
Build ID: 20120713134347
Steps to reproduce:
When you use javascript to create nested iframes, the iframes do not load under certain conditions.
http://www.revisionrads.com/bug/1.html
----------------------------------------
1.html:
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
function split_frame() {
var new_url=encodeURIComponent('2.html?type=rows&url1=1.html&url2=1.html');
window.location='2.html?type=cols&url1='+new_url+'&url2='+new_url;
}
</script>
</head>
<body style="overflow:hidden">
<input type="button" value="Split frame" onclick="split_frame();">
</body>
</html>
----------------------------------------
2.html:
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
var frame1, frame2, frame_type;
function read_url_line() {
frame1=document.getElementById("frame1");
frame2=document.getElementById("frame2");
var query=document.URL;
var vars, key_value, i;
query=query.substring(query.indexOf('?')+1, query.length);
vars=query.split("&");
for (i=0; i<vars.length; i++) {
key_value=vars[i].split("=");
if (key_value[0]==="type") {
frame_type=key_value[1];
} else if (key_value[0]==="url1") {
frame1.src=decodeURIComponent(key_value[1]);
} else if (key_value[0]==="url2") {
frame2.src=decodeURIComponent(key_value[1]);
}
}
}
function resize() {
if (frame_type==="cols") {
document.getElementById("frame1").style.width=self.innerWidth/2+"px";
document.getElementById("frame1").style.height=self.innerHeight+"px";
document.getElementById("frame2").style.left=self.innerWidth/2+"px";
document.getElementById("frame2").style.width=self.innerWidth/2+"px";
document.getElementById("frame2").style.height=self.innerHeight+"px";
} else {
document.getElementById("frame1").style.width=self.innerWidth+"px";
document.getElementById("frame1").style.height=self.innerHeight/2+"px";
document.getElementById("frame2").style.top=self.innerHeight/2+"px";
document.getElementById("frame2").style.width=self.innerWidth+"px";
document.getElementById("frame2").style.height=self.innerHeight/2+"px";
}
}
</script>
</head>
<body style="overflow:hidden" onload="read_url_line(); resize()" onresize="resize()">
<iframe id="frame1" frameborder=0 style="position:absolute; top:0px; left:0px; width:0px; height:0px;"></iframe>
<iframe id="frame2" frameborder=0 style="position:absolute; top:0px; left:0px; width:0px; height:0px;"></iframe>
</body>
</html>
Actual results:
When you load 1.html and click on the "Split frame" button, it splits the screen into 2x2 iframes, which is the expected behavior. However, when you click "Split frame" again in one of the iframes, it does not split the iframe further.
Expected results:
Clicking "Split frame" again should split the iframe further. Nesting iframes to the same depth without javascript works fine.
Comment 1•13 years ago
|
||
So when you click the button it loads "2.html?type=cols&url1=NNN&url2=NNN" where NNN is the "2.html?type=rows&url1=1.html&url2=2.html". This produces a page with two subframes each of which has two subframes.
When you click the button in one of the resulting subframes, it tries to load that exact url in the subframe you clicked in. So you get a recursive load, and we block those, because typically those are a bad idea. I'm susprised you saw any difference in the non-JS case. Or did you use non-recursive loads there?
Comment 2•13 years ago
|
||
Note that Opera has the same behavior as Gecko, while WebKit seems to allow two levels of recursion instead of 1 before cutting it off, both in the static and dynamic case (which means in your testcase you can click twice, but not three times). A simple static case for the recursion is this document in test.html:
A LEVEL
<iframe src="test.html"></iframe>
for which Opera and Gecko only show "A LEVEL" once while WebKit shows it twice.
Thanks for your quick and helpful replies! I can work around this issue simply by adding a unique id to the query string (which is then ignored).
Comment 4•13 years ago
|
||
No problem.
I'm going to mark this wontfix; we can obviously cut off recursion at a deeper level, but there are some drawbacks to that (esp. at high fanout).
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•