Fix bug 624764. r=bsmedberg, a=betaN+
authorDan Witte <dwitte@mozilla.com>
Wed, 02 Feb 2011 14:57:48 -0800
changeset 61813 6f2a03f7876d05e99f485c34caeca1e0e8c7620f
parent 61812 a8f321ab835c5773360a51b977b8df3283dce262
child 61814 10c5b6239ce3366157cdc689c33b9af02a9a74c4
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersbsmedberg, betaN
bugs624764
milestone2.0b12pre
Fix bug 624764. r=bsmedberg, a=betaN+
netwerk/protocol/res/nsResProtocolHandler.cpp
--- a/netwerk/protocol/res/nsResProtocolHandler.cpp
+++ b/netwerk/protocol/res/nsResProtocolHandler.cpp
@@ -462,38 +462,34 @@ nsResProtocolHandler::HasSubstitution(co
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsResProtocolHandler::ResolveURI(nsIURI *uri, nsACString &result)
 {
     nsresult rv;
 
-    nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
-    if (!url)
-        return NS_NOINTERFACE;
-
     nsCAutoString host;
     nsCAutoString path;
 
     rv = uri->GetAsciiHost(host);
     if (NS_FAILED(rv)) return rv;
 
     rv = uri->GetPath(path);
     if (NS_FAILED(rv)) return rv;
 
-    nsCAutoString filepath;
-    url->GetFilePath(filepath);
+    // Unescape the path so we can perform some checks on it.
+    nsCAutoString unescapedPath(path);
+    NS_UnescapeURL(unescapedPath);
 
     // Don't misinterpret the filepath as an absolute URI.
-    if (filepath.FindChar(':') != -1)
+    if (unescapedPath.FindChar(':') != -1)
         return NS_ERROR_MALFORMED_URI;
 
-    NS_UnescapeURL(filepath);
-    if (filepath.FindChar('\\') != -1)
+    if (unescapedPath.FindChar('\\') != -1)
         return NS_ERROR_MALFORMED_URI;
 
     const char *p = path.get() + 1; // path always starts with a slash
     NS_ASSERTION(*(p-1) == '/', "Path did not begin with a slash!");
 
     if (*p == '/')
         return NS_ERROR_MALFORMED_URI;