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

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

Issue 1862123004: DevTools: display recent SW revisions on top of the list, remove stale redundant ones. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1480638e9f2558a77c14e2bb4396f1b3d4d5f4dc..89806df53dda0d658c61230ddf3096e5c4aefc43 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
@@ -314,9 +314,21 @@ WebInspector.SWRegistrationWidget.prototype = {
/** @type {!Map<string, !WebInspector.SWVersionWidget>} */
var versionWidgets = new Map();
- var modesWithVersions = new Set();
+ // Remove all the redundant workers that are older than the
+ // active version.
+ var versions = registration.versions.valuesArray();
+ var activeVersion = versions.find(version => version.mode() === WebInspector.ServiceWorkerVersion.Modes.Active);
+ if (activeVersion) {
+ versions = versions.filter(version => {
+ if (version.mode() == WebInspector.ServiceWorkerVersion.Modes.Redundant)
+ return version.scriptLastModified > activeVersion.scriptLastModified;
+ return true;
+ });
+ }
+
var firstMode;
- for (var version of registration.versions.valuesArray()) {
+ var modesWithVersions = new Set();
+ for (var version of versions) {
if (version.isStoppedAndRedundant() && !version.errorMessages.length)
continue;
var mode = version.mode();
@@ -329,7 +341,7 @@ WebInspector.SWRegistrationWidget.prototype = {
versionWidget._updateVersion(version);
else
versionWidget = new WebInspector.SWVersionWidget(this._manager, this._registration.scopeURL, version);
- versionWidget.show(view.element);
+ versionWidget.show(view.element, view.element.firstElementChild);
versionWidgets.set(version.id, versionWidget);
}
for (var id of this._versionWidgets.keys()) {
@@ -347,7 +359,7 @@ WebInspector.SWRegistrationWidget.prototype = {
this._tabbedPane.selectTab(this._lastManuallySelectedTab);
return;
}
- if (modesWithVersions.has(WebInspector.ServiceWorkerVersion.Modes.Active)) {
+ if (activeVersion) {
this._tabbedPane.selectTab(WebInspector.ServiceWorkerVersion.Modes.Active);
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698