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