Bug 380932 - Handle malware URIs with error page. Patch by Dão Gottwald <dao@design-noir.de>. r=cbiesinger
authorsdwilsh@shawnwilsher.com
Thu, 05 Jul 2007 15:26:06 -0700
changeset 3173 5f301b040b92776dfec6d3dd3fa862e216db5b23
parent 3172 c06f6e1a047aef98b41e8d36f8c061c0251f580c
child 3174 05f8604dfd126f2d7564395469abe327dfdefcc6
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscbiesinger
bugs380932
milestone1.9a7pre
Bug 380932 - Handle malware URIs with error page. Patch by Dão Gottwald <dao@design-noir.de>. r=cbiesinger
docshell/resources/content/netError.xhtml
--- a/docshell/resources/content/netError.xhtml
+++ b/docshell/resources/content/netError.xhtml
@@ -81,34 +81,35 @@
         var error = url.search(/e\=/);
         var duffUrl = url.search(/\&u\=/);
         return decodeURIComponent(url.slice(error + 2, duffUrl));
       }
 
       function getCSSClass()
       {
         var url = document.documentURI;
-        var class = url.search(/c\=/);
+        var classParam = url.search(/c\=/);
         
-        // c is optional, if class === -1 just return nothing
-        if (class === -1)
+        // c is optional, if classParam == -1 just return nothing
+        if (classParam == -1)
           return "";
           
         var rest = url.search(/\&/);
-        return decodeURIComponent(url.slice(class + 2, rest));
+        return decodeURIComponent(url.slice(classParam + 2, rest));
       }
 
       function getDescription()
       {
         var url = document.documentURI;
         var desc = url.search(/d\=/);
 
         // desc == -1 if not found; if so, return an empty string
         // instead of what would turn out to be portions of the URI
-        if (desc == -1) return "";
+        if (desc == -1)
+          return "";
 
         return decodeURIComponent(url.slice(desc + 2));
       }
 
       function retryThis(buttonEl)
       {
         // Session history has the URL of the page that failed
         // to load, not the one of the error page. So, just call
@@ -156,29 +157,29 @@
           // change id to the replaced child's id so styling works
           errDesc.id = "errorLongDesc";
         }
 
         // remove undisplayed errors to avoid bug 39098
         var errContainer = document.getElementById("errorContainer");
         errContainer.parentNode.removeChild(errContainer);
 
-        var class = getCSSClass();
-        if (class) {
+        var className = getCSSClass();
+        if (className) {
           // Associate a CSS class with the root of the page, if one was passed in,
           // to allow custom styling.
-          document.documentElement.className = class;
+          document.documentElement.className = className;
 
           // Also, if they specified a CSS class, they must supply their own
           // favicon.  In order to trigger the browser to repaint though, we
           // need to remove/add the link element. 
           var favicon = document.getElementById("favicon");
           var faviconParent = favicon.parentNode;
           faviconParent.removeChild(favicon);
-          favicon.setAttribute("href", "chrome://global/skin/icons/" + class + "_favicon.png");
+          favicon.setAttribute("href", "chrome://global/skin/icons/" + className + "_favicon.png");
           faviconParent.appendChild(favicon);
         }
       }
     ]]></script>
   </head>
 
   <body dir="&locale.dir;">