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