Bug 652186 - Remove unneeded backslash replacement from nsDefaultURIFixup r?bz draft
authorValentin Gosu <valentin.gosu@gmail.com>
Thu, 03 Mar 2016 15:27:43 +0100
changeset 336513 758fcef0c6a18aa306c090a5e0a702d92a6da17c
parent 336512 9abc8cb7971ea575380649e5d9d969713ee5edc1
child 336514 5b88f552207da82dc1daec19a5d403b2a7197fb2
child 336518 83a62ad1797c4140a903c4dff5493441612e6f8c
push id12095
push uservalentin.gosu@gmail.com
push dateThu, 03 Mar 2016 14:44:04 +0000
reviewersbz
bugs652186
milestone47.0a1
Bug 652186 - Remove unneeded backslash replacement from nsDefaultURIFixup r?bz MozReview-Commit-ID: 5IPxr8nWk7b
docshell/base/nsDefaultURIFixup.cpp
--- a/docshell/base/nsDefaultURIFixup.cpp
+++ b/docshell/base/nsDefaultURIFixup.cpp
@@ -217,55 +217,16 @@ nsDefaultURIFixup::GetFixupURIInfo(const
     // NB: FileURIFixup only returns a URI if it had to fix the protocol to
     // do so, so passing in file:///foo/bar will not hit this path:
     if (uri) {
       uri.swap(info->mFixedURI);
       info->mPreferredURI = info->mFixedURI;
       info->mFixupChangedProtocol = true;
       return NS_OK;
     }
-
-#if defined(XP_WIN)
-    // Not a file URL, so translate '\' to '/' for convenience in the common
-    // protocols. E.g. catch
-    //
-    //   http:\\broken.com\address
-    //   http:\\broken.com/blah
-    //   broken.com\blah
-    //
-    // Code will also do partial fix up the following urls
-    //
-    //   http:\\broken.com\address/somewhere\image.jpg (stops at first forward slash)
-    //   http:\\broken.com\blah?arg=somearg\foo.jpg (stops at question mark)
-    //   http:\\broken.com#odd\ref (stops at hash)
-    //
-    if (scheme.IsEmpty() ||
-        scheme.LowerCaseEqualsLiteral("http") ||
-        scheme.LowerCaseEqualsLiteral("https") ||
-        scheme.LowerCaseEqualsLiteral("ftp")) {
-      // Walk the string replacing backslashes with forward slashes until
-      // the end is reached, or a question mark, or a hash, or a forward
-      // slash. The forward slash test is to stop before trampling over
-      // URIs which legitimately contain a mix of both forward and
-      // backward slashes.
-      nsAutoCString::iterator start;
-      nsAutoCString::iterator end;
-      uriString.BeginWriting(start);
-      uriString.EndWriting(end);
-      while (start != end) {
-        if (*start == '?' || *start == '#' || *start == '/') {
-          break;
-        }
-        if (*start == '\\') {
-          *start = '/';
-        }
-        ++start;
-      }
-    }
-#endif
   }
 
   if (!sInitializedPrefCaches) {
     // Check if we want to fix up common scheme typos.
     rv = Preferences::AddBoolVarCache(&sFixTypos,
                                       "browser.fixup.typo.scheme",
                                       sFixTypos);
     MOZ_ASSERT(NS_SUCCEEDED(rv),