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 var prefsBranch = Cc["@mozilla.org/preferences-service;1"].
5 getService(Ci.nsIPrefService).
6 getBranch("browser.panorama.");
8 function animateZoom() prefsBranch.getBoolPref("animate_zoom");
10 function test() {
11 waitForExplicitFinish();
13 let charsetArg = "charset=" + window.content.document.characterSet;
14 let win = window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no",
15 "about:blank", charsetArg, null, null, true);
17 registerCleanupFunction(function() {
18 prefsBranch.setBoolPref("animate_zoom", true);
19 win.close();
20 });
22 ok(animateZoom(), "By default, we animate on zoom.");
23 prefsBranch.setBoolPref("animate_zoom", false);
24 ok(!animateZoom(), "animate_zoom = false");
26 let onLoad = function() {
27 win.removeEventListener("load", onLoad, false);
29 // a few shared references
30 let tabViewWindow = null;
31 let transitioned = 0;
33 let initCallback = function() {
34 tabViewWindow = win.TabView.getContentWindow();
35 function onTransitionEnd(event) {
36 transitioned++;
37 info(transitioned);
38 }
39 tabViewWindow.document.addEventListener("transitionend", onTransitionEnd, false);
41 // don't use showTabView() here because we only want to check whether
42 // zoom out animation happens. Other animations would happen before
43 // the callback as waitForFocus() was added to showTabView() in head.js
44 let onTabViewShown = function() {
45 tabViewWindow.removeEventListener("tabviewshown", onTabViewShown, false);
46 tabViewWindow.document.removeEventListener("transitionend", onTransitionEnd, false);
48 ok(!transitioned, "There should be no transitions");
50 finish();
51 };
52 tabViewWindow.addEventListener("tabviewshown", onTabViewShown, false);
53 win.TabView.toggle();
54 };
56 win.TabView._initFrame(initCallback);
57 }
58 win.addEventListener("load", onLoad, false);
59 }