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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/SecurityOriginManager.js

Issue 2610963005: [DevTools] Pass the frame payload (Closed)
Patch Set: [DevTools] Pass the frame payload Created 3 years, 11 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 | « third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js ('k') | 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/sdk/SecurityOriginManager.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/SecurityOriginManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/SecurityOriginManager.js
index 2b0b903fa3fe02e5b361a455438be235710cca3b..0c579c057fed8a198fdf388d79318f5058dea21f 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/SecurityOriginManager.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/SecurityOriginManager.js
@@ -11,7 +11,8 @@ SDK.SecurityOriginManager = class extends SDK.SDKModel {
constructor(target) {
super(SDK.SecurityOriginManager, target);
- this._securityOriginCounter = new Map();
+ /** @type {!Set<string>} */
+ this._securityOrigins = new Set();
this._mainSecurityOrigin = '';
}
@@ -27,36 +28,28 @@ SDK.SecurityOriginManager = class extends SDK.SDKModel {
}
/**
- * @param {string} securityOrigin
+ * @param {!Set<string>} securityOrigins
*/
- addSecurityOrigin(securityOrigin) {
- var currentCount = this._securityOriginCounter.get(securityOrigin);
- if (!currentCount) {
- this._securityOriginCounter.set(securityOrigin, 1);
- this.dispatchEventToListeners(SDK.SecurityOriginManager.Events.SecurityOriginAdded, securityOrigin);
- return;
+ updateSecurityOrigins(securityOrigins) {
+ var oldOrigins = this._securityOrigins;
+ this._securityOrigins = securityOrigins;
+
+ for (var origin of oldOrigins) {
+ if (!this._securityOrigins.has(origin))
+ this.dispatchEventToListeners(SDK.SecurityOriginManager.Events.SecurityOriginRemoved, origin);
}
- this._securityOriginCounter.set(securityOrigin, currentCount + 1);
- }
- /**
- * @param {string} securityOrigin
- */
- removeSecurityOrigin(securityOrigin) {
- var currentCount = this._securityOriginCounter.get(securityOrigin);
- if (currentCount === 1) {
- this._securityOriginCounter.delete(securityOrigin);
- this.dispatchEventToListeners(SDK.SecurityOriginManager.Events.SecurityOriginRemoved, securityOrigin);
- return;
+ for (var origin of this._securityOrigins) {
+ if (!oldOrigins.has(origin))
+ this.dispatchEventToListeners(SDK.SecurityOriginManager.Events.SecurityOriginAdded, origin);
}
- this._securityOriginCounter.set(securityOrigin, currentCount - 1);
}
/**
* @return {!Array<string>}
*/
securityOrigins() {
- return this._securityOriginCounter.keysArray();
+ return this._securityOrigins.valuesArray();
}
/**
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698