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 762939 - Test that setting a <iframe mozbrowser> to invisible / visible
5 // inside an invisible <iframe mozbrowser> doesn't trigger any events.
7 "use strict";
9 SimpleTest.waitForExplicitFinish();
10 browserElementTestHelpers.setEnabledPref(true);
11 browserElementTestHelpers.addPermission();
13 function runTest() {
14 var principal = SpecialPowers.wrap(document).nodePrincipal;
15 SpecialPowers.addPermission("browser", true, { url: SpecialPowers.wrap(principal.URI).spec,
16 appId: principal.appId,
17 isInBrowserElement: true });
19 var iframe = document.createElement('iframe');
20 SpecialPowers.wrap(iframe).mozbrowser = true;
22 // We need remote = false here until bug 761935 is fixed; see
23 // SetVisibleFrames.js for an explanation.
24 iframe.remote = false;
26 iframe.addEventListener('mozbrowserloadend', function loadEnd(e) {
27 iframe.removeEventListener('mozbrowserloadend', loadEnd);
28 iframe.setVisible(false);
29 iframe.src = 'file_browserElement_SetVisibleFrames2_Outer.html';
30 });
32 iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
33 if (e.detail.message == 'parent:finish') {
34 ok(true, "Got parent:finish");
36 // Give any extra events a chance to fire, then end the test.
37 SimpleTest.executeSoon(function() {
38 SimpleTest.executeSoon(function() {
39 SimpleTest.executeSoon(function() {
40 SimpleTest.executeSoon(function() {
41 SimpleTest.executeSoon(function() {
42 finish();
43 });
44 });
45 });
46 });
47 });
48 }
49 else {
50 ok(false, "Got unexpected message: " + e.detail.message);
51 }
52 });
54 document.body.appendChild(iframe);
55 }
57 function finish() {
58 var principal = SpecialPowers.wrap(document).nodePrincipal;
59 SpecialPowers.removePermission("browser", { url: SpecialPowers.wrap(principal.URI).spec,
60 appId: principal.appId,
61 isInBrowserElement: true });
63 SimpleTest.finish();
64 }
66 addEventListener('testready', runTest);