Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Side by Side Diff: components/crash/core/browser/resources/crashes.js

Issue 2268783002: Manual crash uploads for mac and win (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix js formatting Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/crash/core/browser/resources/crashes.html ('k') | components/crash_strings.grdp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /* Id for tracking automatic refresh of crash list. */ 5 /* Id for tracking automatic refresh of crash list. */
6 var refreshCrashListId = undefined; 6 var refreshCrashListId = undefined;
7 7
8 /** 8 /**
9 * Requests the list of crashes from the backend. 9 * Requests the list of crashes from the backend.
10 */ 10 */
11 function requestCrashes() { 11 function requestCrashes() {
12 chrome.send('requestCrashList'); 12 chrome.send('requestCrashList');
13 } 13 }
14 14
15 /** 15 /**
16 * Callback from backend with the list of crashes. Builds the UI. 16 * Callback from backend with the list of crashes. Builds the UI.
17 * @param {boolean} enabled Whether or not crash reporting is enabled. 17 * @param {boolean} enabled Whether or not crash reporting is enabled.
18 * @param {boolean} dynamicBackend Whether the crash backend is dynamic. 18 * @param {boolean} dynamicBackend Whether the crash backend is dynamic.
19 * @param {boolean} manualUploads Whether the manual uploads are supported.
19 * @param {array} crashes The list of crashes. 20 * @param {array} crashes The list of crashes.
20 * @param {string} version The browser version. 21 * @param {string} version The browser version.
21 * @param {string} os The OS name and version. 22 * @param {string} os The OS name and version.
22 */ 23 */
23 function updateCrashList(enabled, dynamicBackend, crashes, version, os) { 24 function updateCrashList(
25 enabled, dynamicBackend, manualUploads,
26 crashes, version, os) {
24 $('countBanner').textContent = 27 $('countBanner').textContent =
25 loadTimeData.getStringF('crashCountFormat', 28 loadTimeData.getStringF('crashCountFormat',
26 crashes.length.toLocaleString()); 29 crashes.length.toLocaleString());
27 30
28 var crashSection = $('crashList'); 31 var crashSection = $('crashList');
29 32
30 $('enabledMode').hidden = !enabled;
31 $('disabledMode').hidden = enabled; 33 $('disabledMode').hidden = enabled;
32 $('crashUploadStatus').hidden = !enabled || !dynamicBackend; 34 $('crashUploadStatus').hidden = !enabled || !dynamicBackend;
33 35
34 if (!enabled)
35 return;
36
37 // Clear any previous list. 36 // Clear any previous list.
38 crashSection.textContent = ''; 37 crashSection.textContent = '';
39 38
40 var productName = loadTimeData.getString('shortProductName'); 39 var productName = loadTimeData.getString('shortProductName');
41 40
42 for (var i = 0; i < crashes.length; i++) { 41 for (var i = 0; i < crashes.length; i++) {
43 var crash = crashes[i]; 42 var crash = crashes[i];
44 if (crash['local_id'] == '') 43 if (crash.local_id == '')
45 crash['local_id'] = productName; 44 crash.local_id = productName;
46 45
47 var crashBlock = document.createElement('div'); 46 var crashBlock = document.createElement('div');
48 if (crash['state'] != 'uploaded') 47 if (crash.state != 'uploaded')
49 crashBlock.className = 'notUploaded'; 48 crashBlock.className = 'notUploaded';
50 var title = document.createElement('h3'); 49 var title = document.createElement('h3');
51 var uploaded = crash['state'] == 'uploaded'; 50 var uploaded = crash.state == 'uploaded';
52 if (uploaded) { 51 if (uploaded) {
53 title.textContent = loadTimeData.getStringF('crashHeaderFormat', 52 title.textContent = loadTimeData.getStringF('crashHeaderFormat',
54 crash['id'], 53 crash.id,
55 crash['local_id']); 54 crash.local_id);
56 } else { 55 } else {
57 title.textContent = loadTimeData.getStringF('crashHeaderFormatLocalOnly', 56 title.textContent = loadTimeData.getStringF('crashHeaderFormatLocalOnly',
58 crash['local_id']); 57 crash.local_id);
59 } 58 }
60 crashBlock.appendChild(title); 59 crashBlock.appendChild(title);
61 if (uploaded) { 60 if (uploaded) {
62 var date = document.createElement('p'); 61 var date = document.createElement('p');
63 date.textContent = loadTimeData.getStringF('crashTimeFormat', 62 date.textContent = loadTimeData.getStringF('crashTimeFormat',
64 crash['time']); 63 crash.time);
65 crashBlock.appendChild(date); 64 crashBlock.appendChild(date);
66 var linkBlock = document.createElement('p'); 65 var linkBlock = document.createElement('p');
67 var link = document.createElement('a'); 66 var link = document.createElement('a');
68 var commentLines = [ 67 var commentLines = [
69 'IMPORTANT: Your crash has already been automatically reported ' + 68 'IMPORTANT: Your crash has already been automatically reported ' +
70 'to our crash system. Please file this bug only if you can provide ' + 69 'to our crash system. Please file this bug only if you can provide ' +
71 'more information about it.', 70 'more information about it.',
72 '', 71 '',
73 '', 72 '',
74 'Chrome Version: ' + version, 73 'Chrome Version: ' + version,
(...skipping 20 matching lines...) Expand all
95 }; 94 };
96 var href = 'https://code.google.com/p/chromium/issues/entry'; 95 var href = 'https://code.google.com/p/chromium/issues/entry';
97 for (var param in params) { 96 for (var param in params) {
98 href = appendParam(href, param, params[param]); 97 href = appendParam(href, param, params[param]);
99 } 98 }
100 link.href = href; 99 link.href = href;
101 link.target = '_blank'; 100 link.target = '_blank';
102 link.textContent = loadTimeData.getString('bugLinkText'); 101 link.textContent = loadTimeData.getString('bugLinkText');
103 linkBlock.appendChild(link); 102 linkBlock.appendChild(link);
104 crashBlock.appendChild(linkBlock); 103 crashBlock.appendChild(linkBlock);
105 } else if (crash['state'] == 'pending') { 104 } else if (crash.state == 'pending_user_requested') {
106 var pending = document.createElement('p'); 105 var userRequested = document.createElement('p');
107 pending.textContent = loadTimeData.getStringF('crashPending', 106 userRequested.textContent =
108 crash['time']); 107 loadTimeData.getStringF('crashUserRequested', crash.time);
109 crashBlock.appendChild(pending); 108 crashBlock.appendChild(userRequested);
110 } else if (crash['state'] == 'not_uploaded') { 109 } else if (crash.state == 'pending' || crash.state == 'not_uploaded') {
111 var not_uploaded = document.createElement('p'); 110 if (crash.state == 'pending')
112 not_uploaded.textContent = loadTimeData.getStringF('crashNotUploaded', 111 var textContentKey = 'crashPending';
113 crash['time']); 112 else
114 crashBlock.appendChild(not_uploaded); 113 var textContentKey = 'crashNotUploaded';
114
115 var notUploaded = document.createElement('p');
116 notUploaded.textContent = loadTimeData.getStringF(textContentKey,
117 crash.time);
118 crashBlock.appendChild(notUploaded);
119
120 if (manualUploads) {
121 var uploadNowLinkBlock = document.createElement('p');
122 var link = document.createElement('a');
123 link.href = '';
124 link.textContent = loadTimeData.getString('uploadNowLinkText');
125 link.local_id = crash.local_id;
126 link.onclick = function() {
127 chrome.send('requestSingleCrashUpload', [this.local_id]);
128 };
129 uploadNowLinkBlock.appendChild(link);
130 crashBlock.appendChild(uploadNowLinkBlock);
131 }
115 } 132 }
116 crashSection.appendChild(crashBlock); 133 crashSection.appendChild(crashBlock);
117 } 134 }
118 135
119 $('noCrashes').hidden = crashes.length != 0; 136 $('noCrashes').hidden = crashes.length != 0;
120 } 137 }
121 138
122 /** 139 /**
123 * Request crashes get uploaded in the background. 140 * Request crashes get uploaded in the background.
124 */ 141 */
125 function requestCrashUpload() { 142 function requestCrashUpload() {
126 // Don't need locking with this call because the system crash reporter 143 // Don't need locking with this call because the system crash reporter
127 // has locking built into itself. 144 // has locking built into itself.
128 chrome.send('requestCrashUpload'); 145 chrome.send('requestCrashUpload');
129 146
130 // Trigger a refresh in 5 seconds. Clear any previous requests. 147 // Trigger a refresh in 5 seconds. Clear any previous requests.
131 clearTimeout(refreshCrashListId); 148 clearTimeout(refreshCrashListId);
132 refreshCrashListId = setTimeout(requestCrashes, 5000); 149 refreshCrashListId = setTimeout(requestCrashes, 5000);
133 } 150 }
134 151
135 document.addEventListener('DOMContentLoaded', function() { 152 document.addEventListener('DOMContentLoaded', function() {
136 $('uploadCrashes').onclick = requestCrashUpload; 153 $('uploadCrashes').onclick = requestCrashUpload;
137 requestCrashes(); 154 requestCrashes();
138 }); 155 });
OLDNEW
« no previous file with comments | « components/crash/core/browser/resources/crashes.html ('k') | components/crash_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698