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

Unified Diff: chrome/browser/resources/feedback/js/feedback.js

Issue 1794513002: Fix sending multiple feedback reports within short durations of each other (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self revision Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/feedback/js/event_handler.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/feedback/js/feedback.js
diff --git a/chrome/browser/resources/feedback/js/feedback.js b/chrome/browser/resources/feedback/js/feedback.js
index 6cd19b693287b16c2017311f2a0a78ecf4218efd..065081e1da1e2f561f31478d518c9f18585bee4d 100644
--- a/chrome/browser/resources/feedback/js/feedback.js
+++ b/chrome/browser/resources/feedback/js/feedback.js
@@ -63,7 +63,12 @@ var FeedbackFlow = {
var attachedFileBlob = null;
var lastReader = null;
-var feedbackInfo = null;
+/**
+ * Determines whether the system information associated with this instance of
+ * the feedback window has been received.
+ * @type {boolean}
+ */
+var isSystemInfoReady = false;
/**
* The callback used by the sys_info_page to receive the event that the system
@@ -176,29 +181,13 @@ function sendReport() {
if (!$('screenshot-checkbox').checked)
feedbackInfo.screenshot = null;
- if (useSystemInfo) {
- // The user chose to include the system information as part of the report.
- // If they are not ready yet, we have to send the report later.
- if (!isSystemInfoReady()) {
- // The report will be sent later by the feedback extension's background
- // page (see event_handler.js).
- sendReportLater(feedbackInfo);
-
- // No landing page for login screen feedback.
- if (feedbackInfo.flow != FeedbackFlow.LOGIN)
- window.open(FEEDBACK_LANDING_PAGE, '_blank');
- window.close();
- return true;
- }
- }
-
- chrome.feedbackPrivate.sendFeedback(feedbackInfo, function(result) {
- // No landing page for login screen feedback.
- if (feedbackInfo.flow != FeedbackFlow.LOGIN)
- window.open(FEEDBACK_LANDING_PAGE, '_blank');
- window.close();
- });
-
+ // Request sending the report, show the landing page (if allowed), and close
+ // this window right away. The FeedbackRequest object that represents this
+ // report will take care of sending the report in the background.
+ sendFeedbackReport(useSystemInfo);
+ if (feedbackInfo.flow != FeedbackFlow.LOGIN)
+ window.open(FEEDBACK_LANDING_PAGE, '_blank');
+ window.close();
return true;
}
@@ -267,18 +256,9 @@ function resizeAppWindow() {
/**
* A callback to be invoked when the background page of this extension receives
* the system information.
- * @param {Object} sysInfo The received system information.
*/
-function onSystemInformation(sysInfo) {
- // Concatenate the feedbackInfo's systemInformation with the newly received
- // sysInfo once (if any).
- if (feedbackInfo.systemInformation) {
- feedbackInfo.systemInformation =
- feedbackInfo.systemInformation.concat(sysInfo);
- } else {
- feedbackInfo.systemInformation = sysInfo;
- }
-
+function onSystemInformation() {
+ isSystemInfoReady = true;
// In case the sys_info_page needs to be notified by this event, do so.
if (sysInfoPageOnSysInfoReadyCallback != null) {
sysInfoPageOnSysInfoReadyCallback(feedbackInfo.systemInformation);
@@ -301,8 +281,6 @@ function initialize() {
// Add listener to receive the feedback info object.
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
if (request.sentFromEventPage) {
- feedbackInfo = request.data;
-
if (!feedbackInfo.flow)
feedbackInfo.flow = FeedbackFlow.REGULAR;
@@ -329,8 +307,8 @@ function initialize() {
$('user-email-text').value = email;
});
- // Initiate getting the system info and use it to prepare the full
- // feedback info.
+ // Initiate getting the system info.
+ isSystemInfoReady = false;
getSystemInformation(onSystemInformation);
// An extension called us with an attached file.
@@ -385,7 +363,7 @@ function initialize() {
// Gets the full system information for the new window.
appWindow.contentWindow.getFullSystemInfo =
function(callback) {
- if (isSystemInfoReady()) {
+ if (isSystemInfoReady) {
callback(feedbackInfo.systemInformation);
return;
}
« no previous file with comments | « chrome/browser/resources/feedback/js/event_handler.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698