Bug 1388494 - Fix incomplete advisory info issue in about:blocked page. r=francois, a=gchang
authorHenry Chang <hchang@mozilla.com>
Fri, 11 Aug 2017 17:16:25 +0800
changeset 421283 5c4087baab4401370982b7ba72eba6426128afa1
parent 421282 743f2fe4e06f7d40f8c02fe197360ed76baadf7e
child 421284 95e016111eb8d1cf9a4353d4bfc073c13443313f
push id7645
push userryanvm@gmail.com
push dateMon, 21 Aug 2017 18:02:19 +0000
treeherdermozilla-beta@2df535c417bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrancois, gchang
bugs1388494, 1366384
milestone56.0
Bug 1388494 - Fix incomplete advisory info issue in about:blocked page. r=francois, a=gchang This is a regression caused by bug 1366384 and needed to be uplifted to 56. You will see this issue when <span id='[reason]_sitename'> is missing in the blockedSite.xhtml content. When <span id=...> is not found, document.getElementById(error + "_sitename").textContent will throw an exception and the subsequent call to remove blank advisory info will be failed to remove. MozReview-Commit-ID: 55umwAegujo
browser/base/content/blockedSite.xhtml
--- a/browser/base/content/blockedSite.xhtml
+++ b/browser/base/content/blockedSite.xhtml
@@ -117,18 +117,22 @@
           el = document.getElementById("errorTitleText_unwanted");
           el.remove();
           el = document.getElementById("errorShortDescText_unwanted");
           el.remove();
           el = document.getElementById("errorLongDescText_unwanted");
           el.remove();
         }
 
-        // Set sitename
-        document.getElementById(error + "_sitename").textContent = getHostString();
+        // Set sitename if necessary.
+        let sitenameElem = document.getElementById(error + "_sitename");
+        if (sitenameElem) {
+          sitenameElem.textContent = getHostString();
+        }
+
         document.title = document.getElementById("errorTitleText_" + error)
                                  .innerHTML;
 
         if (!getOverride()) {
           var btn = document.getElementById("ignoreWarningButton");
           if (btn) {
             btn.remove();
           }