Bug 548667 - Future-proof CrashSubmit against future argument additions. r=ted

This commit is contained in:
Josh Matthews 2011-07-20 17:52:13 -07:00
parent 0f806c704b
commit 46f873c5ff
4 changed files with 38 additions and 22 deletions

View File

@ -6797,9 +6797,9 @@ var gPluginHandler = {
submitReport : function(pluginDumpID, browserDumpID) {
// The crash reporter wants a DOM element it can append an IFRAME to,
// which it uses to submit a form. Let's just give it gBrowser.
this.CrashSubmit.submit(pluginDumpID, null, null);
this.CrashSubmit.submit(pluginDumpID);
if (browserDumpID)
this.CrashSubmit.submit(browserDumpID, null, null);
this.CrashSubmit.submit(browserDumpID);
},
// Callback for user clicking a "reload page" link

View File

@ -2527,7 +2527,7 @@ var ContentCrashObserver = {
} catch (x) {
dump (x);
}
self.CrashSubmit.submit(dumpID, null, null);
self.CrashSubmit.submit(dumpID);
}
}, 0, this);
}

View File

@ -329,29 +329,42 @@ let CrashSubmit = {
*
* @param id
* Filename (minus .dmp extension) of the minidump to submit.
* @param submitSuccess
* A function that will be called if the report is submitted
* successfully with two parameters: the id that was passed
* to this function, and an object containing the key/value
* data returned from the server in its properties.
* @param submitError
* A function that will be called with one parameter if the
* report fails to submit: the id that was passed to this
* function.
* @param noThrottle
* If true, this crash report should be submitted with
* an extra parameter of "Throttleable=0" indicating that
* it should be processed right away. This should be set
* when the report is being submitted and the user expects
* to see the results immediately.
* @param params
* An object containing any of the following optional parameters:
* - submitSuccess
* A function that will be called if the report is submitted
* successfully with two parameters: the id that was passed
* to this function, and an object containing the key/value
* data returned from the server in its properties.
* - submitError
* A function that will be called with one parameter if the
* report fails to submit: the id that was passed to this
* function.
* - noThrottle
* If true, this crash report should be submitted with
* an extra parameter of "Throttleable=0" indicating that
* it should be processed right away. This should be set
* when the report is being submitted and the user expects
* to see the results immediately. Defaults to false.
*
* @return true if the submission began successfully, or false if
* it failed for some reason. (If the dump file does not
* exist, for example.)
*/
submit: function CrashSubmit_submit(id, submitSuccess, submitError,
noThrottle)
submit: function CrashSubmit_submit(id, params)
{
params = params || {};
let submitSuccess = null;
let submitError = null;
let noThrottle = false;
if ('submitSuccess' in params)
submitSuccess = params.submitSuccess;
if ('submitError' in params)
submitError = params.submitError;
if ('noThrottle' in params)
noThrottle = params.noThrottle;
let submitter = new Submitter(id,
submitSuccess,
submitError,

View File

@ -77,8 +77,11 @@ function submitError(dumpid) {
function submitPendingReport(event) {
var link = event.target;
var id = link.firstChild.textContent;
if (CrashSubmit.submit(id, submitSuccess, submitError, true))
link.className = "submitting";
if (CrashSubmit.submit(id, { submitSuccess: submitSuccess,
submitError: submitError,
noThrottle: true })) {
link.className = "submitting";
}
event.preventDefault();
return false;
}