Commit 6610f2ba authored by shimazu's avatar shimazu Committed by Commit bot

ServiceWorker: Reset message in serviceworker-internals with update

Currently, when there are two registration and above one is unregistered, console message by above registration is left in top console box though the bottom one goes to the top. Then, the message in each box is set to the message recorded internally when update() is called.

BUG=418568
TEST=N/A

Review URL: https://codereview.chromium.org/653283004

Cr-Commit-Position: refs/heads/master@{#300027}
parent 82d056a6
......@@ -76,7 +76,7 @@ cr.define('serviceworker', function() {
var allLogMessages = {};
// Set log for a worker version.
function fillLogForVersion(partition_id, version) {
function fillLogForVersion(container, partition_id, version) {
if (!version) {
return;
}
......@@ -89,6 +89,14 @@ cr.define('serviceworker', function() {
} else {
version.log = '';
}
var logAreas = container.querySelectorAll('textarea.serviceworker-log');
for (var i = 0; i < logAreas.length; ++i) {
var logArea = logAreas[i];
if (logArea.partition_id == partition_id &&
logArea.version_id == version.version_id) {
logArea.value = version.log;
}
}
}
// Get the unregistered workers.
......@@ -157,7 +165,7 @@ cr.define('serviceworker', function() {
template = jstGetTemplate('serviceworker-list-template');
container.appendChild(template);
}
var fillLogFunc = fillLogForVersion.bind(this, partition_id);
var fillLogFunc = fillLogForVersion.bind(this, container, partition_id);
stored_registrations.forEach(function(registration) {
[registration.active, registration.waiting].forEach(fillLogFunc);
});
......@@ -239,7 +247,7 @@ cr.define('serviceworker', function() {
for (var i = 0; i < logAreas.length; ++i) {
var logArea = logAreas[i];
if (logArea.partition_id == partition_id &&
logArea.version_id == version_id) {
logArea.version_id == version_id) {
logArea.value += message;
}
}
......
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