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.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | "use strict"; |
michael@0 | 4 | |
michael@0 | 5 | let tiltOpened = false; |
michael@0 | 6 | |
michael@0 | 7 | function test() { |
michael@0 | 8 | if (!isTiltEnabled()) { |
michael@0 | 9 | info("Skipping destruction test because Tilt isn't enabled."); |
michael@0 | 10 | return; |
michael@0 | 11 | } |
michael@0 | 12 | if (!isWebGLSupported()) { |
michael@0 | 13 | info("Skipping destruction test because WebGL isn't supported."); |
michael@0 | 14 | return; |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | waitForExplicitFinish(); |
michael@0 | 18 | |
michael@0 | 19 | createTab(function() { |
michael@0 | 20 | createTilt({ |
michael@0 | 21 | onTiltOpen: function() |
michael@0 | 22 | { |
michael@0 | 23 | tiltOpened = true; |
michael@0 | 24 | |
michael@0 | 25 | Services.obs.addObserver(finalize, DESTROYED, false); |
michael@0 | 26 | window.content.location = "about:mozilla"; |
michael@0 | 27 | } |
michael@0 | 28 | }, false, function suddenDeath() |
michael@0 | 29 | { |
michael@0 | 30 | info("Tilt could not be initialized properly."); |
michael@0 | 31 | cleanup(); |
michael@0 | 32 | }); |
michael@0 | 33 | }); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | function finalize() { |
michael@0 | 37 | let id = TiltUtils.getWindowId(gBrowser.selectedBrowser.contentWindow); |
michael@0 | 38 | |
michael@0 | 39 | is(Tilt.visualizers[id], null, |
michael@0 | 40 | "The current instance of the visualizer wasn't destroyed properly."); |
michael@0 | 41 | |
michael@0 | 42 | cleanup(); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | function cleanup() { |
michael@0 | 46 | if (tiltOpened) { Services.obs.removeObserver(finalize, DESTROYED); } |
michael@0 | 47 | gBrowser.removeCurrentTab(); |
michael@0 | 48 | finish(); |
michael@0 | 49 | } |