Bug 1352459 - part2. Fix test failures. r?mak
MozReview-Commit-ID: KI59kcQWEyf
--- a/browser/base/content/test/general/browser_subframe_favicons_not_used.js
+++ b/browser/base/content/test/general/browser_subframe_favicons_not_used.js
@@ -4,15 +4,18 @@ function test() {
waitForExplicitFinish();
let testPath = getRootDirectory(gTestPath);
let tab = BrowserTestUtils.addTab(gBrowser, testPath + "file_bug970276_popup1.html");
tab.linkedBrowser.addEventListener("load", function() {
let expectedIcon = testPath + "file_bug970276_favicon1.ico";
- is(gBrowser.getIcon(tab), expectedIcon, "Correct icon.");
+ BrowserTestUtils.waitForCondition(() => true, "wait for loadFavicon to finish", 100)
+ .then(() => {
+ is(gBrowser.getIcon(tab), expectedIcon, "Correct icon.");
- gBrowser.removeTab(tab);
+ gBrowser.removeTab(tab);
- finish();
+ finish();
+ });
}, {capture: true, once: true});
}
--- a/browser/components/sessionstore/test/browser_attributes.js
+++ b/browser/components/sessionstore/test/browser_attributes.js
@@ -17,16 +17,18 @@ add_task(async function test() {
// Since we need to test 'activemedia-blocked' attribute.
Services.prefs.setBoolPref(PREF2, true)
registerCleanupFunction(() => Services.prefs.clearUserPref(PREF2));
// Add a new tab with a nice icon.
let tab = BrowserTestUtils.addTab(gBrowser, "about:robots");
await promiseBrowserLoaded(tab.linkedBrowser);
+ await BrowserTestUtils.waitForCondition(() => true,
+ "wait for loadFavicon to finish", 100);
// Check that the tab has 'image' and 'iconLoadingPrincipal' attributes.
ok(tab.hasAttribute("image"), "tab.image exists");
ok(tab.hasAttribute("iconLoadingPrincipal"), "tab.iconLoadingPrincipal exists");
tab.toggleMuteAudio();
// Check that the tab has a 'muted' attribute.
ok(tab.hasAttribute("muted"), "tab.muted exists");
--- a/browser/components/sessionstore/test/browser_label_and_icon.js
+++ b/browser/components/sessionstore/test/browser_label_and_icon.js
@@ -24,16 +24,18 @@ add_task(async function test_label_and_i
await promiseRemoveTab(tab);
browser = null;
// Open a new tab to restore into.
tab = BrowserTestUtils.addTab(gBrowser, "about:blank");
ss.setTabState(tab, state);
await promiseTabRestoring(tab);
+ await BrowserTestUtils.waitForCondition(() => true, "wait for loadFavicon to finish", 100);
+
// Check that label and icon are set for the restoring tab.
is(gBrowser.getIcon(tab), "chrome://browser/content/robot.ico", "icon is set");
is(tab.label, "Gort! Klaatu barada nikto!", "label is set");
let serhelper = Cc["@mozilla.org/network/serialization-helper;1"]
.getService(Ci.nsISerializationHelper);
let serializedPrincipal = tab.getAttribute("iconLoadingPrincipal");
let iconLoadingPrincipal = serhelper.deserializeObject(serializedPrincipal)
--- a/dom/security/test/general/test_bug1277803.xul
+++ b/dom/security/test/general/test_bug1277803.xul
@@ -15,16 +15,17 @@
</body>
<script type="application/javascript"><![CDATA[
SimpleTest.requestCompleteLog();
let Ci = Components.interfaces;
let Cc = Components.classes;
let Cu = Components.utils;
let makeURI = Cu.import("resource://gre/modules/BrowserUtils.jsm", {}).BrowserUtils.makeURI;
+ SpecialPowers.pushPrefEnv({set: [["about.newtab.preload", false]]});
const BASE_URI = "http://mochi.test:8888/chrome/dom/security/test/general/";
const FAVICON_URI = BASE_URI + "favicon_bug1277803.ico";
const LOADING_URI = BASE_URI + "bug1277803.html";
let testWindow; //will be used to trigger favicon load
let securityManager = Cc["@mozilla.org/scriptsecuritymanager;1"].
getService(Ci.nsIScriptSecurityManager);