Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Issue 5783 (Display of IPv6 addresses with port number is incorrect)

  • Loading branch information...
commit 4aed1a1d94937505155f975feea8f74658b36022 1 parent c0ffab9
@SebastianZ SebastianZ authored
View
40 extension/content/firebug/lib/string.js
@@ -386,7 +386,7 @@ Str.unescapeForTextNode = function(str)
str = escapeForElementAttribute(str);
return str;
-}
+};
Str.unescapeForURL = createSimpleEscape('text', 'reverse');
@@ -532,17 +532,17 @@ Str.splitLines = function(text)
Str.trim = function(text)
{
return text.replace(/^\s*|\s*$/g, "");
-}
+};
Str.trimLeft = function(text)
{
return text.replace(/^\s+/, "");
-}
+};
Str.trimRight = function(text)
{
return text.replace(/\s+$/, "");
-}
+};
Str.hasPrefix = function(hay, needle)
{
@@ -591,13 +591,13 @@ Str.wrapText = function(text, noEscapeHTML)
}
return html;
-}
+};
Str.insertWrappedText = function(text, textBox, noEscapeHTML)
{
var html = Str.wrapText(text, noEscapeHTML);
textBox.innerHTML = "<pre role=\"list\">" + html.join("") + "</pre>";
-}
+};
// ************************************************************************************************
// Indent
@@ -625,7 +625,7 @@ Str.cleanIndentation = function(text)
lines[i] = line.substr(minIndent);
}
return lines.join("");
-}
+};
// ************************************************************************************************
// Formatting
@@ -679,7 +679,7 @@ Str.formatSize = function(bytes)
result = Math.round((bytes/(1024*1024))*a)/a + " MB";
return negative ? "-" + result : result;
-}
+};
Str.formatTime = function(elapsed)
{
@@ -697,7 +697,29 @@ Str.formatTime = function(elapsed)
var sec = (elapsed % 60000);
return min + "m " + (Math.round((elapsed/1000)%60)) + "s";
}
-}
+};
+
+/**
+ * Formats an IPv4 or IPv6 address incl. port
+ * @param {String} address IP address to format
+ * @param {String} [port] IP port to format
+ * @returns {String} Formatted IP address
+ */
+Str.formatIP = function(address, port)
+{
+ if (!address || address == "")
+ return "";
+
+ var result = address;
+ var isIPv6Address = address.indexOf(":") != -1;
+ if (isIPv6Address)
+ result = "["+result+"]";
+
+ if (port && port != "")
+ result += ":"+port;
+
+ return result;
+};
//********************************************************************************************* //
//Conversions
View
16 extension/content/firebug/net/netReps.js
@@ -681,24 +681,12 @@ Firebug.NetMonitor.NetRequestEntry = domplate(Firebug.Rep, new Firebug.Listener(
getLocalAddress: function(file)
{
- var address = file.localAddress ? file.localAddress : "";
- var port = file.localPort ? file.localPort : "";
-
- var result = address;
- result += result ? ":" : "";
- result += port;
- return result;
+ return Str.formatIP(file.localAddress, file.localPort);
},
getRemoteAddress: function(file)
{
- var address = file.remoteAddress ? file.remoteAddress : "";
- var port = file.remotePort ? file.remotePort : "";
-
- var result = address;
- result += result ? ":" : "";
- result += port;
- return result;
+ return Str.formatIP(file.remoteAddress, file.remotePort);
},
getElapsedTime: function(file)
Please sign in to comment.
Something went wrong with that request. Please try again.