Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* Any copyright is dedicated to the public domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 // Bug 781320 - Test that the name in <iframe mozbrowser name="foo"> is
5 // forwarded down to remote mozbrowsers.
7 "use strict";
9 SimpleTest.waitForExplicitFinish();
10 browserElementTestHelpers.setEnabledPref(true);
11 browserElementTestHelpers.addPermission();
13 function runTest() {
14 var iframe = document.createElement('iframe');
15 SpecialPowers.wrap(iframe).mozbrowser = true;
16 iframe.setAttribute('name', 'foo');
18 iframe.addEventListener("mozbrowseropenwindow", function(e) {
19 ok(false, 'Got mozbrowseropenwindow, but should not have.');
20 });
22 iframe.addEventListener('mozbrowserlocationchange', function(e) {
23 ok(true, "Got locationchange to " + e.detail);
24 if (e.detail.endsWith("ForwardName.html#finish")) {
25 SimpleTest.finish();
26 }
27 });
29 // The file sends us messages via alert() that start with "success:" or
30 // "failure:".
31 iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
32 ok(e.detail.message.startsWith('success:'), e.detail.message);
33 });
35 document.body.appendChild(iframe);
37 // This file does window.open('file_browserElement_ForwardName.html#finish',
38 // 'foo'); That should open in the curent window, because the window should
39 // be named foo.
40 iframe.src = 'file_browserElement_ForwardName.html';
41 }
43 addEventListener('testready', runTest);