Bug 1532661 - Part 3: Add WillSetX and DidSetX callbacks for BrowsingContext synced fields, r=farre
Depends on D22191 Differential Revision: https://phabricator.services.mozilla.com/D22192
This commit is contained in:
@@ -688,7 +688,9 @@ void BrowsingContext::Transaction::Apply(BrowsingContext* aBrowsingContext,
|
|||||||
ContentParent* aSource) {
|
ContentParent* aSource) {
|
||||||
#define MOZ_BC_FIELD(name, ...) \
|
#define MOZ_BC_FIELD(name, ...) \
|
||||||
if (m##name) { \
|
if (m##name) { \
|
||||||
|
aBrowsingContext->WillSet##name(*m##name, aSource); \
|
||||||
aBrowsingContext->m##name = std::move(*m##name); \
|
aBrowsingContext->m##name = std::move(*m##name); \
|
||||||
|
aBrowsingContext->DidSet##name(aSource); \
|
||||||
m##name.reset(); \
|
m##name.reset(); \
|
||||||
}
|
}
|
||||||
#include "mozilla/dom/BrowsingContextFieldList.h"
|
#include "mozilla/dom/BrowsingContextFieldList.h"
|
||||||
|
|||||||
@@ -62,8 +62,13 @@ class BrowsingContextBase {
|
|||||||
}
|
}
|
||||||
~BrowsingContextBase() = default;
|
~BrowsingContextBase() = default;
|
||||||
|
|
||||||
#define BC_FIELD(name, type) type m##name;
|
#define MOZ_BC_FIELD(name, type) \
|
||||||
#include "mozilla/dom/BCFieldList.h"
|
type m##name; \
|
||||||
|
\
|
||||||
|
/* shadow to validate fields. aSource is setter process or null*/ \
|
||||||
|
void WillSet##name(type const& aValue, ContentParent* aSource) {} \
|
||||||
|
void DidSet##name(ContentParent* aSource) {}
|
||||||
|
#include "mozilla/dom/BrowsingContextFieldList.h"
|
||||||
};
|
};
|
||||||
|
|
||||||
// BrowsingContext, in this context, is the cross process replicated
|
// BrowsingContext, in this context, is the cross process replicated
|
||||||
@@ -341,6 +346,14 @@ class BrowsingContext : public nsWrapperCache,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Ensure that opener is in the same BrowsingContextGroup.
|
||||||
|
void WillSetOpener(const RefPtr<BrowsingContext>& aValue,
|
||||||
|
ContentParent* aSource) {
|
||||||
|
if (aValue) {
|
||||||
|
MOZ_RELEASE_ASSERT(aValue->Group() == Group());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Type of BrowsingContent
|
// Type of BrowsingContent
|
||||||
const Type mType;
|
const Type mType;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user