diff --git a/content/base/src/nsXHTMLContentSerializer.cpp b/content/base/src/nsXHTMLContentSerializer.cpp index 66d046dbae5..99c6b45d5b8 100644 --- a/content/base/src/nsXHTMLContentSerializer.cpp +++ b/content/base/src/nsXHTMLContentSerializer.cpp @@ -224,8 +224,9 @@ nsXHTMLContentSerializer::EscapeURI(nsIContent* aContent, const nsAString& aURI, nsXPIDLCString escapedURI; aEscapedURI.Truncate(0); - // Loop and escape parts by avoiding escaping reserved characters (and '%', '#' ). - while ((end = uri.FindCharInSet("%#;/?:@&=+$,", start)) != -1) { + // Loop and escape parts by avoiding escaping reserved characters + // (and '%', '#', as well as '[' and ']' for IPv6 address literals). + while ((end = uri.FindCharInSet("%#;/?:@&=+$,[]", start)) != -1) { part = Substring(aURI, start, (end-start)); if (textToSubURI && !IsASCII(part)) { rv = textToSubURI->ConvertAndEscape(mCharset.get(), part.get(), getter_Copies(escapedURI)); diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in index 15099885cec..91f09d0ba6a 100644 --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -310,6 +310,9 @@ _TEST_FILES = test_bug5141.html \ test_bug466751.xhtml \ test_bug461555.html \ test_sync_xhr_timer.xhtml \ + file_htmlserializer_ipv6.html \ + file_htmlserializer_ipv6_out.html \ + test_bug498433.html \ $(NULL) # Disabled; see bug 492181 # test_plugin_freezing.html diff --git a/content/base/test/file_htmlserializer_ipv6.html b/content/base/test/file_htmlserializer_ipv6.html new file mode 100644 index 00000000000..9a8f9da26a5 --- /dev/null +++ b/content/base/test/file_htmlserializer_ipv6.html @@ -0,0 +1,8 @@ + + + +
+ ++ + + + +