mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1770944 - Remove other references to inBrowserElement, r=cookie-reviewers,valentin,janv,decoder
Depends on D183230 Differential Revision: https://phabricator.services.mozilla.com/D189490
This commit is contained in:
parent
67db960e48
commit
b1d6f2eeb8
@ -874,9 +874,6 @@ add_task(async function checkAllTheFiles() {
|
||||
// Wait for all manifest to be parsed
|
||||
await PerfTestHelpers.throttledMapPromises(manifestURIs, parseManifest);
|
||||
|
||||
for (let jsm of Components.manager.getComponentJSMs()) {
|
||||
gReferencesFromCode.set(jsm, null);
|
||||
}
|
||||
for (let esModule of Components.manager.getComponentESModules()) {
|
||||
gReferencesFromCode.set(esModule, null);
|
||||
}
|
||||
|
@ -229,10 +229,6 @@ void OriginAttributes::CreateSuffix(nsACString& aStr) const {
|
||||
// naming.
|
||||
//
|
||||
|
||||
if (mInIsolatedMozBrowser) {
|
||||
params.Set(u"inBrowser"_ns, u"1"_ns);
|
||||
}
|
||||
|
||||
if (mUserContextId != nsIScriptSecurityManager::DEFAULT_USER_CONTEXT_ID) {
|
||||
value.Truncate();
|
||||
value.AppendInt(mUserContextId);
|
||||
@ -335,7 +331,6 @@ bool OriginAttributes::PopulateFromSuffix(const nsACString& aStr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mInIsolatedMozBrowser = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -17,10 +17,6 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
|
||||
public:
|
||||
OriginAttributes() = default;
|
||||
|
||||
explicit OriginAttributes(bool aInIsolatedMozBrowser) {
|
||||
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
|
||||
}
|
||||
|
||||
explicit OriginAttributes(const OriginAttributesDictionary& aOther)
|
||||
: OriginAttributesDictionary(aOther) {}
|
||||
|
||||
@ -74,8 +70,7 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
|
||||
}
|
||||
|
||||
[[nodiscard]] bool EqualsIgnoringFPD(const OriginAttributes& aOther) const {
|
||||
return mInIsolatedMozBrowser == aOther.mInIsolatedMozBrowser &&
|
||||
mUserContextId == aOther.mUserContextId &&
|
||||
return mUserContextId == aOther.mUserContextId &&
|
||||
mPrivateBrowsingId == aOther.mPrivateBrowsingId &&
|
||||
mGeckoViewSessionContextId == aOther.mGeckoViewSessionContextId;
|
||||
}
|
||||
@ -159,11 +154,6 @@ class OriginAttributesPattern : public dom::OriginAttributesPatternDictionary {
|
||||
|
||||
// Performs a match of |aAttrs| against this pattern.
|
||||
bool Matches(const OriginAttributes& aAttrs) const {
|
||||
if (mInIsolatedMozBrowser.WasPassed() &&
|
||||
mInIsolatedMozBrowser.Value() != aAttrs.mInIsolatedMozBrowser) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mUserContextId.WasPassed() &&
|
||||
mUserContextId.Value() != aAttrs.mUserContextId) {
|
||||
return false;
|
||||
@ -227,12 +217,6 @@ class OriginAttributesPattern : public dom::OriginAttributesPatternDictionary {
|
||||
}
|
||||
|
||||
bool Overlaps(const OriginAttributesPattern& aOther) const {
|
||||
if (mInIsolatedMozBrowser.WasPassed() &&
|
||||
aOther.mInIsolatedMozBrowser.WasPassed() &&
|
||||
mInIsolatedMozBrowser.Value() != aOther.mInIsolatedMozBrowser.Value()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mUserContextId.WasPassed() && aOther.mUserContextId.WasPassed() &&
|
||||
mUserContextId.Value() != aOther.mUserContextId.Value()) {
|
||||
return false;
|
||||
|
@ -45,12 +45,6 @@ TEST(OriginAttributes, Suffix_default)
|
||||
TestSuffix(attrs);
|
||||
}
|
||||
|
||||
TEST(OriginAttributes, Suffix_inIsolatedMozBrowser)
|
||||
{
|
||||
OriginAttributes attrs(true);
|
||||
TestSuffix(attrs);
|
||||
}
|
||||
|
||||
TEST(OriginAttributes, FirstPartyDomain_default)
|
||||
{
|
||||
bool oldFpiPref = Preferences::GetBool(FPI_PREF);
|
||||
|
@ -129,8 +129,7 @@ class ChromeUtils {
|
||||
static bool IsOriginAttributesEqualIgnoringFPD(
|
||||
const dom::OriginAttributesDictionary& aA,
|
||||
const dom::OriginAttributesDictionary& aB) {
|
||||
return aA.mInIsolatedMozBrowser == aB.mInIsolatedMozBrowser &&
|
||||
aA.mUserContextId == aB.mUserContextId &&
|
||||
return aA.mUserContextId == aB.mUserContextId &&
|
||||
aA.mPrivateBrowsingId == aB.mPrivateBrowsingId;
|
||||
}
|
||||
|
||||
|
@ -954,7 +954,6 @@ dictionary IOActivityDataDictionary {
|
||||
[GenerateInitFromJSON]
|
||||
dictionary OriginAttributesDictionary {
|
||||
unsigned long userContextId = 0;
|
||||
boolean inIsolatedMozBrowser = false;
|
||||
unsigned long privateBrowsingId = 0;
|
||||
DOMString firstPartyDomain = "";
|
||||
DOMString geckoViewSessionContextId = "";
|
||||
@ -964,7 +963,6 @@ dictionary OriginAttributesDictionary {
|
||||
[GenerateInitFromJSON, GenerateToJSON]
|
||||
dictionary OriginAttributesPatternDictionary {
|
||||
unsigned long userContextId;
|
||||
boolean inIsolatedMozBrowser;
|
||||
unsigned long privateBrowsingId;
|
||||
DOMString firstPartyDomain;
|
||||
DOMString geckoViewSessionContextId;
|
||||
|
@ -109,6 +109,7 @@
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "mozilla/net/ExtensionProtocolHandler.h"
|
||||
#include "mozilla/StorageOriginAttributes.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -3211,7 +3212,7 @@ nsresult QuotaManager::CreateDirectoryMetadata(
|
||||
const OriginMetadata& aOriginMetadata) {
|
||||
AssertIsOnIOThread();
|
||||
|
||||
OriginAttributes groupAttributes;
|
||||
StorageOriginAttributes groupAttributes;
|
||||
|
||||
nsCString groupNoSuffix;
|
||||
QM_TRY(OkIf(groupAttributes.PopulateFromOrigin(aOriginMetadata.mGroup,
|
||||
@ -3219,11 +3220,11 @@ nsresult QuotaManager::CreateDirectoryMetadata(
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCString groupPrefix;
|
||||
GetJarPrefix(groupAttributes.mInIsolatedMozBrowser, groupPrefix);
|
||||
GetJarPrefix(groupAttributes.InIsolatedMozBrowser(), groupPrefix);
|
||||
|
||||
nsCString group = groupPrefix + groupNoSuffix;
|
||||
|
||||
OriginAttributes originAttributes;
|
||||
StorageOriginAttributes originAttributes;
|
||||
|
||||
nsCString originNoSuffix;
|
||||
QM_TRY(OkIf(originAttributes.PopulateFromOrigin(aOriginMetadata.mOrigin,
|
||||
@ -3231,7 +3232,7 @@ nsresult QuotaManager::CreateDirectoryMetadata(
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCString originPrefix;
|
||||
GetJarPrefix(originAttributes.mInIsolatedMozBrowser, originPrefix);
|
||||
GetJarPrefix(originAttributes.InIsolatedMozBrowser(), originPrefix);
|
||||
|
||||
nsCString origin = originPrefix + originNoSuffix;
|
||||
|
||||
|
@ -216,11 +216,7 @@ void OriginParser::HandleToken(const nsDependentCSubstring& aToken) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aToken.First() == 't') {
|
||||
mInIsolatedMozBrowser = true;
|
||||
} else if (aToken.First() == 'f') {
|
||||
mInIsolatedMozBrowser = false;
|
||||
} else {
|
||||
if ((aToken.First() != 't') && (aToken.First() != 'f')) {
|
||||
QM_WARNING("'%s' is not a valid value for the inMozBrowser flag!",
|
||||
nsCString(aToken).get());
|
||||
|
||||
|
@ -65,7 +65,6 @@ class MOZ_STACK_CLASS OriginParser final {
|
||||
|
||||
SchemeType mSchemeType;
|
||||
State mState;
|
||||
bool mInIsolatedMozBrowser;
|
||||
bool mUniversalFileOrigin;
|
||||
bool mMaybeDriveLetter;
|
||||
bool mError;
|
||||
@ -80,7 +79,6 @@ class MOZ_STACK_CLASS OriginParser final {
|
||||
mTokenizer(aOrigin, '+'),
|
||||
mSchemeType(eNone),
|
||||
mState(eExpectingAppIdOrScheme),
|
||||
mInIsolatedMozBrowser(false),
|
||||
mUniversalFileOrigin(false),
|
||||
mMaybeDriveLetter(false),
|
||||
mError(false),
|
||||
|
@ -64,7 +64,6 @@ struct ParamTraits<mozilla::OriginAttributesPattern> {
|
||||
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mFirstPartyDomain);
|
||||
WriteParam(aWriter, aParam.mInIsolatedMozBrowser);
|
||||
WriteParam(aWriter, aParam.mPrivateBrowsingId);
|
||||
WriteParam(aWriter, aParam.mUserContextId);
|
||||
WriteParam(aWriter, aParam.mGeckoViewSessionContextId);
|
||||
@ -72,7 +71,6 @@ struct ParamTraits<mozilla::OriginAttributesPattern> {
|
||||
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mFirstPartyDomain) &&
|
||||
ReadParam(aReader, &aResult->mInIsolatedMozBrowser) &&
|
||||
ReadParam(aReader, &aResult->mPrivateBrowsingId) &&
|
||||
ReadParam(aReader, &aResult->mUserContextId) &&
|
||||
ReadParam(aReader, &aResult->mGeckoViewSessionContextId);
|
||||
|
@ -57,4 +57,19 @@ bool StorageOriginAttributes::PopulateFromOrigin(const nsACString& aOrigin,
|
||||
return PopulateFromSuffix(Substring(origin, pos));
|
||||
}
|
||||
|
||||
void StorageOriginAttributes::CreateSuffix(nsACString& aStr) const {
|
||||
URLParams params;
|
||||
nsAutoString value;
|
||||
|
||||
if (mInIsolatedMozBrowser) {
|
||||
params.Set(u"inBrowser"_ns, u"1"_ns);
|
||||
}
|
||||
|
||||
params.Serialize(value, true);
|
||||
if (!value.IsEmpty()) {
|
||||
aStr.AppendLiteral("^");
|
||||
aStr.Append(NS_ConvertUTF16toUTF8(value));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -15,12 +15,20 @@ namespace mozilla {
|
||||
// in OriginAttributes class anymore.
|
||||
class StorageOriginAttributes {
|
||||
public:
|
||||
StorageOriginAttributes() = default;
|
||||
explicit StorageOriginAttributes(bool aInIsolatedMozBrowser) {
|
||||
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
|
||||
}
|
||||
bool InIsolatedMozBrowser() const { return mInIsolatedMozBrowser; }
|
||||
|
||||
uint32_t UserContextId() const { return mOriginAttributes.mUserContextId; }
|
||||
|
||||
// New getters can be added here incrementally.
|
||||
|
||||
void SetInIsolatedMozBrowser(bool aInIsolatedMozBrowser) {
|
||||
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool PopulateFromSuffix(const nsACString& aStr);
|
||||
|
||||
// Populates the attributes from a string like
|
||||
@ -28,6 +36,10 @@ class StorageOriginAttributes {
|
||||
[[nodiscard]] bool PopulateFromOrigin(const nsACString& aOrigin,
|
||||
nsACString& aOriginNoSuffix);
|
||||
|
||||
/* XXX This method only supports the legacy mInIsolatedMozBrowser at the
|
||||
moment, other origin attributes won't be serialized */
|
||||
void CreateSuffix(nsACString& aStr) const;
|
||||
|
||||
private:
|
||||
OriginAttributes mOriginAttributes;
|
||||
|
||||
|
@ -162,4 +162,24 @@ TEST(DOM_Quota_StorageOriginAttributes, PopulateFromOrigin_Mixed_Invalid)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DOM_Quota_StorageOriginAttributes, CreateSuffix_Mozbrowser)
|
||||
{
|
||||
{
|
||||
StorageOriginAttributes originAttributes(true);
|
||||
nsCString suffix;
|
||||
originAttributes.CreateSuffix(suffix);
|
||||
ASSERT_EQ(suffix, "^inBrowser=1");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DOM_Quota_StorageOriginAttributes, CreateSuffix_NoMozbrowser)
|
||||
{
|
||||
{
|
||||
StorageOriginAttributes originAttributes(false);
|
||||
nsCString suffix;
|
||||
originAttributes.CreateSuffix(suffix);
|
||||
ASSERT_EQ(suffix, "");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla::dom::quota::test
|
||||
|
@ -219,7 +219,7 @@ TEST(ServiceWorkerRegistrar, TestReadData)
|
||||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
@ -280,30 +280,24 @@ TEST(ServiceWorkerRegistrar, TestWriteData)
|
||||
{
|
||||
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
ServiceWorkerRegistrationData reg;
|
||||
ServiceWorkerRegistrationData reg;
|
||||
|
||||
reg.scope() = nsPrintfCString("https://scope_write_%d.org", i);
|
||||
reg.currentWorkerURL() = nsPrintfCString("currentWorkerURL write %d", i);
|
||||
reg.currentWorkerHandlesFetch() = true;
|
||||
reg.cacheName() =
|
||||
NS_ConvertUTF8toUTF16(nsPrintfCString("cacheName write %d", i));
|
||||
reg.updateViaCache() =
|
||||
nsIServiceWorkerRegistrationInfo::UPDATE_VIA_CACHE_IMPORTS;
|
||||
reg.scope() = "https://scope_write_0.org"_ns;
|
||||
reg.currentWorkerURL() = "currentWorkerURL write 0"_ns;
|
||||
reg.currentWorkerHandlesFetch() = true;
|
||||
reg.cacheName() = u"cacheName write 0"_ns;
|
||||
reg.updateViaCache() =
|
||||
nsIServiceWorkerRegistrationInfo::UPDATE_VIA_CACHE_IMPORTS;
|
||||
|
||||
reg.currentWorkerInstalledTime() = PR_Now();
|
||||
reg.currentWorkerActivatedTime() = PR_Now();
|
||||
reg.lastUpdateTime() = PR_Now();
|
||||
reg.currentWorkerInstalledTime() = PR_Now();
|
||||
reg.currentWorkerActivatedTime() = PR_Now();
|
||||
reg.lastUpdateTime() = PR_Now();
|
||||
|
||||
nsAutoCString spec;
|
||||
spec.AppendPrintf("spec write %d", i);
|
||||
const auto spec = "spec write 0"_ns;
|
||||
reg.principal() = mozilla::ipc::ContentPrincipalInfo(
|
||||
mozilla::OriginAttributes(), spec, spec, mozilla::Nothing(), spec);
|
||||
|
||||
reg.principal() = mozilla::ipc::ContentPrincipalInfo(
|
||||
mozilla::OriginAttributes(i % 2), spec, spec, mozilla::Nothing(),
|
||||
spec);
|
||||
|
||||
swr->TestRegisterServiceWorker(reg);
|
||||
}
|
||||
swr->TestRegisterServiceWorker(reg);
|
||||
|
||||
nsresult rv = swr->TestWriteData();
|
||||
ASSERT_EQ(NS_OK, rv) << "WriteData() should not fail";
|
||||
@ -314,47 +308,37 @@ TEST(ServiceWorkerRegistrar, TestWriteData)
|
||||
nsresult rv = swr->TestReadData();
|
||||
ASSERT_EQ(NS_OK, rv) << "ReadData() should not fail";
|
||||
|
||||
const nsTArray<ServiceWorkerRegistrationData>& data = swr->TestGetData();
|
||||
ASSERT_EQ((uint32_t)2, data.Length()) << "2 entries should be found";
|
||||
const nsTArray<ServiceWorkerRegistrationData>& dataArr = swr->TestGetData();
|
||||
ASSERT_EQ((uint32_t)1, dataArr.Length()) << "1 entries should be found";
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
nsAutoCString test;
|
||||
const auto& data = dataArr[0];
|
||||
|
||||
ASSERT_EQ(data[i].principal().type(),
|
||||
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo = data[i].principal();
|
||||
ASSERT_EQ(data.principal().type(),
|
||||
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo = data.principal();
|
||||
|
||||
mozilla::OriginAttributes attrs(i % 2);
|
||||
nsAutoCString suffix, expectSuffix;
|
||||
attrs.CreateSuffix(expectSuffix);
|
||||
cInfo.attrs().CreateSuffix(suffix);
|
||||
mozilla::OriginAttributes attrs;
|
||||
nsAutoCString suffix, expectSuffix;
|
||||
attrs.CreateSuffix(expectSuffix);
|
||||
cInfo.attrs().CreateSuffix(suffix);
|
||||
|
||||
ASSERT_STREQ(expectSuffix.get(), suffix.get());
|
||||
ASSERT_STREQ(expectSuffix.get(), suffix.get());
|
||||
|
||||
test.AppendPrintf("https://scope_write_%d.org", i);
|
||||
ASSERT_STREQ(test.get(), cInfo.spec().get());
|
||||
ASSERT_STREQ("https://scope_write_0.org", cInfo.spec().get());
|
||||
ASSERT_STREQ("https://scope_write_0.org", data.scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL write 0", data.currentWorkerURL().get());
|
||||
|
||||
test.Truncate();
|
||||
test.AppendPrintf("https://scope_write_%d.org", i);
|
||||
ASSERT_STREQ(test.get(), data[i].scope().get());
|
||||
ASSERT_EQ(true, data.currentWorkerHandlesFetch());
|
||||
|
||||
test.Truncate();
|
||||
test.AppendPrintf("currentWorkerURL write %d", i);
|
||||
ASSERT_STREQ(test.get(), data[i].currentWorkerURL().get());
|
||||
ASSERT_STREQ("cacheName write 0",
|
||||
NS_ConvertUTF16toUTF8(data.cacheName()).get());
|
||||
|
||||
ASSERT_EQ(true, data[i].currentWorkerHandlesFetch());
|
||||
ASSERT_EQ(nsIServiceWorkerRegistrationInfo::UPDATE_VIA_CACHE_IMPORTS,
|
||||
data.updateViaCache());
|
||||
|
||||
test.Truncate();
|
||||
test.AppendPrintf("cacheName write %d", i);
|
||||
ASSERT_STREQ(test.get(), NS_ConvertUTF16toUTF8(data[i].cacheName()).get());
|
||||
|
||||
ASSERT_EQ(nsIServiceWorkerRegistrationInfo::UPDATE_VIA_CACHE_IMPORTS,
|
||||
data[i].updateViaCache());
|
||||
|
||||
ASSERT_NE((int64_t)0, data[i].currentWorkerInstalledTime());
|
||||
ASSERT_NE((int64_t)0, data[i].currentWorkerActivatedTime());
|
||||
ASSERT_NE((int64_t)0, data[i].lastUpdateTime());
|
||||
}
|
||||
ASSERT_NE((int64_t)0, data.currentWorkerInstalledTime());
|
||||
ASSERT_NE((int64_t)0, data.currentWorkerActivatedTime());
|
||||
ASSERT_NE((int64_t)0, data.lastUpdateTime());
|
||||
}
|
||||
|
||||
TEST(ServiceWorkerRegistrar, TestVersion2Migration)
|
||||
@ -394,7 +378,7 @@ TEST(ServiceWorkerRegistrar, TestVersion2Migration)
|
||||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
@ -464,7 +448,7 @@ TEST(ServiceWorkerRegistrar, TestVersion3Migration)
|
||||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
@ -532,7 +516,7 @@ TEST(ServiceWorkerRegistrar, TestVersion4Migration)
|
||||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
@ -604,7 +588,7 @@ TEST(ServiceWorkerRegistrar, TestVersion5Migration)
|
||||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
@ -678,7 +662,7 @@ TEST(ServiceWorkerRegistrar, TestVersion6Migration)
|
||||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
@ -765,7 +749,7 @@ TEST(ServiceWorkerRegistrar, TestVersion7Migration)
|
||||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
@ -850,7 +834,7 @@ TEST(ServiceWorkerRegistrar, TestDedupeRead)
|
||||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
@ -903,8 +887,7 @@ TEST(ServiceWorkerRegistrar, TestDedupeWrite)
|
||||
spec.AppendPrintf("spec write dedupe/%d", i);
|
||||
|
||||
reg.principal() = mozilla::ipc::ContentPrincipalInfo(
|
||||
mozilla::OriginAttributes(false), spec, spec, mozilla::Nothing(),
|
||||
spec);
|
||||
mozilla::OriginAttributes(), spec, spec, mozilla::Nothing(), spec);
|
||||
|
||||
swr->TestRegisterServiceWorker(reg);
|
||||
}
|
||||
@ -926,7 +909,7 @@ TEST(ServiceWorkerRegistrar, TestDedupeWrite)
|
||||
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo = data[0].principal();
|
||||
|
||||
mozilla::OriginAttributes attrs(false);
|
||||
mozilla::OriginAttributes attrs;
|
||||
nsAutoCString suffix, expectSuffix;
|
||||
attrs.CreateSuffix(expectSuffix);
|
||||
cInfo.attrs().CreateSuffix(suffix);
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "mozilla/Tokenizer.h"
|
||||
#include "mozIStorageConnection.h"
|
||||
#include "mozStorageHelper.h"
|
||||
#include "mozilla/StorageOriginAttributes.h"
|
||||
|
||||
// Current version of the database schema
|
||||
#define CURRENT_SCHEMA_VERSION 2
|
||||
@ -131,8 +132,8 @@ class ExtractOriginData : protected mozilla::Tokenizer {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
OriginAttributes attrs(inIsolatedMozBrowser);
|
||||
attrs.CreateSuffix(suffix);
|
||||
StorageOriginAttributes originAttributes(inIsolatedMozBrowser);
|
||||
originAttributes.CreateSuffix(suffix);
|
||||
}
|
||||
|
||||
// Consume the rest of the input as "origin".
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "mozilla/StorageOriginAttributes.h"
|
||||
|
||||
namespace mozilla::dom::StorageUtils {
|
||||
|
||||
@ -61,16 +62,16 @@ nsCString Scheme0Scope(const nsACString& aOriginSuffix,
|
||||
const nsACString& aOriginNoSuffix) {
|
||||
nsCString result;
|
||||
|
||||
OriginAttributes oa;
|
||||
StorageOriginAttributes oa;
|
||||
if (!aOriginSuffix.IsEmpty()) {
|
||||
DebugOnly<bool> success = oa.PopulateFromSuffix(aOriginSuffix);
|
||||
MOZ_ASSERT(success);
|
||||
}
|
||||
|
||||
if (oa.mInIsolatedMozBrowser) {
|
||||
if (oa.InIsolatedMozBrowser()) {
|
||||
result.AppendInt(0); // This is the appId to be removed.
|
||||
result.Append(':');
|
||||
result.Append(oa.mInIsolatedMozBrowser ? 't' : 'f');
|
||||
result.Append(oa.InIsolatedMozBrowser() ? 't' : 'f');
|
||||
result.Append(':');
|
||||
}
|
||||
|
||||
@ -80,7 +81,7 @@ nsCString Scheme0Scope(const nsACString& aOriginSuffix,
|
||||
// with originAttributes and originKey columns) so that switch between
|
||||
// schema 1 and 0 always works in both ways.
|
||||
nsAutoCString remaining;
|
||||
oa.mInIsolatedMozBrowser = false;
|
||||
oa.SetInIsolatedMozBrowser(false);
|
||||
oa.CreateSuffix(remaining);
|
||||
if (!remaining.IsEmpty()) {
|
||||
MOZ_ASSERT(!aOriginSuffix.IsEmpty());
|
||||
|
@ -1208,7 +1208,6 @@ nsresult PermissionManager::TryInitDB(bool aRemoveFile,
|
||||
entry.mExpireType = stmt->AsInt32(3);
|
||||
entry.mExpireTime = stmt->AsInt64(4);
|
||||
entry.mModificationTime = stmt->AsInt64(5);
|
||||
entry.mIsInBrowserElement = static_cast<bool>(stmt->AsInt32(6));
|
||||
|
||||
mMigrationEntries.AppendElement(entry);
|
||||
}
|
||||
@ -1363,7 +1362,6 @@ nsresult PermissionManager::TryInitDB(bool aRemoveFile,
|
||||
entry.mExpireType = stmt->AsInt32(3);
|
||||
entry.mExpireTime = stmt->AsInt64(4);
|
||||
entry.mModificationTime = stmt->AsInt64(5);
|
||||
entry.mIsInBrowserElement = static_cast<bool>(stmt->AsInt32(6));
|
||||
|
||||
mMigrationEntries.AppendElement(entry);
|
||||
}
|
||||
|
@ -596,8 +596,7 @@ class PermissionManager final : public nsIPermissionManager,
|
||||
mPermission(0),
|
||||
mExpireType(0),
|
||||
mExpireTime(0),
|
||||
mModificationTime(0),
|
||||
mIsInBrowserElement(false) {}
|
||||
mModificationTime(0) {}
|
||||
|
||||
nsCString mHost;
|
||||
nsCString mType;
|
||||
@ -606,9 +605,6 @@ class PermissionManager final : public nsIPermissionManager,
|
||||
uint32_t mExpireType;
|
||||
int64_t mExpireTime;
|
||||
int64_t mModificationTime;
|
||||
|
||||
// Legacy, for migration.
|
||||
bool mIsInBrowserElement;
|
||||
};
|
||||
|
||||
// List of entries read from the database. It will be populated OMT and
|
||||
|
@ -90,7 +90,6 @@ class KeyParser : protected Tokenizer {
|
||||
break;
|
||||
case 'b':
|
||||
// Leaving to be able to read and understand oldformatted entries
|
||||
originAttribs.mInIsolatedMozBrowser = true;
|
||||
break;
|
||||
case 'a':
|
||||
isAnonymous = true;
|
||||
|
@ -132,14 +132,7 @@ NS_IMETHODIMP
|
||||
ConvertAppIdToOriginAttrsSQLFunction::OnFunctionCall(
|
||||
mozIStorageValueArray* aFunctionArguments, nsIVariant** aResult) {
|
||||
nsresult rv;
|
||||
int32_t inIsolatedMozBrowser;
|
||||
|
||||
rv = aFunctionArguments->GetInt32(1, &inIsolatedMozBrowser);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Create an originAttributes object by inIsolatedMozBrowser.
|
||||
// Then create the originSuffix string from this object.
|
||||
OriginAttributes attrs(inIsolatedMozBrowser != 0);
|
||||
OriginAttributes attrs;
|
||||
nsAutoCString suffix;
|
||||
attrs.CreateSuffix(suffix);
|
||||
|
||||
@ -205,7 +198,7 @@ SetInBrowserFromOriginAttributesSQLFunction::OnFunctionCall(
|
||||
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
||||
|
||||
RefPtr<nsVariant> outVar(new nsVariant());
|
||||
rv = outVar->SetAsInt32(attrs.mInIsolatedMozBrowser);
|
||||
rv = outVar->SetAsInt32(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
outVar.forget(aResult);
|
||||
|
@ -123,7 +123,7 @@ const char* NeckoParent::GetValidatedOriginAttributes(
|
||||
if (!aSerialized.IsNotNull()) {
|
||||
// If serialized is null, we cannot validate anything. We have to assume
|
||||
// that this requests comes from a SystemPrincipal.
|
||||
aAttrs = OriginAttributes(false);
|
||||
aAttrs = OriginAttributes();
|
||||
} else {
|
||||
aAttrs = aSerialized.mOriginAttributes;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user