diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js index fad488bc6668..5706f3a377ae 100644 --- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js +++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js @@ -752,7 +752,7 @@ TestPilotExperiment.prototype = { req.setRequestHeader("Connection", "close"); req.onreadystatechange = function(aEvt) { if (req.readyState == 4) { - if (req.status == 201) { + if (req.status == 200 || req.status == 201 || req.status == 202) { let location = req.getResponseHeader("Location"); self._logger.info("DATA WAS POSTED SUCCESSFULLY " + location); if (self._uploadRetryTimer) { @@ -822,7 +822,7 @@ TestPilotExperiment.prototype = { req.setRequestHeader("Connection", "close"); req.onreadystatechange = function(aEvt) { if (req.readyState == 4) { - if (req.status == 200) { + if (req.status == 200 || req.status == 201 || req.status == 202) { logger.info("Quit reason posted successfully " + req.responseText); callback(true); } else { @@ -936,6 +936,9 @@ TestPilotBuiltinSurvey.prototype = { // Include guid of the study that this survey is related to, so we // can match them up server-side. let guid = Application.prefs.getValue(GUID_PREF_PREFIX + self._studyId, ""); + /* TODO if the guid for that study ID hasn't been set yet, set it! And + * then use it on the study. That way it won't matter whether the + * study or the survey gets run first.*/ json.metadata.task_guid = guid; let pref = SURVEY_ANSWER_PREFIX + self._id; let surveyAnswers = JSON.parse(Application.prefs.getValue(pref, "{}")); @@ -953,14 +956,14 @@ TestPilotBuiltinSurvey.prototype = { Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]. createInstance(Ci.nsIXMLHttpRequest); let url = self.uploadUrl; - req.open("POST", url, true); req.setRequestHeader("Content-type", "application/json"); req.setRequestHeader("Content-length", params.length); req.setRequestHeader("Connection", "close"); req.onreadystatechange = function(aEvt) { if (req.readyState == 4) { - if (req.status == 200) { + if (req.status == 200 || req.status == 201 || + req.status == 202) { self._logger.info( "DATA WAS POSTED SUCCESSFULLY " + req.responseText); if (self._uploadRetryTimer) { @@ -969,7 +972,7 @@ TestPilotBuiltinSurvey.prototype = { self.changeStatus(TaskConstants.STATUS_SUBMITTED); callback(true); } else { - self._logger.warn("ERROR POSTING DATA: " + req.responseText); + self._logger.warn(req.status + " ERROR POSTING DATA: " + req.responseText); self._uploadRetryTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);