Bug 1440073 - Clear images from cache to fix --verify testing of browser_no_mcb_for_loopback.js r?johannh
MozReview-Commit-ID: 4z8aJizVUNm
--- a/browser/base/content/test/siteIdentity/browser_no_mcb_for_loopback.js
+++ b/browser/base/content/test/siteIdentity/browser_no_mcb_for_loopback.js
@@ -19,17 +19,26 @@ if (!gMultiProcessBrowser) {
const TEST_URL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com") + "test_no_mcb_for_loopback.html";
const LOOPBACK_PNG_URL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://127.0.0.1:8888") + "moz.png";
const PREF_BLOCK_DISPLAY = "security.mixed_content.block_display_content";
const PREF_UPGRADE_DISPLAY = "security.mixed_content.upgrade_display_content";
const PREF_BLOCK_ACTIVE = "security.mixed_content.block_active_content";
+function clearAllImageCaches() {
+ let tools = Cc["@mozilla.org/image/tools;1"]
+ .getService(Ci.imgITools);
+ let imageCache = tools.getImgCacheForDocument(window.document);
+ imageCache.clearCache(true); // true=chrome
+ imageCache.clearCache(false); // false=content
+}
+
registerCleanupFunction(function() {
+ clearAllImageCaches();
Services.prefs.clearUserPref(PREF_BLOCK_DISPLAY);
Services.prefs.clearUserPref(PREF_UPGRADE_DISPLAY);
Services.prefs.clearUserPref(PREF_BLOCK_ACTIVE);
gBrowser.removeCurrentTab();
});
add_task(async function allowLoopbackMixedContent() {
Services.prefs.setBoolPref(PREF_BLOCK_DISPLAY, true);