[network] Use query and ref lengths if available in nsStandardURL.

master
Fedor 2020-07-16 03:57:42 +03:00
parent e9004db372
commit f54a76c0b5
1 changed files with 6 additions and 2 deletions

View File

@ -2747,12 +2747,16 @@ nsStandardURL::SetFilePath(const nsACString &input)
return SetSpec(spec);
}
else if (mPath.mLen > 1) {
if (mPath.mLen > 1) {
mSpec.Cut(mPath.mPos + 1, mFilepath.mLen - 1);
// left shift query, and ref
ShiftFromQuery(1 - mFilepath.mLen);
// One character for '/', and if we have a query or ref we add their
// length and one extra for each '?' or '#' characters
mPath.mLen = 1 + (mQuery.mLen >= 0 ? (mQuery.mLen + 1) : 0) +
(mRef.mLen >= 0 ? (mRef.mLen + 1) : 0);
// these contain only a '/'
mPath.mLen = 1;
mDirectory.mLen = 1;
mFilepath.mLen = 1;
// these are no longer defined