Bug 1170476 - Avoid logging multiple SHA-1 warnings per page. r=past, a=kglazko
authorMark Goodwin <mgoodwin@mozilla.com>
Tue, 07 Jul 2015 17:26:59 +0100
changeset 268792 ea81274ad510b589bb2a78f73985168c8aae9a7d
parent 268791 ff1058741c2c37f394cfd35ae0a889a92e7f2ee9
child 268793 45221d7387dbb777b83711373a9aa5865ce1d7c6
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-esr52@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast, kglazko
bugs1170476
milestone41.0a2
Bug 1170476 - Avoid logging multiple SHA-1 warnings per page. r=past, a=kglazko
browser/devtools/webconsole/webconsole.js
--- a/browser/devtools/webconsole/webconsole.js
+++ b/browser/devtools/webconsole/webconsole.js
@@ -1445,20 +1445,30 @@ WebConsoleFrame.prototype = {
       }
     }
 
     let errorMessage = aScriptError.errorMessage;
     if (errorMessage.type && errorMessage.type == "longString") {
       errorMessage = errorMessage.initial;
     }
 
+    let displayOrigin = aScriptError.sourceName;
+
+    // TLS errors are related to the connection and not the resource; therefore
+    // it makes sense to only display the protcol, host and port (prePath).
+    // This also means messages are grouped for a single origin.
+    if (aScriptError.category && aScriptError.category == "SHA-1 Signature") {
+      let sourceURI = Services.io.newURI(aScriptError.sourceName, null, null).QueryInterface(Ci.nsIURL);
+      displayOrigin = sourceURI.prePath;
+    }
+
     // Create a new message
     let msg = new Messages.Simple(errorMessage, {
       location: {
-        url: aScriptError.sourceName,
+        url: displayOrigin,
         line: aScriptError.lineNumber,
         column: aScriptError.columnNumber
       },
       category: category,
       severity: severity,
       timestamp: aScriptError.timeStamp,
       private: aScriptError.private,
       filterDuplicates: true