Bug 1503072 - Correct ServiceWorker host-based cleanup. r=dom-worker-reviewers,edenchuang a=pascalc

ServiceWorkerCleanUp's host based cleaning has not correctly been
checking whether the provided host is a root domain of the ServiceWorker
registration, instead performing an exact match (which is what
removeFromPrincipal does).

This check makes the logic consistent with other deleteByHost
implementations and is actually using the same check logic.

Differential Revision: https://phabricator.services.mozilla.com/D111992
This commit is contained in:
Eden Chuang 2021-07-12 21:10:26 +00:00
parent 2d3c621c79
commit b7f57d1b77

View File

@ -58,7 +58,9 @@ function unregisterServiceWorkersMatching(filterFn) {
this.ServiceWorkerCleanUp = {
removeFromHost(aHost) {
return unregisterServiceWorkersMatching(sw => sw.principal.host == aHost);
return unregisterServiceWorkersMatching(sw =>
Services.eTLD.hasRootDomain(sw.principal.host, aHost)
);
},
removeFromBaseDomain(aBaseDomain) {