Bug 522416 - Tab Previews must not do synchronous HTTP requests.

Fixes a startup crash and unit tests.
r=vlad

--HG--
extra : rebase_source : 003b29893d97b13820648cd5a1a3277e5d8b3946
This commit is contained in:
Rob Arnold 2009-10-16 15:02:27 -07:00
Родитель f0859a8125
Коммит 30800af665
3 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -11,13 +11,15 @@ function test() {
if (!isWin7OrHigher) if (!isWin7OrHigher)
return; return;
const ENABLE_PREF_NAME = "browser.taskbar.previews.enable";
let temp = {}; let temp = {};
Cu.import("resource://gre/modules/WindowsPreviewPerTab.jsm", temp); Cu.import("resource://gre/modules/WindowsPreviewPerTab.jsm", temp);
let AeroPeek = temp.AeroPeek; let AeroPeek = temp.AeroPeek;
waitForExplicitFinish(); waitForExplicitFinish();
gPrefService.setBoolPref("aeropeek.enable", true); gPrefService.setBoolPref(ENABLE_PREF_NAME, true);
is(1, AeroPeek.windows.length, "Got the expected number of windows"); is(1, AeroPeek.windows.length, "Got the expected number of windows");
@ -32,13 +34,13 @@ function test() {
for each (let preview in AeroPeek.previews) for each (let preview in AeroPeek.previews)
ok(preview.visible, "Preview is shown as expected"); ok(preview.visible, "Preview is shown as expected");
gPrefService.setBoolPref("aeropeek.enable", false); gPrefService.setBoolPref(ENABLE_PREF_NAME, false);
checkPreviews(4, "Previews are unchanged when disabling"); checkPreviews(4, "Previews are unchanged when disabling");
for each (let preview in AeroPeek.previews) for each (let preview in AeroPeek.previews)
ok(!preview.visible, "Preview is not shown as expected after disabling"); ok(!preview.visible, "Preview is not shown as expected after disabling");
gPrefService.setBoolPref("aeropeek.enable", true); gPrefService.setBoolPref(ENABLE_PREF_NAME, true);
checkPreviews(4, "Previews are unchanged when re-enabling"); checkPreviews(4, "Previews are unchanged when re-enabling");
for each (let preview in AeroPeek.previews) for each (let preview in AeroPeek.previews)
ok(preview.visible, "Preview is shown as expected after re-enabling"); ok(preview.visible, "Preview is shown as expected after re-enabling");
@ -92,7 +94,7 @@ function test() {
getPreviewForTab(gBrowser.mTabs[1]).controller.onClose(); getPreviewForTab(gBrowser.mTabs[1]).controller.onClose();
checkPreviews(1); checkPreviews(1);
gPrefService.clearUserPref("aeropeek.enable"); gPrefService.clearUserPref(ENABLE_PREF_NAME);
finish(); finish();

Просмотреть файл

@ -126,7 +126,7 @@ TaskbarTabPreview::SetIcon(imgIContainer *icon) {
NS_IMETHODIMP NS_IMETHODIMP
TaskbarTabPreview::GetIcon(imgIContainer **icon) { TaskbarTabPreview::GetIcon(imgIContainer **icon) {
NS_ADDREF(*icon = mIconImage); NS_IF_ADDREF(*icon = mIconImage);
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -82,6 +82,7 @@
let tabP = taskbar.createTaskbarTabPreview(docShell, controller); let tabP = taskbar.createTaskbarTabPreview(docShell, controller);
isnot(tabP, null, "Tab preview is not null"); isnot(tabP, null, "Tab preview is not null");
is(tabP.controller.wrappedJSObject, controller, "Controllers match"); is(tabP.controller.wrappedJSObject, controller, "Controllers match");
is(tabP.icon, null, "Default icon is null (windows default)");
tabP.icon = null; tabP.icon = null;
tabP.move(null); tabP.move(null);
try { try {