[Pkg-mozext-commits] [firebug] 07/24: Issue 5783 (Display of IPv6 addresses with port number is incorrect) http://code.google.com/p/fbug/issues/detail?id=5783
David Prévot
taffit at moszumanska.debian.org
Mon Mar 31 22:46:31 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag firebug-1.10.4
in repository firebug.
commit 4aed1a1d94937505155f975feea8f74658b36022
Author: Sebastian Zartner <sebastianzartner at gmail.com>
Date: Sat Sep 15 10:17:44 2012 +0200
Issue 5783 (Display of IPv6 addresses with port number is incorrect)
http://code.google.com/p/fbug/issues/detail?id=5783
---
extension/content/firebug/lib/string.js | 40 +++++++++++++++++++++++++-------
extension/content/firebug/net/netReps.js | 16 ++-----------
2 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/extension/content/firebug/lib/string.js b/extension/content/firebug/lib/string.js
index f9e98c1..469a40e 100644
--- a/extension/content/firebug/lib/string.js
+++ b/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
diff --git a/extension/content/firebug/net/netReps.js b/extension/content/firebug/net/netReps.js
index 63d47f7..2659bc4 100644
--- a/extension/content/firebug/net/netReps.js
+++ b/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)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git
More information about the Pkg-mozext-commits
mailing list