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

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

Issue 2172753002: [DevTools] No longer store security origins in ResourceTreeModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test failures Created 4 years, 5 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
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 74c4c81cb0a376027199fd532f67d6ee649b4668..909354737c9ccc502ccb5a8a436adcec1d8826a7 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
@@ -29,15 +29,16 @@ WebInspector.ServiceWorkersView.prototype = {
*/
targetAdded: function(target)
{
- if (this._target || !target.serviceWorkerManager)
+ var securityOriginManager = WebInspector.SecurityOriginManager.fromTarget(target);
+ if (this._manager || !target.serviceWorkerManager || !securityOriginManager)
return;
- this._target = target;
- this._manager = this._target.serviceWorkerManager;
+ this._manager = target.serviceWorkerManager;
+ this._securityOriginManager = securityOriginManager;
this._toolbar.appendToolbarItem(WebInspector.NetworkConditionsSelector.createOfflineToolbarCheckbox());
var forceUpdate = new WebInspector.ToolbarCheckbox(WebInspector.UIString("Update on reload"), WebInspector.UIString("Force update Service Worker on page reload"), this._manager.forceUpdateOnReloadSetting());
this._toolbar.appendToolbarItem(forceUpdate);
- var networkManager = this._target && WebInspector.NetworkManager.fromTarget(this._target);
+ var networkManager = target && WebInspector.NetworkManager.fromTarget(target);
if (networkManager) {
var fallbackToNetwork = new WebInspector.ToolbarCheckbox(WebInspector.UIString("Bypass for network"), WebInspector.UIString("Bypass Service Worker and load resources from the network"), networkManager.bypassServiceWorkerSetting());
this._toolbar.appendToolbarItem(fallbackToNetwork);
@@ -53,8 +54,8 @@ WebInspector.ServiceWorkersView.prototype = {
this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.RegistrationUpdated, this._registrationUpdated, this);
this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.RegistrationDeleted, this._registrationDeleted, this);
this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.RegistrationErrorAdded, this._registrationErrorAdded, this);
- this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded, this._updateSectionVisibility, this);
- this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved, this._updateSectionVisibility, this);
+ securityOriginManager.addEventListener(WebInspector.SecurityOriginManager.EventTypes.SecurityOriginAdded, this._updateSectionVisibility, this);
+ securityOriginManager.addEventListener(WebInspector.SecurityOriginManager.EventTypes.SecurityOriginRemoved, this._updateSectionVisibility, this);
},
/**
@@ -63,14 +64,15 @@ WebInspector.ServiceWorkersView.prototype = {
*/
targetRemoved: function(target)
{
- if (target !== this._target)
+ if (this._manager !== target.serviceWorkerManager)
return;
- delete this._target;
+ this._manager = null;
+ this._securityOriginManager = null;
},
_updateSectionVisibility: function()
{
- var securityOrigins = new Set(this._target.resourceTreeModel.securityOrigins());
+ var securityOrigins = new Set(this._securityOriginManager.securityOrigins());
for (var section of this._sections.values()) {
var visible = this._showAllCheckbox.checked() || securityOrigins.has(section._registration.securityOrigin);
section._section.element.classList.toggle("hidden", !visible);

Powered by Google App Engine
This is Rietveld 408576698