diff --git a/modules/plugin/test/mochitest/Makefile.in b/modules/plugin/test/mochitest/Makefile.in index beccb2d7879..e01d80211db 100644 --- a/modules/plugin/test/mochitest/Makefile.in +++ b/modules/plugin/test/mochitest/Makefile.in @@ -107,6 +107,7 @@ _MOCHICHROME_FILES = \ test_bug479979.xul \ test_crash_notify.xul \ test_crash_notify_no_report.xul \ + test_crash_submit.xul \ test_npruntime.xul \ test_privatemode.xul \ test_wmode.xul \ diff --git a/modules/plugin/test/mochitest/test_crash_submit.xul b/modules/plugin/test/mochitest/test_crash_submit.xul new file mode 100644 index 00000000000..67ac520b778 --- /dev/null +++ b/modules/plugin/test/mochitest/test_crash_submit.xul @@ -0,0 +1,128 @@ + + + + + Plugin Crash Notification Test + + + + diff --git a/testing/mochitest/tests/SimpleTest/EventUtils.js b/testing/mochitest/tests/SimpleTest/EventUtils.js index 62f9c7a22ac..27fbbc77db9 100644 --- a/testing/mochitest/tests/SimpleTest/EventUtils.js +++ b/testing/mochitest/tests/SimpleTest/EventUtils.js @@ -8,9 +8,10 @@ */ /** - * Send a mouse event to the node with id aTarget. The "event" passed in to - * aEvent is just a JavaScript object with the properties set that the real - * mouse event object should have. This includes the type of the mouse event. + * Send a mouse event to the node aTarget (aTarget can be an id, or an + * actual node) . The "event" passed in to aEvent is just a JavaScript + * object with the properties set that the real mouse event object should + * have. This includes the type of the mouse event. * E.g. to send an click event to the node with id 'node' you might do this: * * sendMouseEvent({type:'click'}, 'node'); @@ -24,6 +25,10 @@ function sendMouseEvent(aEvent, aTarget, aWindow) { aWindow = window; } + if (!(aTarget instanceof Element)) { + aTarget = aWindow.document.getElementById(aTarget); + } + // For events to trigger the UA's default actions they need to be "trusted" netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserWrite'); @@ -52,7 +57,7 @@ function sendMouseEvent(aEvent, aTarget, aWindow) { ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg, buttonArg, relatedTargetArg); - aWindow.document.getElementById(aTarget).dispatchEvent(event); + aTarget.dispatchEvent(event); } /** diff --git a/toolkit/crashreporter/CrashSubmit.jsm b/toolkit/crashreporter/CrashSubmit.jsm index cbc6236fc1e..984ce4201d6 100644 --- a/toolkit/crashreporter/CrashSubmit.jsm +++ b/toolkit/crashreporter/CrashSubmit.jsm @@ -187,12 +187,13 @@ function writeSubmittedReport(crashID, viewURL) { } // the Submitter class represents an individual submission. -function Submitter(id, element, submitSuccess, submitError) { +function Submitter(id, element, submitSuccess, submitError, noThrottle) { this.id = id; this.element = element; this.document = element.ownerDocument; this.successCallback = submitSuccess; this.errorCallback = submitError; + this.noThrottle = noThrottle; } Submitter.prototype = { @@ -250,8 +251,10 @@ Submitter.prototype = { for (let [name, value] in Iterator(reportData)) { addFormEntry(this.iframe.contentDocument, form, name, value); } - // tell the server not to throttle this, since it was manually submitted - addFormEntry(this.iframe.contentDocument, form, "Throttleable", "0"); + if (this.noThrottle) { + // tell the server not to throttle this, since it was manually submitted + addFormEntry(this.iframe.contentDocument, form, "Throttleable", "0"); + } // add the minidump this.iframe.contentDocument.getElementById('minidump').value = this.dump.path; @@ -310,6 +313,9 @@ Submitter.prototype = { let propBag = Cc["@mozilla.org/hash-property-bag;1"]. createInstance(Ci.nsIWritablePropertyBag2); propBag.setPropertyAsAString("minidumpID", this.id); + if (status == SUCCESS) { + propBag.setPropertyAsAString("serverCrashID", ret.CrashID); + } Services.obs.notifyObservers(propBag, "crash-report-status", status); @@ -384,14 +390,25 @@ let CrashSubmit = { * 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. * * @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, element, submitSuccess, submitError) + submit: function CrashSubmit_submit(id, element, submitSuccess, submitError, + noThrottle) { - let submitter = new Submitter(id, element, submitSuccess, submitError); + let submitter = new Submitter(id, + element, + submitSuccess, + submitError, + noThrottle); CrashSubmit._activeSubmissions.push(submitter); return submitter.submit(); }, diff --git a/toolkit/crashreporter/content/crashes.js b/toolkit/crashreporter/content/crashes.js index e0efa10134e..881f74171e7 100644 --- a/toolkit/crashreporter/content/crashes.js +++ b/toolkit/crashreporter/content/crashes.js @@ -77,7 +77,7 @@ function submitError(dumpid) { function submitPendingReport(event) { var link = event.target; var id = link.firstChild.textContent; - if (CrashSubmit.submit(id, document.body, submitSuccess, submitError)) + if (CrashSubmit.submit(id, document.body, submitSuccess, submitError, true)) link.className = "submitting"; event.preventDefault(); return false;