Bug 1540416 - Move toggling the report breakage button out of onContentBlockingEvent. r=ewright
authorJohann Hofmann <jhofmann@mozilla.com>
Mon, 15 Apr 2019 20:34:12 +0000
changeset 469562 2c2b6f2cb293
parent 469561 ddb852bfc987
child 469563 5e0cf8b42fcf
push id35874
push userccoroiu@mozilla.com
push dateTue, 16 Apr 2019 04:04:58 +0000
treeherdermozilla-central@be3f40425b52 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersewright
bugs1540416
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 1540416 - Move toggling the report breakage button out of onContentBlockingEvent. r=ewright Differential Revision: https://phabricator.services.mozilla.com/D27254
browser/base/content/browser-contentblocking.js
browser/base/content/browser-siteIdentity.js
--- a/browser/base/content/browser-contentblocking.js
+++ b/browser/base/content/browser-contentblocking.js
@@ -1011,16 +1011,29 @@ var ContentBlocking = {
       body: formData,
     }).then(function(response) {
       if (!response.ok) {
         Cu.reportError(`Content Blocking report to ${reportEndpoint} failed with status ${response.status}`);
       }
     }).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 ||
+        (ThirdPartyCookies.reportBreakageEnabled &&
+         ThirdPartyCookies.activated &&
+         !TrackingProtection.activated)) {
+      this.reportBreakageButton.removeAttribute("hidden");
+    } else {
+      this.reportBreakageButton.setAttribute("hidden", "true");
+    }
+  },
+
   showReportBreakageSubview() {
     // Save this URI to make sure that the user really only submits the location
     // they see in the report breakage dialog.
     this.reportURI = gBrowser.currentURI;
     let urlWithoutQuery = this.reportURI.asciiSpec.replace("?" + this.reportURI.query, "");
     this.reportBreakageURL.value = urlWithoutQuery;
     this.identityPopupMultiView.showSubView("identity-popup-breakageReportView");
   },
@@ -1137,27 +1150,16 @@ var ContentBlocking = {
     // This state will be overriden later if there's an exception set for this site.
     this.content.toggleAttribute("detected", anyDetected);
     this.content.toggleAttribute("blocking", anyBlocking);
     this.content.toggleAttribute("hasException", hasException);
 
     this.iconBox.toggleAttribute("active", anyBlocking);
     this.iconBox.toggleAttribute("hasException", hasException);
 
-    // 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 ||
-        (ThirdPartyCookies.reportBreakageEnabled &&
-         ThirdPartyCookies.activated &&
-         !TrackingProtection.activated)) {
-      this.reportBreakageButton.removeAttribute("hidden");
-    } else {
-      this.reportBreakageButton.setAttribute("hidden", "true");
-    }
-
     if (hasException) {
       this.iconBox.setAttribute("tooltiptext", this.strings.disabledTooltipText);
       if (!this.hadShieldState && !isSimulated) {
         this.hadShieldState = true;
         this.shieldHistogramAdd(1);
       }
     } else if (anyBlocking) {
       this.iconBox.setAttribute("tooltiptext", this.strings.activeTooltipText);
--- a/browser/base/content/browser-siteIdentity.js
+++ b/browser/base/content/browser-siteIdentity.js
@@ -785,16 +785,18 @@ var gIdentityHandler = {
       gNavigatorBundle.getFormattedString("identity.headerWithHost", [host]);
     this._identityPopupContentHost.textContent = host;
     this._identityPopupContentOwner.textContent = owner;
     this._identityPopupContentSupp.textContent = supplemental;
     this._identityPopupContentVerif.textContent = verifier;
 
     // Update per-site permissions section.
     this.updateSitePermissions();
+
+    ContentBlocking.toggleReportBreakageButton();
   },
 
   setURI(uri) {
     this._uri = uri;
 
     try {
       // Account for file: urls and catch when "" is the value
       this._uriHasHost = !!this._uri.host;