Commit c5ffc392 authored by wez's avatar wez Committed by Commit bot

Display both capture and upload times in chrome://crashes.

Originally chrome://crashes only displayed uploaded crashes, and only
displayed the time at which the crash report was uploaded.

On systems using Crashpad we also have access to the crash capture-time
which is useful in identifying crash reports which occurred while
offline, for example, such that the capture and upload times would
differ considerably.

This patch was originally drafted by phistuck@gmail.com and
jiameng@chromium.org.

BUG=664430,674249

Review-Url: https://codereview.chromium.org/2612993003
Cr-Commit-Position: refs/heads/master@{#442091}
parent 1de2d977
......@@ -22,7 +22,9 @@ const CrashesUILocalizedString kCrashesUILocalizedStrings[] = {
{"crashCountFormat", IDS_CRASH_CRASH_COUNT_BANNER_FORMAT},
{"crashHeaderFormat", IDS_CRASH_CRASH_HEADER_FORMAT},
{"crashHeaderFormatLocalOnly", IDS_CRASH_CRASH_HEADER_FORMAT_LOCAL_ONLY},
{"crashTimeFormat", IDS_CRASH_CRASH_TIME_FORMAT},
{"crashUploadTimeFormat", IDS_CRASH_UPLOAD_TIME_FORMAT},
{"crashCaptureAndUploadTimeFormat",
IDS_CRASH_CAPTURE_AND_UPLOAD_TIME_FORMAT},
{"crashNotUploaded", IDS_CRASH_CRASH_NOT_UPLOADED},
{"crashUserRequested", IDS_CRASH_CRASH_USER_REQUESTED},
{"crashPending", IDS_CRASH_CRASH_PENDING},
......@@ -69,10 +71,11 @@ void UploadListToValue(UploadList* upload_list, base::ListValue* out_value) {
std::unique_ptr<base::DictionaryValue> crash(new base::DictionaryValue());
crash->SetString("id", info.upload_id);
if (info.state == UploadList::UploadInfo::State::Uploaded) {
crash->SetString("time",
crash->SetString("upload_time",
base::TimeFormatFriendlyDateAndTime(info.upload_time));
} else {
crash->SetString("time",
}
if (!info.capture_time.is_null()) {
crash->SetString("capture_time",
base::TimeFormatFriendlyDateAndTime(info.capture_time));
}
crash->SetString("local_id", info.local_id);
......
......@@ -49,6 +49,7 @@ function updateCrashList(
var crashBlock = document.createElement('div');
if (crash.state != 'uploaded')
crashBlock.className = 'notUploaded';
var title = document.createElement('h3');
var uploaded = crash.state == 'uploaded';
if (uploaded) {
......@@ -60,11 +61,20 @@ function updateCrashList(
crash.local_id);
}
crashBlock.appendChild(title);
if (uploaded) {
var date = document.createElement('p');
date.textContent = loadTimeData.getStringF('crashTimeFormat',
crash.time);
date.textContent = ""
if (crash.capture_time) {
date.textContent += loadTimeData.getStringF(
'crashCaptureAndUploadTimeFormat', crash.capture_time,
crash.upload_time);
} else {
date.textContent += loadTimeData.getStringF('crashUploadTimeFormat',
crash.upload_time);
}
crashBlock.appendChild(date);
var linkBlock = document.createElement('p');
var link = document.createElement('a');
var commentLines = [
......@@ -116,7 +126,7 @@ function updateCrashList(
var crashText = document.createElement('p');
crashText.textContent = loadTimeData.getStringF(textContentKey,
crash.time);
crash.capture_time);
crashBlock.appendChild(crashText);
if (crash.file_size != '') {
......
......@@ -13,8 +13,11 @@
<message name="IDS_CRASH_CRASH_HEADER_FORMAT_LOCAL_ONLY" desc="Format for crash entry headings on chrome://crashes that have not been uploaded">
Crash ID <ph name="CRASH_LOCAL_ID">$1<ex>123456-789789</ex></ph>
</message>
<message name="IDS_CRASH_CRASH_TIME_FORMAT" desc="Format for crash entry occurrence time on chrome://crashes">
Automatically reported <ph name="CRASH_TIME">$1<ex>Tuesday, January 25, 2011 2:58:02 PM</ex></ph>
<message name="IDS_CRASH_UPLOAD_TIME_FORMAT" desc="Format for crash entry upload time on chrome://crashes">
Crash reported on <ph name="UPLOAD_TIME">$1<ex>Tuesday, January 25, 2011 2:58:02 PM</ex></ph>
</message>
<message name="IDS_CRASH_CAPTURE_AND_UPLOAD_TIME_FORMAT" desc="Format for crash capture time, and its upload time, on chrome://crashes">
Crash report captured on <ph name="CRASH_TIME">$1<ex>Tuesday, January 25, 2011 2:58:02 PM</ex></ph>, reported on <ph name="UPLOAD_TIME">$2<ex>Tuesday, January 25, 2011 2:58:02 PM</ex></ph>
</message>
<message name="IDS_CRASH_CRASH_NOT_UPLOADED" desc="Format for crash entry occurrence on chrome://crashes that was not uploaded to the server">
Crash report captured on <ph name="CRASH_TIME">$1<ex>Tuesday, January 25, 2011 2:58:02 PM</ex></ph> was not uploaded
......
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