/** Test for Bug 916945 **/
SimpleTest.waitForExplicitFinish();
var gLoadCount = 0;
function loaded() {
if (++gLoadCount == 2)
go();
}
async function go() {
// Both same-origin and cross-origin names should be visible if they're set
// on the iframe element.
ok('winA' in window, "same-origin named access works");
ok(winA instanceof winA.Window, "same-origin named access works");
ok('winB' in window, "cross-origin named access works when iframe name matches");
is(winB.parent, window, "cross-origin named access works when iframe name matches");
// Setting the 'name' attribute should propagate to the docshell. var ifrB = document.getElementById('ifrB');
await SpecialPowers.spawn(ifrB, [], () => {
Assert.equal(this.content.name, 'winB', 'initial attribute value propagates to the docshell');
});
ifrB.setAttribute('name', 'foo');
await SpecialPowers.spawn(ifrB, [], () => {
Assert.equal(this.content.name, 'foo', 'attribute sets propagate to the docshell');
});
ok('foo' in window, "names are dynamic if updated via setAttribute");
is(foo.parent, window, "names are dynamic if updated via setAttribute");
// Setting window.name on the subframe should not propagate to the attribute.
await SpecialPowers.spawn(ifrB, [], () => {
this.content.name = "bar";
});
is(ifrB.getAttribute('name'), 'foo', 'docshell updates dont propagate to the attribute');
// When the frame element attribute and docshell name don't match, nothing is returned.
ok(!('foo' in window), "frame element name not resolved if it doesn't match the docshell");
ok(!('bar' in window), "docshell name not resolved if it doesn't match the frame element");
// This shouldn't assert.
function listener() {
document.body.appendChild(ifrA);
ifrA.name = "";
}
ifrA.addEventListener("DOMNodeInserted", listener, {once: true});
document.body.appendChild(ifrA);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.