Bug 1546367 - Clear report textarea when report is submitted. r=bgrins
authorTim Nguyen <ntim.bugs@gmail.com>
Tue, 23 Apr 2019 18:28:04 +0000
changeset 470531 99ad1e5017af4029d97661a835ab95f78a5cb2b8
parent 470530 4e944453387799c678ea924d3b9084fdc011d199
child 470532 2b9ff41f9e37e572e8d3776c7446a8b5eca022ea
push id35906
push useraciure@mozilla.com
push dateTue, 23 Apr 2019 22:14:56 +0000
treeherdermozilla-central@0ce3633f8b80 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1546367
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1546367 - Clear report textarea when report is submitted. r=bgrins Differential Revision: https://phabricator.services.mozilla.com/D28522
browser/base/content/browser-contentblocking.js
browser/base/content/test/trackingUI/browser_trackingUI_report_breakage.js
--- a/browser/base/content/browser-contentblocking.js
+++ b/browser/base/content/browser-contentblocking.js
@@ -1007,16 +1007,19 @@ var ContentBlocking = {
 
     fetch(reportEndpoint, {
       method: "POST",
       credentials: "omit",
       body: formData,
     }).then(function(response) {
       if (!response.ok) {
         Cu.reportError(`Content Blocking report to ${reportEndpoint} failed with status ${response.status}`);
+      } else {
+        // Clear the textarea value when the report is submitted
+        comments.value = "";
       }
     }).catch(Cu.reportError);
   },
 
   toggleReportBreakageButton() {
     // For release (due to the large volume) we only want to receive reports
     // for breakage that is directly related to third party cookie blocking.
     if (this.reportBreakageEnabled ||
--- a/browser/base/content/test/trackingUI/browser_trackingUI_report_breakage.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_report_breakage.js
@@ -221,16 +221,19 @@ async function testReportBreakage(url, t
   let i = server.identity;
   let path = i.primaryScheme + "://" + i.primaryHost + ":" + i.primaryPort + "/";
 
   Services.prefs.setBoolPref(PREF_REPORT_BREAKAGE_ENABLED, true);
   Services.prefs.setStringPref(PREF_REPORT_BREAKAGE_URL, path);
 
   await openIdentityPopup();
 
+  let comments = document.getElementById("identity-popup-breakageReportView-collection-comments");
+  is(comments.value, "", "Comments textarea should initially be empty");
+
   let reportBreakageButton = document.getElementById("identity-popup-content-blocking-report-breakage");
   await TestUtils.waitForCondition(() => BrowserTestUtils.is_visible(reportBreakageButton),
     "report breakage button is visible");
   let reportBreakageView = document.getElementById("identity-popup-breakageReportView");
   let viewShown = BrowserTestUtils.waitForEvent(reportBreakageView, "ViewShown");
   reportBreakageButton.click();
   await viewShown;
 
@@ -284,17 +287,16 @@ async function testReportBreakage(url, t
         "Content-Disposition: form-data; name=\"labels\"\r\n\r\n" +
         `${tags}\r\n`,
         "",
       ], "Should send the correct form data");
 
       resolve();
     });
 
-    let comments = document.getElementById("identity-popup-breakageReportView-collection-comments");
     comments.value = "This is a comment";
     submitButton.click();
   });
 
   await popuphidden;
 
   // Stop the server.
   await new Promise(r => server.stop(r));