Commit 33799b61 authored by Mihai Alexandru Michis's avatar Mihai Alexandru Michis
Browse files

Backed out changeset 14d6dd504f86 (bug 1534339) for causing Bug 1595179. CLOSED TREE

--HG--
extra : rebase_source : 101262411debddee38453d05fdfb7327fe03438e
extra : histedit_source : 1ddb09ebad301dfc19bccf12386e7d0beb43cb1a
parent 64a0fd0a
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -13,9 +13,6 @@
#include "nsIURI.h"
#include "nsURLHelper.h"

static const char kSourceChar = ':';
static const char kSanitizedChar = '+';

namespace mozilla {

using dom::URLParams;
@@ -148,7 +145,8 @@ void OriginAttributes::CreateSuffix(nsACString& aStr) const {

  if (!mFirstPartyDomain.IsEmpty()) {
    nsAutoString sanitizedFirstPartyDomain(mFirstPartyDomain);
    sanitizedFirstPartyDomain.ReplaceChar(kSourceChar, kSanitizedChar);
    sanitizedFirstPartyDomain.ReplaceChar(
        dom::quota::QuotaManager::kReplaceChars, '+');

    params.Set(NS_LITERAL_STRING("firstPartyDomain"),
               sanitizedFirstPartyDomain);
@@ -157,7 +155,7 @@ void OriginAttributes::CreateSuffix(nsACString& aStr) const {
  if (!mGeckoViewSessionContextId.IsEmpty()) {
    nsAutoString sanitizedGeckoViewUserContextId(mGeckoViewSessionContextId);
    sanitizedGeckoViewUserContextId.ReplaceChar(
        dom::quota::QuotaManager::kReplaceChars, kSanitizedChar);
        dom::quota::QuotaManager::kReplaceChars, '+');

    params.Set(NS_LITERAL_STRING("geckoViewUserContextId"),
               sanitizedGeckoViewUserContextId);
@@ -245,9 +243,7 @@ class MOZ_STACK_CLASS PopulateFromSuffixIterator final

    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;
    }

+0 −2
Original line number Diff line number Diff line
@@ -26,8 +26,6 @@ static void TestFPD(const nsAString& spec, const nsAString& fpd) {
  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)