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

Unified Diff: third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.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/ClearStorageView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js b/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js
index e038177e518b3a1453e0ad953d7f13d1b387123a..e8a247add20ee360802a994d4b96b3dd23264941 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js
@@ -42,7 +42,7 @@ WebInspector.ClearStorageView = function(resourcesPanel)
this._appendItem(caches, WebInspector.UIString("Cache storage"), "cache_storage");
this._appendItem(caches, WebInspector.UIString("Application cache"), "appcache");
- WebInspector.targetManager.observeTargets(this);
+ WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capability.Browser);
var footer = this._reportView.appendSection("", "clear-storage-button").appendRow();
this._clearButton = createTextButton(WebInspector.UIString("Clear site data"), this._clear.bind(this), WebInspector.UIString("Clear site data"));
footer.appendChild(this._clearButton);
@@ -70,17 +70,18 @@ WebInspector.ClearStorageView.prototype = {
if (this._target)
return;
this._target = target;
- this._updateOrigin(target.resourceTreeModel.mainFrame ? target.resourceTreeModel.mainFrame.url : "");
- WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.MainFrameNavigated, this._updateFrame, this);
+ var securityOriginManager = WebInspector.SecurityOriginManager.fromTarget(target);
+ this._updateOrigin(securityOriginManager.mainSecurityOrigin());
+ securityOriginManager.addEventListener(WebInspector.SecurityOriginManager.EventTypes.MainSecurityOriginChanged, this._originChanged, this);
},
/**
* @param {!WebInspector.Event} event
*/
- _updateFrame: function(event)
+ _originChanged: function(event)
{
- var frame = /** *@type {!WebInspector.ResourceTreeFrame} */ (event.data);
- this._updateOrigin(frame.url);
+ var origin = /** *@type {string} */ (event.data);
+ this._updateOrigin(origin);
},
/**
@@ -131,11 +132,9 @@ WebInspector.ClearStorageView.prototype = {
if (set.has(StorageAgent.StorageType.Cache_storage) || hasAll) {
var target = WebInspector.targetManager.mainTarget();
- if (target) {
- var model = WebInspector.ServiceWorkerCacheModel.fromTarget(target);
- if (model)
- model.clearForOrigin(this._securityOrigin);
- }
+ var model = target && WebInspector.ServiceWorkerCacheModel.fromTarget(target);
+ if (model)
+ model.clearForOrigin(this._securityOrigin);
}
if (set.has(StorageAgent.StorageType.Appcache) || hasAll) {

Powered by Google App Engine
This is Rietveld 408576698