Bug 1594540 - Fix the off-by-one error that breaks login on Pinterest.com; r=baku

Differential Revision: https://phabricator.services.mozilla.com/D53770

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ehsan Akhgari 2019-11-20 18:22:11 +00:00
parent 0725ad16ee
commit eaec09c277
2 changed files with 9 additions and 5 deletions

View File

@ -10259,9 +10259,9 @@ bool nsContentUtils::IsURIInList(nsIURI* aURI, const nsCString& aBlackList) {
if (StringBeginsWith(filePath, pathInBlackList) &&
(filePath.Length() == pathInBlackList.Length() ||
pathInBlackList.EqualsLiteral("/") ||
filePath[pathInBlackList.Length()] == '/' ||
filePath[pathInBlackList.Length()] == '?' ||
filePath[pathInBlackList.Length()] == '#')) {
filePath[pathInBlackList.Length() - 1] == '/' ||
filePath[pathInBlackList.Length() - 1] == '?' ||
filePath[pathInBlackList.Length() - 1] == '#')) {
return true;
}
}

View File

@ -43,8 +43,12 @@ TEST(DOM_Base_ContentUtils, IsURIInList)
{NS_LITERAL_CSTRING("example.com/pa,*.example.com/pa"), false, false},
{NS_LITERAL_CSTRING("*.example.com/pa/,example.com/pa/"), false, false},
{NS_LITERAL_CSTRING("example.com/pa/,*.example.com/pa/"), false, false},
{NS_LITERAL_CSTRING("*.example.com/path,example.com/path"), true, false},
{NS_LITERAL_CSTRING("example.com/path,*.example.com/path"), true, false},
{NS_LITERAL_CSTRING("*.example.com/path,example.com/path"), false, false},
{NS_LITERAL_CSTRING("example.com/path,*.example.com/path"), false, false},
{NS_LITERAL_CSTRING("*.example.com/path/,example.com/path/"), true,
false},
{NS_LITERAL_CSTRING("example.com/path/,*.example.com/path/"), true,
false},
{NS_LITERAL_CSTRING("*.example.com/favicon.ico"), false, true},
{NS_LITERAL_CSTRING("example.com/path/favicon.ico"), true, false},
{NS_LITERAL_CSTRING("*.example.com"), false, true},