1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * Requests the list of crashes from the backend.
8 function requestCrashes() {
9 chrome
.send('requestCrashList');
13 * Callback from backend with the list of crashes. Builds the UI.
14 * @param {boolean} enabled Whether or not crash reporting is enabled.
15 * @param {array} crashes The list of crashes.
16 * @param {string} version The browser version.
18 function updateCrashList(enabled
, crashes
, version
) {
19 $('countBanner').textContent
= loadTimeData
.getStringF('crashCountFormat',
22 var crashSection
= $('crashList');
24 $('enabledMode').hidden
= !enabled
;
25 $('disabledMode').hidden
= enabled
;
30 // Clear any previous list.
31 crashSection
.textContent
= '';
33 for (var i
= 0; i
< crashes
.length
; i
++) {
34 var crash
= crashes
[i
];
36 var crashBlock
= document
.createElement('div');
37 var title
= document
.createElement('h3');
38 title
.textContent
= loadTimeData
.getStringF('crashHeaderFormat',
40 crashBlock
.appendChild(title
);
41 var date
= document
.createElement('p');
42 date
.textContent
= loadTimeData
.getStringF('crashTimeFormat',
44 crashBlock
.appendChild(date
);
45 var linkBlock
= document
.createElement('p');
46 var link
= document
.createElement('a');
48 'Chrome Version: ' + version
,
49 // TODO(tbreisacher): fill in the OS automatically?
50 'Operating System: e.g., "Windows 7", "Mac OSX 10.6"',
52 'URL (if applicable) where crash occurred:',
54 'Can you reproduce this crash?',
56 'What steps will reproduce this crash? (or if it\'s not ' +
57 'reproducible, what were you doing just before the crash)?',
61 '*Please note that issues filed with no information filled in ' +
62 'above will be marked as WontFix*',
64 '****DO NOT CHANGE BELOW THIS LINE****',
65 'report_id:' + crash
.id
68 template
: 'Crash Report',
69 comment
: commentLines
.join('\n'),
71 var href
= 'http://code.google.com/p/chromium/issues/entry';
72 for (var param
in params
) {
73 href
= appendParam(href
, param
, params
[param
]);
76 link
.target
= '_blank';
77 link
.textContent
= loadTimeData
.getString('bugLinkText');
78 linkBlock
.appendChild(link
);
79 crashBlock
.appendChild(linkBlock
);
80 crashSection
.appendChild(crashBlock
);
83 $('noCrashes').hidden
= crashes
.length
!= 0;
86 document
.addEventListener('DOMContentLoaded', requestCrashes
);