Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(783)

Unified Diff: third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js

Issue 2569683003: DevTools: remove deleted registrations from the SW list if a newer version is available. (Closed)
Patch Set: test fixed Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
index c7ca87715f4f6514eb034f2129f7dacf6312b15f..cd965e0cc9d3a915870dab1f4e24e79d951fe153 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
@@ -95,6 +95,30 @@ Resources.ServiceWorkersView = class extends UI.VBox {
_registrationUpdated(event) {
var registration = /** @type {!SDK.ServiceWorkerRegistration} */ (event.data);
this._updateRegistration(registration);
+ this._gcRegistrations();
+ }
+
+ _gcRegistrations() {
+ var hasNonDeletedRegistrations = false;
+ var securityOrigins = new Set(this._securityOriginManager.securityOrigins());
+ for (var registration of this._manager.registrations().values()) {
+ var visible = this._showAllCheckbox.checked() || securityOrigins.has(registration.securityOrigin);
+ if (!visible)
+ continue;
+ if (!registration.canBeRemoved()) {
+ hasNonDeletedRegistrations = true;
+ break;
+ }
+ }
+
+ if (!hasNonDeletedRegistrations)
+ return;
+
+ for (var registration of this._manager.registrations().values()) {
+ var visible = this._showAllCheckbox.checked() || securityOrigins.has(registration.securityOrigin);
+ if (visible && registration.canBeRemoved())
+ this._removeRegistrationFromList(registration);
+ }
}
/**
@@ -128,6 +152,13 @@ Resources.ServiceWorkersView = class extends UI.VBox {
*/
_registrationDeleted(event) {
var registration = /** @type {!SDK.ServiceWorkerRegistration} */ (event.data);
+ this._removeRegistrationFromList(registration);
+ }
+
+ /**
+ * @param {!SDK.ServiceWorkerRegistration} registration
+ */
+ _removeRegistrationFromList(registration) {
var section = this._sections.get(registration);
if (section)
section._section.remove();
@@ -418,10 +449,4 @@ Resources.ServiceWorkersView.Section = class {
shadowRoot.appendChild(contentElement);
return contentElement;
}
-
- _dispose() {
- this._linkifier.dispose();
- if (this._pendingUpdate)
- clearTimeout(this._pendingUpdate);
- }
};

Powered by Google App Engine
This is Rietveld 408576698