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

Side by Side Diff: chrome/browser/resources/google_now/utility.js

Issue 24109007: Switching to a new format for sending errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 117 var errorText = error.name;
118 if (error.canSendMessageToServer) 118 if (error.canSendMessageToServer)
119 errorText = errorText + ': ' + error.message; 119 errorText = errorText + ': ' + error.message;
120 120
121 var requestParameters = 121 var errorObject = {
122 'error=' + encodeURIComponent(errorText) + 122 message: errorText,
123 '&script=' + encodeURIComponent(file) + 123 file: file,
robliao 2013/09/24 20:14:43 Don't the unit tests need to update for this chang
vadimt 2013/09/24 21:10:50 Ah, you are right! Done.
124 '&line=' + encodeURIComponent(line) + 124 line: line,
125 '&trace=' + encodeURIComponent(filteredStack); 125 trace: filteredStack
126 var request = buildServerRequest('jserror', 126 };
127 'application/x-www-form-urlencoded'); 127
128 var request = buildServerRequest('jserrors', 'application/json');
128 request.onloadend = function(event) { 129 request.onloadend = function(event) {
129 console.log('sendErrorReport status: ' + request.status); 130 console.log('sendErrorReport status: ' + request.status);
130 }; 131 };
131 request.send(requestParameters); 132 request.send(JSON.stringify(errorObject));
132 } 133 }
133 134
134 // Limiting 1 error report per background page load. 135 // Limiting 1 error report per background page load.
135 var errorReported = false; 136 var errorReported = false;
136 137
137 /** 138 /**
138 * Reports an error to the server and the user, as appropriate. 139 * Reports an error to the server and the user, as appropriate.
139 * @param {Error} error Error to report. 140 * @param {Error} error Error to report.
140 */ 141 */
141 function reportError(error) { 142 function reportError(error) {
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 // Poll for the sign in state every hour. 732 // Poll for the sign in state every hour.
732 // One hour is just an arbitrary amount of time chosen. 733 // One hour is just an arbitrary amount of time chosen.
733 chrome.alarms.create(alarmName, {periodInMinutes: 60}); 734 chrome.alarms.create(alarmName, {periodInMinutes: 60});
734 735
735 return { 736 return {
736 addListener: addListener, 737 addListener: addListener,
737 isSignedIn: isSignedIn, 738 isSignedIn: isSignedIn,
738 removeToken: removeToken 739 removeToken: removeToken
739 }; 740 };
740 } 741 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698