зеркало из https://github.com/mozilla/gecko-dev.git
Bug 606076: XUL fastload is not cleared when new extensions are installed. r=bsmedberg, a=blocks-beta7
This commit is contained in:
Родитель
cbcb299a21
Коммит
0a4711f5ce
|
@ -145,6 +145,7 @@ NS_NewXULPrototypeCache(nsISupports* aOuter, REFNSIID aIID, void** aResult)
|
||||||
nsXULPrototypeCache *p = result;
|
nsXULPrototypeCache *p = result;
|
||||||
obsSvc->AddObserver(p, "chrome-flush-skin-caches", PR_FALSE);
|
obsSvc->AddObserver(p, "chrome-flush-skin-caches", PR_FALSE);
|
||||||
obsSvc->AddObserver(p, "chrome-flush-caches", PR_FALSE);
|
obsSvc->AddObserver(p, "chrome-flush-caches", PR_FALSE);
|
||||||
|
obsSvc->AddObserver(p, "startupcache-invalidate", PR_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -410,10 +411,6 @@ nsXULPrototypeCache::AbortFastLoads()
|
||||||
NS_BREAK();
|
NS_BREAK();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Save a strong ref to the FastLoad file, so we can remove it after we
|
|
||||||
// close open streams to it.
|
|
||||||
nsCOMPtr<nsIFile> file = gFastLoadFile;
|
|
||||||
|
|
||||||
// Flush the XUL cache for good measure, in case we cached a bogus/downrev
|
// Flush the XUL cache for good measure, in case we cached a bogus/downrev
|
||||||
// script, somehow.
|
// script, somehow.
|
||||||
Flush();
|
Flush();
|
||||||
|
@ -421,21 +418,34 @@ nsXULPrototypeCache::AbortFastLoads()
|
||||||
// Clear the FastLoad set
|
// Clear the FastLoad set
|
||||||
mFastLoadURITable.Clear();
|
mFastLoadURITable.Clear();
|
||||||
|
|
||||||
if (! gFastLoadService)
|
nsCOMPtr<nsIFastLoadService> fastLoadService = gFastLoadService;
|
||||||
|
nsCOMPtr<nsIFile> file = gFastLoadFile;
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
if (! fastLoadService) {
|
||||||
|
fastLoadService = do_GetFastLoadService();
|
||||||
|
if (! fastLoadService)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
rv = fastLoadService->NewFastLoadFile(XUL_FASTLOAD_FILE_BASENAME,
|
||||||
|
getter_AddRefs(file));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch the current input (if FastLoad file existed) or output (if we're
|
// Fetch the current input (if FastLoad file existed) or output (if we're
|
||||||
// creating the FastLoad file during this app startup) stream.
|
// creating the FastLoad file during this app startup) stream.
|
||||||
nsCOMPtr<nsIObjectInputStream> objectInput;
|
nsCOMPtr<nsIObjectInputStream> objectInput;
|
||||||
nsCOMPtr<nsIObjectOutputStream> objectOutput;
|
nsCOMPtr<nsIObjectOutputStream> objectOutput;
|
||||||
gFastLoadService->GetInputStream(getter_AddRefs(objectInput));
|
fastLoadService->GetInputStream(getter_AddRefs(objectInput));
|
||||||
gFastLoadService->GetOutputStream(getter_AddRefs(objectOutput));
|
fastLoadService->GetOutputStream(getter_AddRefs(objectOutput));
|
||||||
|
|
||||||
if (objectOutput) {
|
if (objectOutput) {
|
||||||
gFastLoadService->SetOutputStream(nsnull);
|
fastLoadService->SetOutputStream(nsnull);
|
||||||
|
|
||||||
if (NS_SUCCEEDED(objectOutput->Close()) && gChecksumXULFastLoadFile)
|
if (NS_SUCCEEDED(objectOutput->Close()) && gChecksumXULFastLoadFile)
|
||||||
gFastLoadService->CacheChecksum(gFastLoadFile,
|
fastLoadService->CacheChecksum(file,
|
||||||
objectOutput);
|
objectOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +453,7 @@ nsXULPrototypeCache::AbortFastLoads()
|
||||||
// If this is the last of one or more XUL master documents loaded
|
// If this is the last of one or more XUL master documents loaded
|
||||||
// together at app startup, close the FastLoad service's singleton
|
// together at app startup, close the FastLoad service's singleton
|
||||||
// input stream now.
|
// input stream now.
|
||||||
gFastLoadService->SetInputStream(nsnull);
|
fastLoadService->SetInputStream(nsnull);
|
||||||
objectInput->Close();
|
objectInput->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,13 +472,15 @@ nsXULPrototypeCache::AbortFastLoads()
|
||||||
}
|
}
|
||||||
file->MoveToNative(nsnull, NS_LITERAL_CSTRING("Aborted.mfasl"));
|
file->MoveToNative(nsnull, NS_LITERAL_CSTRING("Aborted.mfasl"));
|
||||||
#else
|
#else
|
||||||
file->Remove(PR_FALSE);
|
rv = file->Remove(PR_FALSE);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
NS_WARNING("Failed to remove fastload file, fastload data may be outdated");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the list is empty now, the FastLoad process is done.
|
// If the list is empty now, the FastLoad process is done.
|
||||||
NS_RELEASE(gFastLoadService);
|
NS_IF_RELEASE(gFastLoadService);
|
||||||
NS_RELEASE(gFastLoadFile);
|
NS_IF_RELEASE(gFastLoadFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,10 @@ const Ci = Components.interfaces;
|
||||||
const extDir = gProfD.clone();
|
const extDir = gProfD.clone();
|
||||||
extDir.append("extensions");
|
extDir.append("extensions");
|
||||||
|
|
||||||
|
var gFastLoadService = AM_Cc["@mozilla.org/fast-load-service;1"].
|
||||||
|
getService(AM_Ci.nsIFastLoadService);
|
||||||
|
var gFastLoadFile = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the test by installing extensions.
|
* Start the test by installing extensions.
|
||||||
*/
|
*/
|
||||||
|
@ -27,10 +31,19 @@ function run_test() {
|
||||||
}
|
}
|
||||||
}, "startupcache-invalidate", false);
|
}, "startupcache-invalidate", false);
|
||||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
|
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
|
||||||
|
|
||||||
|
gFastLoadFile = gFastLoadService.newFastLoadFile("XUL");
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
startupManager();
|
startupManager();
|
||||||
|
// nsAppRunner takes care of clearing this when a new app is installed
|
||||||
|
do_check_true(gFastLoadFile.exists());
|
||||||
|
|
||||||
installAllFiles([do_get_addon("test_bug594058")], function() {
|
installAllFiles([do_get_addon("test_bug594058")], function() {
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
do_check_true(cachePurged);
|
do_check_true(cachePurged);
|
||||||
cachePurged = false;
|
cachePurged = false;
|
||||||
|
|
||||||
|
@ -47,15 +60,20 @@ function run_test() {
|
||||||
otherFile.lastModifiedTime = pastTime;
|
otherFile.lastModifiedTime = pastTime;
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
cachePurged = false;
|
cachePurged = false;
|
||||||
|
|
||||||
otherFile.lastModifiedTime = pastTime + 5000;
|
otherFile.lastModifiedTime = pastTime + 5000;
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
do_check_true(cachePurged);
|
do_check_true(cachePurged);
|
||||||
cachePurged = false;
|
cachePurged = false;
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
do_check_true(!cachePurged);
|
do_check_true(gFastLoadFile.exists());
|
||||||
|
do_check_false(cachePurged);
|
||||||
|
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
});
|
});
|
||||||
|
|
|
@ -85,11 +85,19 @@ registerDirectory("XREUSysExt", userDir.parent);
|
||||||
const profileDir = gProfD.clone();
|
const profileDir = gProfD.clone();
|
||||||
profileDir.append("extensions");
|
profileDir.append("extensions");
|
||||||
|
|
||||||
|
var gFastLoadService = AM_Cc["@mozilla.org/fast-load-service;1"].
|
||||||
|
getService(AM_Ci.nsIFastLoadService);
|
||||||
|
var gFastLoadFile = null;
|
||||||
|
|
||||||
// Set up the profile
|
// Set up the profile
|
||||||
function run_test() {
|
function run_test() {
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
startupManager();
|
startupManager();
|
||||||
|
|
||||||
|
gFastLoadFile = gFastLoadService.newFastLoadFile("XUL");
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||||
"addon2@tests.mozilla.org",
|
"addon2@tests.mozilla.org",
|
||||||
"addon3@tests.mozilla.org",
|
"addon3@tests.mozilla.org",
|
||||||
|
@ -127,6 +135,9 @@ function run_test_1() {
|
||||||
writeInstallRDFForExtension(addon5, profileDir);
|
writeInstallRDFForExtension(addon5, profileDir);
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||||
"addon2@tests.mozilla.org",
|
"addon2@tests.mozilla.org",
|
||||||
"addon3@tests.mozilla.org",
|
"addon3@tests.mozilla.org",
|
||||||
|
@ -203,6 +214,8 @@ function run_test_2() {
|
||||||
dest.remove(true);
|
dest.remove(true);
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||||
"addon2@tests.mozilla.org",
|
"addon2@tests.mozilla.org",
|
||||||
|
@ -257,6 +270,8 @@ function run_test_3() {
|
||||||
writeInstallRDFForExtension(addon3, profileDir, "addon4@tests.mozilla.org");
|
writeInstallRDFForExtension(addon3, profileDir, "addon4@tests.mozilla.org");
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||||
"addon2@tests.mozilla.org",
|
"addon2@tests.mozilla.org",
|
||||||
|
@ -308,6 +323,8 @@ function run_test_4() {
|
||||||
Services.prefs.setIntPref("extensions.enabledScopes", AddonManager.SCOPE_SYSTEM);
|
Services.prefs.setIntPref("extensions.enabledScopes", AddonManager.SCOPE_SYSTEM);
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||||
"addon2@tests.mozilla.org",
|
"addon2@tests.mozilla.org",
|
||||||
|
@ -340,6 +357,8 @@ function run_test_5() {
|
||||||
Services.prefs.setIntPref("extensions.enabledScopes", AddonManager.SCOPE_USER);
|
Services.prefs.setIntPref("extensions.enabledScopes", AddonManager.SCOPE_USER);
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||||
"addon2@tests.mozilla.org",
|
"addon2@tests.mozilla.org",
|
||||||
|
@ -378,6 +397,8 @@ function run_test_6() {
|
||||||
Services.prefs.clearUserPref("extensions.enabledScopes");
|
Services.prefs.clearUserPref("extensions.enabledScopes");
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||||
"addon2@tests.mozilla.org",
|
"addon2@tests.mozilla.org",
|
||||||
|
@ -420,6 +441,8 @@ function run_test_7() {
|
||||||
dest.remove(true);
|
dest.remove(true);
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||||
"addon2@tests.mozilla.org",
|
"addon2@tests.mozilla.org",
|
||||||
|
@ -467,6 +490,8 @@ function run_test_8() {
|
||||||
Services.prefs.setIntPref("extensions.enabledScopes", 0);
|
Services.prefs.setIntPref("extensions.enabledScopes", 0);
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||||
"addon2@tests.mozilla.org",
|
"addon2@tests.mozilla.org",
|
||||||
|
@ -508,6 +533,8 @@ function run_test_9() {
|
||||||
writeInstallRDFForExtension(addon2, profileDir);
|
writeInstallRDFForExtension(addon2, profileDir);
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||||
"addon2@tests.mozilla.org",
|
"addon2@tests.mozilla.org",
|
||||||
|
@ -558,6 +585,8 @@ function run_test_10() {
|
||||||
writeInstallRDFForExtension(addon1, userDir);
|
writeInstallRDFForExtension(addon1, userDir);
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||||
"addon2@tests.mozilla.org",
|
"addon2@tests.mozilla.org",
|
||||||
|
@ -608,6 +637,8 @@ function run_test_11() {
|
||||||
dest.remove(true);
|
dest.remove(true);
|
||||||
|
|
||||||
restartManager();
|
restartManager();
|
||||||
|
do_check_false(gFastLoadFile.exists());
|
||||||
|
gFastLoadFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||||
"addon2@tests.mozilla.org",
|
"addon2@tests.mozilla.org",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче