1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/browser-element/mochitest/browserElement_ForwardName.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +/* Any copyright is dedicated to the public domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +// Bug 781320 - Test that the name in <iframe mozbrowser name="foo"> is 1.8 +// forwarded down to remote mozbrowsers. 1.9 + 1.10 +"use strict"; 1.11 + 1.12 +SimpleTest.waitForExplicitFinish(); 1.13 +browserElementTestHelpers.setEnabledPref(true); 1.14 +browserElementTestHelpers.addPermission(); 1.15 + 1.16 +function runTest() { 1.17 + var iframe = document.createElement('iframe'); 1.18 + SpecialPowers.wrap(iframe).mozbrowser = true; 1.19 + iframe.setAttribute('name', 'foo'); 1.20 + 1.21 + iframe.addEventListener("mozbrowseropenwindow", function(e) { 1.22 + ok(false, 'Got mozbrowseropenwindow, but should not have.'); 1.23 + }); 1.24 + 1.25 + iframe.addEventListener('mozbrowserlocationchange', function(e) { 1.26 + ok(true, "Got locationchange to " + e.detail); 1.27 + if (e.detail.endsWith("ForwardName.html#finish")) { 1.28 + SimpleTest.finish(); 1.29 + } 1.30 + }); 1.31 + 1.32 + // The file sends us messages via alert() that start with "success:" or 1.33 + // "failure:". 1.34 + iframe.addEventListener('mozbrowsershowmodalprompt', function(e) { 1.35 + ok(e.detail.message.startsWith('success:'), e.detail.message); 1.36 + }); 1.37 + 1.38 + document.body.appendChild(iframe); 1.39 + 1.40 + // This file does window.open('file_browserElement_ForwardName.html#finish', 1.41 + // 'foo'); That should open in the curent window, because the window should 1.42 + // be named foo. 1.43 + iframe.src = 'file_browserElement_ForwardName.html'; 1.44 +} 1.45 + 1.46 +addEventListener('testready', runTest);