Compare commits

...
3 changed files with 74 additions and 1 deletions

No files matched your search

@@ -249,6 +249,39 @@ ConsoleOutput.prototype = {
return message.render().element;
},
/**
* Clear the netRequests Map in this.owner.window.
* Items of NetRequest() in chrome/devtools/modules/devtools/client/webconsole/net/net-request.js
* netRequest.file holds response
* netRequest.parentNode holds div above bodyWrapper here in console-output.js
*/
onConsoleClear: function() {
let netRequests = this.owner.?window.?netRequests;
let toClear = [];
if(netRequests && netRequests.forEach){
// Build list of items to clear
netRequests.forEach(
function(netReq,key){
if (netReq.parentNode && !netReq.parentNode.parentNode) {
// DOM node was removed from the browser console output, but still referenced...
toClear.push({netReq:netReq,
key:key});
}
});
// ... and clean them up
toClear.forEach(
function(item){
let netReq = item.netReq, key = item.key;
let file = netReq.file || {};
netReq.parentNode = file.node = null;
file.request = file.response = file.cause = file.updates = null;
netReq.client = netReq.owner = netReq.file = null;
item.netReq = null;
netRequests.delete(key);
});
}
},
/**
* Get an array of selected messages. This list is based on the text selection
* start and end points.
+4
View File
@@ -960,6 +960,10 @@ JSTerm.prototype = {
hud.newConsoleOutput.dispatchMessagesClear();
}
if(hud.output && hud.output.onConsoleClear) {
hud.output.onConsoleClear();
}
this.emit("messages-cleared");
},
+37 -1
View File
@@ -309,7 +309,7 @@ WebConsoleActor.prototype =
actorPrefix: "console",
get globalDebugObject() {
return this.parentActor.threadActor.globalDebugObject;
return this.parentActor?.threadActor?.globalDebugObject;
},
grip: function WCA_grip()
@@ -1071,6 +1071,42 @@ WebConsoleActor.prototype =
ConsoleAPIStorage.clearEvents(aId);
});
if (this._actorPool && this.networkMonitor) {
// Clear NetworkEventActor items from its NetworkMonitor
let actor, aid, n;
let allActors = this._actorPool._actors;
let voidActor = {actorID:0,
release:function(){},
stub:true};
// Build list of NetworkEventActors
let netActors = [];
for (n in allActors) {
if (n.indexOf('netEvent')>=0) {
netActors.push(allActors[n]);
}
}
// ... and release them.
for (actor of netActors) {
if(actor) {
if (actor.release) {
actor.release();
}
}
}
// XXX: Sometimes the actors are not removed upon calling release() (async?)
// Force the issue by unlinking the actor from active scripting and deleting.
for (actor of netActors) {
if(actor) {
aid = actor.actorID;
if (aid && allActors[aid]) {
allActors[aid] = voidActor;
delete allActors[aid];
}
}
}
}
if (this.parentActor.isRootActor) {
Services.console.logStringMessage(null); // for the Error Console
Services.console.reset();