mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-09 04:39:03 +02:00
MozReview-Commit-ID: 6EQfBM09xUE --HG-- rename : dom/contacts/tests/test_contacts_cache.xul => dom/contacts/tests/test_contacts_a_cache.xul rename : dom/contacts/tests/test_contacts_shutdown.xul => dom/contacts/tests/test_contacts_a_shutdown.xul rename : dom/contacts/tests/test_contacts_upgrade.xul => dom/contacts/tests/test_contacts_a_upgrade.xul rename : dom/mobilemessage/tests/mochitest/mochitest.ini => dom/mobilemessage/tests/mochitest/chrome.ini extra : rebase_source : 5f708f2a927fafff66626367ef07080785ba9f55
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
/* Any copyright is dedicated to the public domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
// Test that the onmozbrowservisibilitychange event works.
|
|
'use strict';
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
browserElementTestHelpers.setEnabledPref(true);
|
|
|
|
var iframe1 = null;
|
|
function runTest() {
|
|
iframe1 = document.createElement('iframe');
|
|
iframe1.setAttribute('mozbrowser', 'true');
|
|
document.body.appendChild(iframe1);
|
|
|
|
iframe1.src = 'data:text/html,<html><head><title>Title</title></head><body></body></html>';
|
|
checkVisibilityFalse();
|
|
}
|
|
|
|
function checkVisibilityFalse() {
|
|
iframe1.addEventListener('mozbrowservisibilitychange', function onvisibilitychange(e) {
|
|
iframe1.removeEventListener(e.type, onvisibilitychange);
|
|
|
|
is(e.detail.visible, false, 'Visibility should be false');
|
|
checkVisibilityTrue();
|
|
});
|
|
|
|
iframe1.setVisible(false);
|
|
}
|
|
|
|
function checkVisibilityTrue() {
|
|
iframe1.addEventListener('mozbrowservisibilitychange', function onvisibilitychange(e) {
|
|
iframe1.removeEventListener(e.type, onvisibilitychange);
|
|
|
|
is(e.detail.visible, true, 'Visibility should be true');
|
|
SimpleTest.finish();
|
|
});
|
|
|
|
iframe1.setVisible(true);
|
|
}
|
|
|
|
addEventListener('testready', runTest);
|