mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 521188 - AeroPeek object leaks into global scope. r=gavin (P1 blocker on CLOSED TREE)
This commit is contained in:
parent
e47b092923
commit
619614abd8
@ -129,14 +129,15 @@ let gInitialPages = [
|
||||
#include browser-places.js
|
||||
#include browser-tabPreviews.js
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "Win7Features", function () {
|
||||
#ifdef XP_WIN
|
||||
#ifndef WINCE
|
||||
#define WIN7_FEATURES
|
||||
XPCOMUtils.defineLazyGetter(this, "Win7Features", function () {
|
||||
const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
|
||||
if (WINTASKBAR_CONTRACTID in Cc &&
|
||||
Cc[WINTASKBAR_CONTRACTID].getService(Ci.nsIWinTaskbar).available) {
|
||||
Cu.import("resource://gre/modules/WindowsPreviewPerTab.jsm");
|
||||
let temp = {};
|
||||
Cu.import("resource://gre/modules/WindowsPreviewPerTab.jsm", temp);
|
||||
let AeroPeek = temp.AeroPeek;
|
||||
return {
|
||||
onOpenWindow: function () {
|
||||
AeroPeek.onOpenWindow(window);
|
||||
@ -145,12 +146,11 @@ XPCOMUtils.defineLazyGetter(this, "Win7Features", function () {
|
||||
AeroPeek.onCloseWindow(window);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return { onOpenWindow: function () {}, onCloseWindow: function () {} };
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return null;
|
||||
});
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* We can avoid adding multiple load event listeners and save some time by adding
|
||||
@ -1358,16 +1358,15 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
|
||||
gBrowser.mPanelContainer.addEventListener("PreviewBrowserTheme", LightWeightThemeWebInstaller, false, true);
|
||||
gBrowser.mPanelContainer.addEventListener("ResetBrowserThemePreview", LightWeightThemeWebInstaller, false, true);
|
||||
|
||||
#ifdef WIN7_FEATURES
|
||||
Win7Features.onOpenWindow();
|
||||
#endif
|
||||
if (Win7Features)
|
||||
Win7Features.onOpenWindow();
|
||||
}
|
||||
|
||||
function BrowserShutdown()
|
||||
{
|
||||
#ifdef WIN7_FEATURES
|
||||
Win7Features.onCloseWindow();
|
||||
#endif
|
||||
if (Win7Features)
|
||||
Win7Features.onCloseWindow();
|
||||
|
||||
gPrefService.removeObserver(ctrlTab.prefName, ctrlTab);
|
||||
gPrefService.removeObserver(allTabs.prefName, allTabs);
|
||||
tabPreviews.uninit();
|
||||
|
@ -1,11 +1,20 @@
|
||||
function test() {
|
||||
// Cannot do anything if the taskbar service is not available
|
||||
ok(("AeroPeek" in window) == isWin7OrHigher(), "AeroPeek initialized when it should be");
|
||||
var isWin7OrHigher = false;
|
||||
try {
|
||||
let version = Cc["@mozilla.org/system-info;1"]
|
||||
.getService(Ci.nsIPropertyBag2)
|
||||
.getProperty("version");
|
||||
isWin7OrHigher = (parseFloat(version) >= 6.1);
|
||||
} catch (ex) { }
|
||||
|
||||
// Entire feature is disabled
|
||||
if (!("AeroPeek" in window))
|
||||
is(!!Win7Features, isWin7OrHigher, "Win7Features available when it should be");
|
||||
if (!isWin7OrHigher)
|
||||
return;
|
||||
|
||||
let temp = {};
|
||||
Cu.import("resource://gre/modules/WindowsPreviewPerTab.jsm", temp);
|
||||
let AeroPeek = temp.AeroPeek;
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
gPrefService.setBoolPref("aeropeek.enable", true);
|
||||
@ -94,16 +103,6 @@ function test() {
|
||||
is(nPreviews, aPreviews, msg || "Got expected number of previews");
|
||||
}
|
||||
|
||||
function isWin7OrHigher() {
|
||||
try {
|
||||
var sysInfo = Cc["@mozilla.org/system-info;1"].
|
||||
getService(Ci.nsIPropertyBag2);
|
||||
var ver = parseFloat(sysInfo.getProperty("version"));
|
||||
if (ver >= 6.1)
|
||||
return true;
|
||||
} catch (ex) { }
|
||||
return false;
|
||||
}
|
||||
function getPreviewForTab(tab)
|
||||
window.gTaskbarTabGroup.previewFromTab(tab);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user