|
1 /* Any copyright is dedicated to the public domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 // Bug 762939 - Test that setting a <iframe mozbrowser> to invisible / visible |
|
5 // inside an invisible <iframe mozbrowser> doesn't trigger any events. |
|
6 |
|
7 "use strict"; |
|
8 |
|
9 SimpleTest.waitForExplicitFinish(); |
|
10 browserElementTestHelpers.setEnabledPref(true); |
|
11 browserElementTestHelpers.addPermission(); |
|
12 |
|
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 }); |
|
18 |
|
19 var iframe = document.createElement('iframe'); |
|
20 SpecialPowers.wrap(iframe).mozbrowser = true; |
|
21 |
|
22 // We need remote = false here until bug 761935 is fixed; see |
|
23 // SetVisibleFrames.js for an explanation. |
|
24 iframe.remote = false; |
|
25 |
|
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 }); |
|
31 |
|
32 iframe.addEventListener('mozbrowsershowmodalprompt', function(e) { |
|
33 if (e.detail.message == 'parent:finish') { |
|
34 ok(true, "Got parent:finish"); |
|
35 |
|
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 }); |
|
53 |
|
54 document.body.appendChild(iframe); |
|
55 } |
|
56 |
|
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 }); |
|
62 |
|
63 SimpleTest.finish(); |
|
64 } |
|
65 |
|
66 addEventListener('testready', runTest); |