From 09fbdaea1c8d8b223d5519d37a48f2e9f1b2269c Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Thu, 10 Jun 2010 18:22:27 -0400 Subject: [PATCH] Backout Bug 570002 (changeset 218c8700878c) due to test failure. --- modules/libpr0n/decoders/icon/nsIconURI.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/libpr0n/decoders/icon/nsIconURI.cpp b/modules/libpr0n/decoders/icon/nsIconURI.cpp index 1b4e07711a5..b262f4af52f 100644 --- a/modules/libpr0n/decoders/icon/nsIconURI.cpp +++ b/modules/libpr0n/decoders/icon/nsIconURI.cpp @@ -251,13 +251,13 @@ nsMozIconURI::SetSpec(const nsACString &aSpec) return NS_OK; } - if (StringBeginsWith(iconPath, NS_LITERAL_CSTRING("//"))) + if (!strncmp("//", iconPath.get(), 2)) { // Sanity check this supposed dummy file name. if (iconPath.Length() > SANE_FILE_NAME_LEN) return NS_ERROR_MALFORMED_URI; - iconPath.Cut(0, 2); - mFileName.Assign(iconPath); + mFileName.Assign(Substring(iconPath, 2)); + return NS_OK; } nsresult rv; @@ -265,10 +265,17 @@ nsMozIconURI::SetSpec(const nsACString &aSpec) NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr uri; - ioService->NewURI(iconPath, nsnull, nsnull, getter_AddRefs(uri)); - mIconURL = do_QueryInterface(uri); + rv = ioService->NewURI(iconPath, nsnull, nsnull, getter_AddRefs(uri)); + if (NS_SUCCEEDED(rv) && uri) + { + nsCOMPtr url(do_QueryInterface(uri, &rv)); + if (NS_SUCCEEDED(rv) && url) + { + mIconURL = url; + } + } - return NS_OK; + return rv; } NS_IMETHODIMP