Bug 1047098 - "Clear Recent History" must clean up all the ServiceWorkers, r=bkelly

This commit is contained in:
Andrea Marchesini 2017-09-21 21:32:00 +02:00
Родитель c4d20beb84
Коммит ebcdb2c6b8
2 изменённых файлов: 12 добавлений и 1 удалений

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

@ -20,6 +20,9 @@ XPCOMUtils.defineLazyModuleGetters(this, {
});
XPCOMUtils.defineLazyServiceGetter(this, "serviceWorkerManager",
"@mozilla.org/serviceworkers/manager;1",
"nsIServiceWorkerManager");
XPCOMUtils.defineLazyServiceGetter(this, "quotaManagerService",
"@mozilla.org/dom/quota-manager-service;1",
"nsIQuotaManagerService");
@ -293,6 +296,14 @@ Sanitizer.prototype = {
// LocalStorage
Services.obs.notifyObservers(null, "extension:purge-localStorage");
// ServiceWorkers
let serviceWorkers = serviceWorkerManager.getAllRegistrations();
for (let i = 0; i < serviceWorkers.length; i++) {
let sw = serviceWorkers.queryElementAt(i, Ci.nsIServiceWorkerRegistrationInfo);
let host = sw.principal.URI.host;
serviceWorkerManager.removeAndPropagate(host);
}
// QuotaManager
let promises = [];
await new Promise(resolve => {

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

@ -75,7 +75,7 @@ XPCOMUtils.defineLazyGetter(this, "SMALLSVG_DATA_URI", function() {
var gTestDir = do_get_cwd();
// Initialize profile.
var gProfD = do_get_profile();
var gProfD = do_get_profile(true);
Services.prefs.setBoolPref("browser.urlbar.usepreloadedtopurls.enabled", false);
do_register_cleanup(() =>