Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the public domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 // Test that the onmozbrowservisibilitychange event works.
5 'use strict';
7 SimpleTest.waitForExplicitFinish();
8 browserElementTestHelpers.setEnabledPref(true);
9 browserElementTestHelpers.addPermission();
11 var iframe1 = null;
12 function runTest() {
13 iframe1 = document.createElement('iframe');
14 SpecialPowers.wrap(iframe1).mozbrowser = true;
15 document.body.appendChild(iframe1);
17 iframe1.src = 'data:text/html,<html><head><title>Title</title></head><body></body></html>';
18 checkVisibilityFalse();
19 }
21 function checkVisibilityFalse() {
22 iframe1.addEventListener('mozbrowservisibilitychange', function onvisibilitychange(e) {
23 iframe1.removeEventListener(e.type, onvisibilitychange);
25 is(e.detail.visible, false, 'Visibility should be false');
26 checkVisibilityTrue();
27 });
29 iframe1.setVisible(false);
30 }
32 function checkVisibilityTrue() {
33 iframe1.addEventListener('mozbrowservisibilitychange', function onvisibilitychange(e) {
34 iframe1.removeEventListener(e.type, onvisibilitychange);
36 is(e.detail.visible, true, 'Visibility should be true');
37 SimpleTest.finish();
38 });
40 iframe1.setVisible(true);
41 }
43 addEventListener('testready', runTest);