mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-10-04 13:57:19 +00:00
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
|
/* Any copyright is dedicated to the Public Domain.
|
||
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||
|
"use strict";
|
||
|
|
||
|
var tiltOpened = false;
|
||
|
|
||
|
function test() {
|
||
|
if (!isTiltEnabled()) {
|
||
|
aborting();
|
||
|
info("Skipping destruction test because Tilt isn't enabled.");
|
||
|
return;
|
||
|
}
|
||
|
if (!isWebGLSupported()) {
|
||
|
aborting();
|
||
|
info("Skipping destruction test because WebGL isn't supported.");
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
waitForExplicitFinish();
|
||
|
|
||
|
createTab(function() {
|
||
|
createTilt({
|
||
|
onTiltOpen: function()
|
||
|
{
|
||
|
tiltOpened = true;
|
||
|
|
||
|
Services.obs.addObserver(finalize, DESTROYED, false);
|
||
|
window.content.location = "about:mozilla";
|
||
|
}
|
||
|
}, false, function suddenDeath()
|
||
|
{
|
||
|
ok(false, "Tilt could not be initialized properly.");
|
||
|
cleanup();
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function finalize() {
|
||
|
let id = TiltUtils.getWindowId(gBrowser.selectedBrowser.contentWindow);
|
||
|
|
||
|
is(Tilt.visualizers[id], null,
|
||
|
"The current instance of the visualizer wasn't destroyed properly.");
|
||
|
|
||
|
cleanup();
|
||
|
}
|
||
|
|
||
|
function cleanup() {
|
||
|
if (tiltOpened) { Services.obs.removeObserver(finalize, DESTROYED); }
|
||
|
gBrowser.removeCurrentTab();
|
||
|
finish();
|
||
|
}
|