From 4632404cfd35a3633a3d7aef9868286c0c27ec63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Thu, 12 Nov 2009 11:23:26 +0100 Subject: [PATCH] Bug 483382 - browser_480148.js causes browser_420786.js to fail --- .../sessionstore/test/browser/Makefile.in | 2 +- .../components/shell/test/browser_420786.js | 34 +++++-------------- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/browser/components/sessionstore/test/browser/Makefile.in b/browser/components/sessionstore/test/browser/Makefile.in index 0dcce183f011..7596f0294177 100644 --- a/browser/components/sessionstore/test/browser/Makefile.in +++ b/browser/components/sessionstore/test/browser/Makefile.in @@ -46,7 +46,6 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk # browser_477657.js is disabled, because it's unreliable (bug 482975). -# browser_480148.js is disabled, because it breaks browser_420786.js (see bug 483382). _BROWSER_TEST_FILES = \ browser_248970_a.js \ @@ -97,6 +96,7 @@ _BROWSER_TEST_FILES = \ browser_466937_sample.html \ browser_476161.js \ browser_476161_sample.html \ + browser_480148.js \ browser_480893.js \ browser_483330.js \ browser_485482.js \ diff --git a/browser/components/shell/test/browser_420786.js b/browser/components/shell/test/browser_420786.js index 93e7aba4e811..b0a519f9ec9c 100644 --- a/browser/components/shell/test/browser_420786.js +++ b/browser/components/shell/test/browser_420786.js @@ -1,22 +1,9 @@ -const Ci = Components.interfaces; -const Cc = Components.classes; - const DG_BACKGROUND = "/desktop/gnome/background" const DG_IMAGE_KEY = DG_BACKGROUND + "/picture_filename"; const DG_OPTION_KEY = DG_BACKGROUND + "/picture_options"; const DG_DRAW_BG_KEY = DG_BACKGROUND + "/draw_background"; -var testPage; - -function url(spec) { - var ios = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService); - return ios.newURI(spec, null, null); -} - function onPageLoad() { - testPage.events.removeListener("load", onPageLoad); - var bs = Cc["@mozilla.org/intl/stringbundle;1"]. getService(Ci.nsIStringBundleService); var brandName = bs.createBundle("chrome://branding/locale/brand.properties"). @@ -49,7 +36,7 @@ function onPageLoad() { var prevOptionKey = gconf.getString(DG_OPTION_KEY); var prevDrawBgKey = gconf.getBool(DG_DRAW_BG_KEY); - var image = testPage.document.getElementsByTagName("img")[0]; + var image = content.document.images[0]; function checkWallpaper(position, expectedGConfPosition) { shell.setDesktopBackground(image, position); @@ -72,10 +59,10 @@ function onPageLoad() { gconf.setBool(DG_DRAW_BG_KEY, prevDrawBgKey); wpFile.remove(false); - if (wpFileBackup.exists()) { - wpFileBackup.moveTo(null, wpFile.leafName); - } - testPage.close(); + if (wpFileBackup.exists()) + wpFileBackup.moveTo(null, wpFile.leafName); + + gBrowser.removeCurrentTab(); finish(); } @@ -84,15 +71,12 @@ function test() { getService(Ci.nsIXULRuntime).OS; // This test is Linux specific for now - if (osString != "Linux") { - finish(); + if (osString != "Linux") return; - } - testPage = Application.activeWindow.open(url("about:blank")); - testPage.events.addListener("load", onPageLoad); - testPage.load(url("about:logo")); - testPage.focus(); + gBrowser.selectedTab = gBrowser.addTab(); + gBrowser.selectedBrowser.addEventListener("load", onPageLoad, true); + content.location = "about:logo"; waitForExplicitFinish(); }