Closed
Bug 804942
Opened 12 years ago
Closed 12 years ago
Cross-frame javascript call fails after iframe moved by appendChild()
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 170799
People
(Reporter: bugzilla, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/19.0 Firefox/19.0
Build ID: 20121023030553
Steps to reproduce:
Here is a test case that exhibits the problem. Load main.html into the browser, and press successively on "Execute", "Move" and "Execute" :
=== main.html ===
<?xml version="1.0" encoding="cp1252"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title></title>
</head>
<body>
<button id="execute">Execute</button>
<button id="move_iframe">Move</button>
Press Execute, Move, Execute while looking at the integrated console.
<div id="first">
<iframe id="movable_iframe" name="frame1" src="frame1.html"></iframe>
</div>
<div id="second">
</div>
<script type="text/javascript">
function move_iframe() {
var elem;
elem = document.getElementById("movable_iframe");
document.getElementById("second").appendChild(elem);
}
function execute() {
// should output something to the console.
window.frames.frame1.example();
}
function init() {
document.getElementById("execute").addEventListener("click", execute);
document.getElementById("move_iframe").addEventListener("click", move_iframe);
}
init();
</script>
</body>
=== frame1.html ===
<?xml version="1.0" encoding="cp1252"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title></title>
<script type="text/javascript">
function example() {
console.log("success");
}
</script>
</head>
<body>
</body>
Actual results:
Pressing "Execute" first displays correctly "success" in the console.
Pressing "Move" moves the iframe into the #second div.
Pressing "Execute" again shows an error in the console, instead of "success". The error with the nightly build is :
[09:48:05.823] NS_NOINTERFACE: Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsIInterfaceRequestor.getInterface] @ resource://gre/modules/PrivateBrowsingUtils.jsm:17
The problem also exists in Firefox 16.0.1, but the error message is different.
Interestingly, the first press on "Execute" is required : pressing just "Move" then "Execute" don't cause any problem. It is the sequence Execute-Move-Execute that fails.
Expected results:
The second press on "Execute" should have printed "success" in the console, without any error.
Updated•12 years ago
|
Component: Untriaged → DOM
Product: Firefox → Core
Comment 1•12 years ago
|
||
duplication of bug 575321 and Bug 170799
Comment 2•12 years ago
|
||
"delete window.frames.frame1" helps as follows
function move_iframe() {
var elem;
elem = document.getElementById("movable_iframe");
+ delete window.frames.frame1;
document.getElementById("second").appendChild(elem);
}
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
Reporter | ||
Comment 3•12 years ago
|
||
Deleting the frame indeed solves my problem. Thank you !
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•