Bug 1616570 - Part 2: Add the CookieJarSettingsArgs as a field in the window context. r=Ehsan,farre

This patch adds a new field CookieJarSettings in the window context.
This makes the CookieJarSettings can be accssible across the process
boundaries, which is needed for the work of making the ETP
Fission-compatible. We reuse the CookieJarSettingsArgs from the
NeckoChannelParams.ipdlh as the field here since it represents the
CookieJarSettings in IPDL and the syncedContext is based on the IPC
between processes. So, I think we can use it directly as a field.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tim Huang 2020-03-04 08:59:18 +00:00
Родитель 04d44bae12
Коммит 636d5ec488
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -9,11 +9,14 @@
#include "mozilla/dom/MaybeDiscarded.h"
#include "mozilla/dom/SyncedContext.h"
#include "mozilla/net/NeckoChannelParams.h"
namespace mozilla {
namespace dom {
#define MOZ_EACH_WC_FIELD(FIELD) FIELD(OuterWindowId, uint64_t)
#define MOZ_EACH_WC_FIELD(FIELD) \
FIELD(OuterWindowId, uint64_t) \
FIELD(CookieJarSettings, Maybe<mozilla::net::CookieJarSettingsArgs>)
class WindowContext : public nsISupports, public nsWrapperCache {
MOZ_DECL_SYNCED_CONTEXT(WindowContext, MOZ_EACH_WC_FIELD)
@ -74,6 +77,12 @@ class WindowContext : public nsISupports, public nsWrapperCache {
return GetOuterWindowId() == 0 && aValue != 0;
}
bool CanSet(FieldIndex<IDX_CookieJarSettings>,
const Maybe<mozilla::net::CookieJarSettingsArgs>& aValue,
ContentParent* aSource) {
return true;
}
// Overload `DidSet` to get notifications for a particular field being set.
template <size_t I>
void DidSet(FieldIndex<I>) {}