OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * @fileoverview Utility objects and functions for Google Now extension. | 8 * @fileoverview Utility objects and functions for Google Now extension. |
9 * Most important entities here: | 9 * Most important entities here: |
10 * (1) 'wrapper' is a module used to add error handling and other services to | 10 * (1) 'wrapper' is a module used to add error handling and other services to |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // topFrameElements is an array that ends like: | 107 // topFrameElements is an array that ends like: |
108 // [N-3] //pmofbkohncoogjjhahejjfbppikbjigm/utility.js | 108 // [N-3] //pmofbkohncoogjjhahejjfbppikbjigm/utility.js |
109 // [N-2] 308 | 109 // [N-2] 308 |
110 // [N-1] 19 | 110 // [N-1] 19 |
111 if (topFrameElements.length >= 3) { | 111 if (topFrameElements.length >= 3) { |
112 file = topFrameElements[topFrameElements.length - 3]; | 112 file = topFrameElements[topFrameElements.length - 3]; |
113 line = topFrameElements[topFrameElements.length - 2]; | 113 line = topFrameElements[topFrameElements.length - 2]; |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
| 117 var errorText = error.name; |
| 118 if (error.canSendMessageToServer) |
| 119 errorText = errorText + ': ' + error.message; |
| 120 |
117 var requestParameters = | 121 var requestParameters = |
118 'error=' + encodeURIComponent(error.name) + | 122 'error=' + encodeURIComponent(errorText) + |
119 '&script=' + encodeURIComponent(file) + | 123 '&script=' + encodeURIComponent(file) + |
120 '&line=' + encodeURIComponent(line) + | 124 '&line=' + encodeURIComponent(line) + |
121 '&trace=' + encodeURIComponent(filteredStack); | 125 '&trace=' + encodeURIComponent(filteredStack); |
122 var request = buildServerRequest('jserror', | 126 var request = buildServerRequest('jserror', |
123 'application/x-www-form-urlencoded'); | 127 'application/x-www-form-urlencoded'); |
124 request.onloadend = function(event) { | 128 request.onloadend = function(event) { |
125 console.log('sendErrorReport status: ' + request.status); | 129 console.log('sendErrorReport status: ' + request.status); |
126 }; | 130 }; |
127 request.send(requestParameters); | 131 request.send(requestParameters); |
128 } | 132 } |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 // Poll for the sign in state every hour. | 726 // Poll for the sign in state every hour. |
723 // One hour is just an arbitrary amount of time chosen. | 727 // One hour is just an arbitrary amount of time chosen. |
724 chrome.alarms.create(alarmName, {periodInMinutes: 60}); | 728 chrome.alarms.create(alarmName, {periodInMinutes: 60}); |
725 | 729 |
726 return { | 730 return { |
727 addListener: addListener, | 731 addListener: addListener, |
728 isSignedIn: isSignedIn, | 732 isSignedIn: isSignedIn, |
729 removeToken: removeToken | 733 removeToken: removeToken |
730 }; | 734 }; |
731 } | 735 } |
OLD | NEW |