Commit 30efadeb authored by Rémi Duraffort's avatar Rémi Duraffort Committed by Neil Williams

LAVA-1274 fix javascript exception

When a debug message is not a string nor an object (like a boolean) the
javascript code, removed by this commit, will crash.

The corresponding code was added to work around a bug in the log format that
has been fixed 6 months ago.

Change-Id: I4908d53aa1172b780b1e6a277a8ec07517b13769
parent b286b6bd
...@@ -299,12 +299,8 @@ ...@@ -299,12 +299,8 @@
<div id="sectionlogs"> <div id="sectionlogs">
{% for line in log_data %} {% for line in log_data %}
{% if line.lvl == "debug" %} {% if line.lvl == "debug" %}
{% if "sending" in line.msg.keys %}{% comment %}TODO: Should be removed in 2017.9{% endcomment %} {% get_action_id line.msg as act_id %}
<code class="keyboard" id="L{{ forloop.counter0 }}" title="{{ line.dt }}"><kbd>{{ line.msg.sending }}</kbd></code>
{% else %}
{% get_action_id line.msg as act_id %}
<code class="debug" title="{{ line.dt }}" id="{% if act_id %}action_{{ act_id }}{% else %}L{{ forloop.counter0 }}{% endif %}">{{ line.msg|udecode }}</code> <code class="debug" title="{{ line.dt }}" id="{% if act_id %}action_{{ act_id }}{% else %}L{{ forloop.counter0 }}{% endif %}">{{ line.msg|udecode }}</code>
{% endif %}
{% elif line.lvl == "input" %} {% elif line.lvl == "input" %}
<code class="keyboard" id="L{{ forloop.counter0 }}" title="{{ line.dt }}"><kbd>{{ line.msg|udecode }}</kbd></code> <code class="keyboard" id="L{{ forloop.counter0 }}" title="{{ line.dt }}"><kbd>{{ line.msg|udecode }}</kbd></code>
{% elif line.lvl == "target" %} {% elif line.lvl == "target" %}
...@@ -764,26 +760,18 @@ ...@@ -764,26 +760,18 @@
var node; var node;
if(level == 'debug') { if(level == 'debug') {
// TODO: Should be removed in 2017.9 var action_id = action_id_regexp.exec(d['msg']);
if(typeof(d['msg']) != 'string' && 'sending' in d['msg']) { if(action_id) {
$('<code class="keyboard" id="' + id + '"></code>') id = 'action_' + action_id[1].replace(/\./g, '-');
.append($('<kbd></kbd>')
.text(d['msg']['sending']))
.insertBefore(progressNode);
} else {
var action_id = action_id_regexp.exec(d['msg']);
if(action_id) {
id = 'action_' + action_id[1].replace(/\./g, '-');
}
$('<code class="debug" id="' + id + '"></code>')
.text(d['msg'])
.insertBefore(progressNode);
} }
$('<code class="debug" id="' + id + '"></code>')
.text(d['msg'])
.insertBefore(progressNode);
} else if(level == 'input') { } else if(level == 'input') {
$('<code class="keyboard" id="' + id + '"></code>') $('<code class="keyboard" id="' + id + '"></code>')
.append($('<kbd></kbd>') .append($('<kbd></kbd>')
.text(d['msg'])) .text(d['msg']))
.insertBefore(progressNode); .insertBefore(progressNode);
} else if(level == 'target') { } else if(level == 'target') {
$('<code class="target bg-success" id="' + id + '"></code>') $('<code class="target bg-success" id="' + id + '"></code>')
.text(d['msg']) .text(d['msg'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment