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

Unified Diff: third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js

Issue 2832943002: DevTools: properly handle target suspension/resuming in NetworkProject (Closed)
Patch Set: address comments Created 3 years, 7 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/bindings/NetworkProject.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js b/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
index dba062ec9473e60be4f4b0351c4ec01b2d2bb9ab..a42cc1107c16896982d8c5d4558dd8802e9b44bd 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
@@ -88,12 +88,16 @@ Bindings.NetworkProject = class {
}
this._debuggerModel = target.model(SDK.DebuggerModel);
+ /** @type {!Set<!SDK.Script>} */
+ this._acceptedScripts = new Set();
if (this._debuggerModel) {
var runtimeModel = this._debuggerModel.runtimeModel();
this._eventListeners.push(
runtimeModel.addEventListener(
SDK.RuntimeModel.Events.ExecutionContextDestroyed, this._executionContextDestroyed, this),
this._debuggerModel.addEventListener(
+ SDK.DebuggerModel.Events.GlobalObjectCleared, this._globalObjectCleared, this),
+ this._debuggerModel.addEventListener(
SDK.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this),
this._debuggerModel.addEventListener(
SDK.DebuggerModel.Events.FailedToParseScriptSource, this._parsedScriptSource, this));
@@ -281,6 +285,7 @@ Bindings.NetworkProject = class {
var script = /** @type {!SDK.Script} */ (event.data);
if (!this._acceptsScript(script))
return;
+ this._acceptedScripts.add(script);
var originalContentProvider = script.originalContentProvider();
var frameId = Bindings.frameIdForScript(script);
script[Bindings.NetworkProject._frameIdSymbol] = frameId;
@@ -296,15 +301,30 @@ Bindings.NetworkProject = class {
_executionContextDestroyed(event) {
var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data);
var scripts = this._debuggerModel.scriptsForExecutionContext(executionContext);
+ this._removeScripts(scripts);
+ }
+
+ /**
+ * @param {!Array<!SDK.Script>} scripts
+ */
+ _removeScripts(scripts) {
for (var script of scripts) {
- if (!this._acceptsScript(script))
+ if (!this._acceptedScripts.has(script))
continue;
+ this._acceptedScripts.delete(script);
var frameId = script[Bindings.NetworkProject._frameIdSymbol];
this._removeFileForURL(script.contentURL(), frameId, script.isContentScript());
}
}
/**
+ * @param {!Common.Event} event
+ */
+ _globalObjectCleared(event) {
+ this._removeScripts(Array.from(this._acceptedScripts));
+ }
+
+ /**
* @param {!SDK.CSSStyleSheetHeader} header
*/
_acceptsHeader(header) {

Powered by Google App Engine
This is Rietveld 408576698