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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/DOMStorageModel.js

Issue 2122353002: [DevTools] Make resource tree model optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Nokia Inc. All rights reserved. 2 * Copyright (C) 2008 Nokia Inc. All rights reserved.
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 DOMStorageRemoved: "DOMStorageRemoved" 125 DOMStorageRemoved: "DOMStorageRemoved"
126 } 126 }
127 127
128 WebInspector.DOMStorageModel.prototype = { 128 WebInspector.DOMStorageModel.prototype = {
129 enable: function() 129 enable: function()
130 { 130 {
131 if (this._enabled) 131 if (this._enabled)
132 return; 132 return;
133 133
134 this.target().registerDOMStorageDispatcher(new WebInspector.DOMStorageDi spatcher(this)); 134 this.target().registerDOMStorageDispatcher(new WebInspector.DOMStorageDi spatcher(this));
135 this.target().resourceTreeModel.addEventListener(WebInspector.ResourceTr eeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this); 135 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(this.t arget());
136 this.target().resourceTreeModel.addEventListener(WebInspector.ResourceTr eeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this); 136 if (resourceTreeModel) {
137 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Ev entTypes.SecurityOriginAdded, this._securityOriginAdded, this);
138 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Ev entTypes.SecurityOriginRemoved, this._securityOriginRemoved, this);
139
140 var securityOrigins = resourceTreeModel.securityOrigins();
dgozman 2016/07/14 16:29:28 Looks like this model doesn't function without sec
eostroukhov-old 2016/07/20 23:46:15 Done.
141 for (var i = 0; i < securityOrigins.length; ++i)
142 this._addOrigin(securityOrigins[i]);
143 }
137 this._agent.enable(); 144 this._agent.enable();
138 145
139 var securityOrigins = this.target().resourceTreeModel.securityOrigins();
140 for (var i = 0; i < securityOrigins.length; ++i)
141 this._addOrigin(securityOrigins[i]);
142
143 this._enabled = true; 146 this._enabled = true;
144 }, 147 },
145 148
146 /** 149 /**
147 * @param {string} origin 150 * @param {string} origin
148 */ 151 */
149 clearForOrigin: function(origin) 152 clearForOrigin: function(origin)
150 { 153 {
151 if (!this._enabled) 154 if (!this._enabled)
152 return; 155 return;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 * @param {!WebInspector.Target} target 360 * @param {!WebInspector.Target} target
358 * @return {!WebInspector.DOMStorageModel} 361 * @return {!WebInspector.DOMStorageModel}
359 */ 362 */
360 WebInspector.DOMStorageModel.fromTarget = function(target) 363 WebInspector.DOMStorageModel.fromTarget = function(target)
361 { 364 {
362 if (!target[WebInspector.DOMStorageModel._symbol]) 365 if (!target[WebInspector.DOMStorageModel._symbol])
363 target[WebInspector.DOMStorageModel._symbol] = new WebInspector.DOMStora geModel(target); 366 target[WebInspector.DOMStorageModel._symbol] = new WebInspector.DOMStora geModel(target);
364 367
365 return target[WebInspector.DOMStorageModel._symbol]; 368 return target[WebInspector.DOMStorageModel._symbol];
366 } 369 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698