| OLD | NEW |
| 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 */ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 crashSection.textContent = ''; | 38 crashSection.textContent = ''; |
| 39 | 39 |
| 40 var productName = loadTimeData.getString('shortProductName'); | 40 var productName = loadTimeData.getString('shortProductName'); |
| 41 | 41 |
| 42 for (var i = 0; i < crashes.length; i++) { | 42 for (var i = 0; i < crashes.length; i++) { |
| 43 var crash = crashes[i]; | 43 var crash = crashes[i]; |
| 44 if (crash['local_id'] == '') | 44 if (crash['local_id'] == '') |
| 45 crash['local_id'] = productName; | 45 crash['local_id'] = productName; |
| 46 | 46 |
| 47 var crashBlock = document.createElement('div'); | 47 var crashBlock = document.createElement('div'); |
| 48 if (crash['state'] != 'uploaded') |
| 49 crashBlock.className = 'notUploaded'; |
| 48 var title = document.createElement('h3'); | 50 var title = document.createElement('h3'); |
| 49 title.textContent = loadTimeData.getStringF('crashHeaderFormat', | 51 var uploaded = crash['state'] == 'uploaded'; |
| 50 crash['id'], | 52 if (uploaded) { |
| 51 crash['local_id']); | 53 title.textContent = loadTimeData.getStringF('crashHeaderFormat', |
| 54 crash['id'], |
| 55 crash['local_id']); |
| 56 } else { |
| 57 title.textContent = loadTimeData.getStringF('crashHeaderFormatLocalOnly', |
| 58 crash['local_id']); |
| 59 } |
| 52 crashBlock.appendChild(title); | 60 crashBlock.appendChild(title); |
| 53 var date = document.createElement('p'); | 61 if (uploaded) { |
| 54 date.textContent = loadTimeData.getStringF('crashTimeFormat', | 62 var date = document.createElement('p'); |
| 55 crash['time']); | 63 date.textContent = loadTimeData.getStringF('crashTimeFormat', |
| 56 crashBlock.appendChild(date); | 64 crash['time']); |
| 57 var linkBlock = document.createElement('p'); | 65 crashBlock.appendChild(date); |
| 58 var link = document.createElement('a'); | 66 var linkBlock = document.createElement('p'); |
| 59 var commentLines = [ | 67 var link = document.createElement('a'); |
| 60 'IMPORTANT: Your crash has already been automatically reported ' + | 68 var commentLines = [ |
| 61 'to our crash system. Please file this bug only if you can provide ' + | 69 'IMPORTANT: Your crash has already been automatically reported ' + |
| 62 'more information about it.', | 70 'to our crash system. Please file this bug only if you can provide ' + |
| 63 '', | 71 'more information about it.', |
| 64 '', | 72 '', |
| 65 'Chrome Version: ' + version, | 73 '', |
| 66 'Operating System: ' + os, | 74 'Chrome Version: ' + version, |
| 67 '', | 75 'Operating System: ' + os, |
| 68 'URL (if applicable) where crash occurred:', | 76 '', |
| 69 '', | 77 'URL (if applicable) where crash occurred:', |
| 70 'Can you reproduce this crash?', | 78 '', |
| 71 '', | 79 'Can you reproduce this crash?', |
| 72 'What steps will reproduce this crash? (If it\'s not ' + | 80 '', |
| 73 'reproducible, what were you doing just before the crash?)', | 81 'What steps will reproduce this crash? (If it\'s not ' + |
| 74 '1.', '2.', '3.', | 82 'reproducible, what were you doing just before the crash?)', |
| 75 '', | 83 '1.', '2.', '3.', |
| 76 '****DO NOT CHANGE BELOW THIS LINE****', | 84 '', |
| 77 'Crash ID: crash/' + crash.id | 85 '****DO NOT CHANGE BELOW THIS LINE****', |
| 78 ]; | 86 'Crash ID: crash/' + crash.id |
| 79 var params = { | 87 ]; |
| 80 template: 'Crash Report', | 88 var params = { |
| 81 comment: commentLines.join('\n'), | 89 template: 'Crash Report', |
| 82 }; | 90 comment: commentLines.join('\n'), |
| 83 var href = 'https://code.google.com/p/chromium/issues/entry'; | 91 }; |
| 84 for (var param in params) { | 92 var href = 'https://code.google.com/p/chromium/issues/entry'; |
| 85 href = appendParam(href, param, params[param]); | 93 for (var param in params) { |
| 94 href = appendParam(href, param, params[param]); |
| 95 } |
| 96 link.href = href; |
| 97 link.target = '_blank'; |
| 98 link.textContent = loadTimeData.getString('bugLinkText'); |
| 99 linkBlock.appendChild(link); |
| 100 crashBlock.appendChild(linkBlock); |
| 101 } else if (crash['state'] == 'pending') { |
| 102 var pending = document.createElement('p'); |
| 103 pending.textContent = loadTimeData.getStringF('crashPending', |
| 104 crash['time']); |
| 105 crashBlock.appendChild(pending); |
| 106 } else if (crash['state'] == 'not_uploaded') { |
| 107 var not_uploaded = document.createElement('p'); |
| 108 not_uploaded.textContent = loadTimeData.getStringF('crashNotUploaded', |
| 109 crash['time']); |
| 110 crashBlock.appendChild(not_uploaded); |
| 86 } | 111 } |
| 87 link.href = href; | |
| 88 link.target = '_blank'; | |
| 89 link.textContent = loadTimeData.getString('bugLinkText'); | |
| 90 linkBlock.appendChild(link); | |
| 91 crashBlock.appendChild(linkBlock); | |
| 92 crashSection.appendChild(crashBlock); | 112 crashSection.appendChild(crashBlock); |
| 93 } | 113 } |
| 94 | 114 |
| 95 $('noCrashes').hidden = crashes.length != 0; | 115 $('noCrashes').hidden = crashes.length != 0; |
| 96 } | 116 } |
| 97 | 117 |
| 98 /** | 118 /** |
| 99 * Request crashes get uploaded in the background. | 119 * Request crashes get uploaded in the background. |
| 100 */ | 120 */ |
| 101 function requestCrashUpload() { | 121 function requestCrashUpload() { |
| 102 // Don't need locking with this call because the system crash reporter | 122 // Don't need locking with this call because the system crash reporter |
| 103 // has locking built into itself. | 123 // has locking built into itself. |
| 104 chrome.send('requestCrashUpload'); | 124 chrome.send('requestCrashUpload'); |
| 105 | 125 |
| 106 // Trigger a refresh in 5 seconds. Clear any previous requests. | 126 // Trigger a refresh in 5 seconds. Clear any previous requests. |
| 107 clearTimeout(refreshCrashListId); | 127 clearTimeout(refreshCrashListId); |
| 108 refreshCrashListId = setTimeout(requestCrashes, 5000); | 128 refreshCrashListId = setTimeout(requestCrashes, 5000); |
| 109 } | 129 } |
| 110 | 130 |
| 111 document.addEventListener('DOMContentLoaded', function() { | 131 document.addEventListener('DOMContentLoaded', function() { |
| 112 $('uploadCrashes').onclick = requestCrashUpload; | 132 $('uploadCrashes').onclick = requestCrashUpload; |
| 113 requestCrashes(); | 133 requestCrashes(); |
| 114 }); | 134 }); |
| OLD | NEW |