author | Mihai Alexandru Michis <malexandru@mozilla.com> |
Thu, 14 Nov 2019 14:59:16 +0200 (2019-11-14) | |
changeset 501923 | 9f6892c03bd8dfcc604461ea90e71430c220fb74 |
parent 501922 | 3a3dda1714d5fb4b818e0a78cc8291b6c98f056f |
child 501924 | 40b09567e312348b311865f3d54bfd08d4dbf58b |
push id | 36801 |
push user | dvarga@mozilla.com |
push date | Thu, 14 Nov 2019 17:12:31 +0000 (2019-11-14) |
treeherder | mozilla-central@a19a226a8c6a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1534339, 1595179 |
milestone | 72.0a1 |
backs out | 14d6dd504f86d34d7f781caf77ac1205b5d9a0ce |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
caps/OriginAttributes.cpp | file | annotate | diff | comparison | revisions | |
caps/tests/gtest/TestOriginAttributes.cpp | file | annotate | diff | comparison | revisions |
--- a/caps/OriginAttributes.cpp +++ b/caps/OriginAttributes.cpp @@ -8,19 +8,16 @@ #include "mozilla/Preferences.h" #include "mozilla/dom/BlobURLProtocolHandler.h" #include "mozilla/dom/URLSearchParams.h" #include "mozilla/dom/quota/QuotaManager.h" #include "nsIEffectiveTLDService.h" #include "nsIURI.h" #include "nsURLHelper.h" -static const char kSourceChar = ':'; -static const char kSanitizedChar = '+'; - namespace mozilla { using dom::URLParams; void OriginAttributes::SetFirstPartyDomain(const bool aIsTopLevelDocument, nsIURI* aURI, bool aForced) { bool isFirstPartyEnabled = IsFirstPartyEnabled(); @@ -143,26 +140,27 @@ void OriginAttributes::CreateSuffix(nsAC if (mPrivateBrowsingId) { value.Truncate(); value.AppendInt(mPrivateBrowsingId); params.Set(NS_LITERAL_STRING("privateBrowsingId"), value); } if (!mFirstPartyDomain.IsEmpty()) { nsAutoString sanitizedFirstPartyDomain(mFirstPartyDomain); - sanitizedFirstPartyDomain.ReplaceChar(kSourceChar, kSanitizedChar); + sanitizedFirstPartyDomain.ReplaceChar( + dom::quota::QuotaManager::kReplaceChars, '+'); params.Set(NS_LITERAL_STRING("firstPartyDomain"), sanitizedFirstPartyDomain); } if (!mGeckoViewSessionContextId.IsEmpty()) { nsAutoString sanitizedGeckoViewUserContextId(mGeckoViewSessionContextId); sanitizedGeckoViewUserContextId.ReplaceChar( - dom::quota::QuotaManager::kReplaceChars, kSanitizedChar); + dom::quota::QuotaManager::kReplaceChars, '+'); params.Set(NS_LITERAL_STRING("geckoViewUserContextId"), sanitizedGeckoViewUserContextId); } aStr.Truncate(); params.Serialize(value); @@ -240,19 +238,17 @@ class MOZ_STACK_CLASS PopulateFromSuffix NS_ENSURE_TRUE(val >= 0 && val <= UINT32_MAX, false); mOriginAttributes->mPrivateBrowsingId = static_cast<uint32_t>(val); return true; } if (aName.EqualsLiteral("firstPartyDomain")) { MOZ_RELEASE_ASSERT(mOriginAttributes->mFirstPartyDomain.IsEmpty()); - nsAutoString firstPartyDomain(aValue); - firstPartyDomain.ReplaceChar(kSanitizedChar, kSourceChar); - mOriginAttributes->mFirstPartyDomain.Assign(firstPartyDomain); + mOriginAttributes->mFirstPartyDomain.Assign(aValue); return true; } if (aName.EqualsLiteral("geckoViewUserContextId")) { MOZ_RELEASE_ASSERT( mOriginAttributes->mGeckoViewSessionContextId.IsEmpty()); mOriginAttributes->mGeckoViewSessionContextId.Assign(aValue); return true;
--- a/caps/tests/gtest/TestOriginAttributes.cpp +++ b/caps/tests/gtest/TestOriginAttributes.cpp @@ -21,18 +21,16 @@ static void TestSuffix(const OriginAttri } static void TestFPD(const nsAString& spec, const nsAString& fpd) { OriginAttributes attrs; nsCOMPtr<nsIURI> url; ASSERT_EQ(NS_NewURI(getter_AddRefs(url), spec), NS_OK); attrs.SetFirstPartyDomain(true, url); EXPECT_TRUE(attrs.mFirstPartyDomain.Equals(fpd)); - - TestSuffix(attrs); } TEST(OriginAttributes, Suffix_default) { OriginAttributes attrs; TestSuffix(attrs); }