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/ */
3 "use strict";
5 let tiltOpened = false;
7 function test() {
8 if (!isTiltEnabled()) {
9 info("Skipping destruction test because Tilt isn't enabled.");
10 return;
11 }
12 if (!isWebGLSupported()) {
13 info("Skipping destruction test because WebGL isn't supported.");
14 return;
15 }
17 waitForExplicitFinish();
19 createTab(function() {
20 createTilt({
21 onTiltOpen: function()
22 {
23 tiltOpened = true;
25 Services.obs.addObserver(finalize, DESTROYED, false);
26 EventUtils.sendKey("ESCAPE");
27 }
28 }, false, function suddenDeath()
29 {
30 info("Tilt could not be initialized properly.");
31 cleanup();
32 });
33 });
34 }
36 function finalize() {
37 let id = TiltUtils.getWindowId(gBrowser.selectedBrowser.contentWindow);
39 is(Tilt.visualizers[id], null,
40 "The current instance of the visualizer wasn't destroyed properly.");
42 cleanup();
43 }
45 function cleanup() {
46 if (tiltOpened) { Services.obs.removeObserver(finalize, DESTROYED); }
47 gBrowser.removeCurrentTab();
48 finish();
49 }