@@ -891,33 +891,12 @@ nsresult nsStandardURL::BuildNormalizedSpec(const char* spec,
891891 // However, perform Unicode normalization on it, as IDN does.
892892 // Note that we don't disallow URLs without a host - file:, etc
893893 if (mHost .mLen > 0 ) {
894- <<<<<<< HEAD
895- nsAutoCString tempHost;
894+ nsDependentCSubstring tempHost (spec + mHost .mPos , mHost .mLen );
896895 SafeStringTaint mHostTaint ;
897896 if (taint.hasTaint ()) {
898897 mHostTaint = taint.safeSubTaint (mHost .mPos , mHost .mPos + mHost .mLen );
898+ tempHost.AssignTaint (mHostTaint );
899899 }
900- NS_UnescapeURL (spec + mHost .mPos , mHost .mLen , mHostTaint , esc_AlwaysCopy | esc_Host,
901- tempHost);
902- if (tempHost.Contains (' \0 ' )) {
903- return NS_ERROR_MALFORMED_URI; // null embedded in hostname
904- }
905- if (tempHost.Contains (' ' )) {
906- return NS_ERROR_MALFORMED_URI; // don't allow spaces in the hostname
907- }
908- nsresult rv = NormalizeIDN (tempHost, encHost);
909- if (NS_FAILED(rv)) {
910- return rv;
911- }
912- if (!SegmentIs (spec, mScheme , " resource" ) &&
913- !SegmentIs (spec, mScheme , " chrome" )) {
914- nsAutoCString ipString;
915- if (encHost.Length () > 0 && encHost.First () == ' [' &&
916- encHost.Last () == ' ]' &&
917- ValidIPv6orHostname (encHost.get (), encHost.Length ())) {
918- rv = (nsresult)rusturl_parse_ipv6addr (&encHost, &ipString);
919- =======
920- nsDependentCSubstring tempHost (spec + mHost .mPos , mHost .mLen );
921900 nsresult rv;
922901 bool allowIp = !SegmentIs (spec, mScheme , " resource" ) &&
923902 !SegmentIs (spec, mScheme , " chrome" );
@@ -935,7 +914,6 @@ nsresult nsStandardURL::BuildNormalizedSpec(const char* spec,
935914 if (EndsInANumber (encHost) && allowIp) {
936915 nsAutoCString ipString;
937916 rv = NormalizeIPv4 (encHost, ipString);
938- >>>>>>> bc78b98043438d8ee2727a483b6e10dedfda883f
939917 if (NS_FAILED(rv)) {
940918 return rv;
941919 }
@@ -2210,18 +2188,8 @@ nsresult nsStandardURL::SetHost(const nsACString& input) {
22102188
22112189 FindHostLimit (start, end);
22122190
2213- <<<<<<< HEAD
2214- // Do percent decoding on the the input.
2215- nsAutoCString flat;
2216- NS_UnescapeURL (hostname.BeginReading(), end - start,
2217- hostname.Taint(),
2218- esc_AlwaysCopy | esc_Host, flat);
2219- const char * host = flat.get ();
2220-
2221- LOG ((" nsStandardURL::SetHost [host=%s]\n " , host));
2222- =======
22232191 nsDependentCSubstring flat (start, end);
2224- >>>>>>> bc78b98043438d8ee2727a483b6e10dedfda883f
2192+ flat. AssignTaint (hostname. Taint ());
22252193
22262194 if (mURLType == URLTYPE_NO_AUTHORITY) {
22272195 if (flat.IsEmpty ()) {
@@ -2294,11 +2262,7 @@ nsresult nsStandardURL::SetHost(const nsACString& input) {
22942262 }
22952263 }
22962264
2297- <<<<<<< HEAD
2298- int32_t shift = ReplaceSegment (mHost .mPos , mHost .mLen , host, len, hostBuf.Taint ());
2299- =======
2300- int32_t shift = ReplaceSegment (mHost .mPos , mHost .mLen , hostBuf.get (), len);
2301- >>>>>>> bc78b98043438d8ee2727a483b6e10dedfda883f
2265+ int32_t shift = ReplaceSegment (mHost .mPos , mHost .mLen , hostBuf.get (), len, hostBuf.Taint ());
23022266
23032267 if (shift) {
23042268 mHost .mLen = len;
0 commit comments