1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #2163 from node-red-hitachi/fix-debug-node-memory-leak

Fix possible memory leak of debug sidebar output
This commit is contained in:
Nick O'Leary 2019-05-09 14:51:20 +01:00 committed by GitHub
commit 364175fa9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -400,48 +400,47 @@ RED.debug = (function() {
}
function processDebugMessage(o) {
var msg = document.createElement("div");
var msg = $("<div/>");
var sourceNode = o._source;
msg.onmouseenter = function() {
$(msg).addClass('debug-message-hover');
msg.on("mouseenter", function() {
msg.addClass('debug-message-hover');
if (o._source) {
config.messageMouseEnter(o._source.id);
if (o._source._alias) {
config.messageMouseEnter(o._source._alias);
}
}
};
msg.onmouseleave = function() {
$(msg).removeClass('debug-message-hover');
});
msg.on("mouseleave", function() {
msg.removeClass('debug-message-hover');
if (o._source) {
config.messageMouseLeave(o._source.id);
if (o._source._alias) {
config.messageMouseLeave(o._source._alias);
}
}
};
});
var name = sanitize(((o.name?o.name:o.id)||"").toString());
var topic = sanitize((o.topic||"").toString());
var property = sanitize(o.property?o.property:'');
var payload = o.msg;
var format = sanitize((o.format||"").toString());
msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'')+
msg.attr("class", 'debug-message'+(o.level?(' debug-message-level-'+o.level):'')+
(sourceNode?(
" debug-message-node-"+sourceNode.id.replace(/\./g,"_")+
(sourceNode.z?" debug-message-flow-"+sourceNode.z.replace(/\./g,"_"):"")
):"");
):""));
if (sourceNode) {
$(msg).data('source',sourceNode.id);
msg.data('source',sourceNode.id);
if (filterType === "filterCurrent" && activeWorkspace) {
if (sourceNode.z && sourceNode.z.replace(/\./g,"_") !== activeWorkspace) {
$(msg).addClass('hide');
msg.addClass('hide');
}
} else if (filterType === 'filterSelected'){
if (!!filteredNodes[sourceNode.id]) {
$(msg).addClass('hide');
msg.addClass('hide');
}
}
}
@ -481,7 +480,7 @@ RED.debug = (function() {
errorLvl = 30;
errorLvlType = 'warn';
}
$(msg).addClass('debug-message-level-' + errorLvl);
msg.addClass('debug-message-level-' + errorLvl);
$('<span class="debug-message-topic">function : (' + errorLvlType + ')</span>').appendTo(metaRow);
} else {
var tools = $('<span class="debug-message-tools button-group"></span>').appendTo(metaRow);