Plumbing-only patch for Speculation Rules prefetch (M1, same-origin).
Adds the PPrefetchRecord IPDL protocol, child/parent actor skeletons,
and PWindowGlobal management. No behavior yet — Init/Cancel bodies and
SpeculationRulesManager wiring follow in subsequent parts.
- dom/ipc/PPrefetchRecord.ipdl (new): protocol definition
- dom/ipc/PrefetchIPCTypes.ipdlh (new): shared IPDL types
(SpeculativePrefetchArgs) usable by PPrefetchRecord + PWindowGlobal
- dom/ipc/PrefetchTypes.h (new): shared C++ enums (PrefetchState,
PrefetchAnonymizationPolicy, PrefetchSource) and ExchangeRecord
- dom/ipc/PrefetchRecordChild.{h,cpp} (new): content-side actor; holds
URL + anon policy
- dom/ipc/PrefetchRecordParent.{h,cpp} (new): parent-side actor; holds
prefetch record fields; empty RecvCancel/ActorDestroy
- dom/ipc/PWindowGlobal.ipdl: add 'manages PPrefetchRecord;' and
constructor message
- dom/ipc/WindowGlobalParent.{h,cpp}: add AllocPPrefetchRecordParent
- dom/ipc/moz.build: wire new sources
Spec: https://wicg.github.io/nav-speculation/prefetch.html
Differential Revision: https://phabricator.services.mozilla.com/D302502
48 lines
1.6 KiB
C++
48 lines
1.6 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef mozilla_dom_PrefetchRecordChild_h
|
|
#define mozilla_dom_PrefetchRecordChild_h
|
|
|
|
#include "mozilla/dom/PPrefetchRecordChild.h"
|
|
#include "mozilla/dom/PrefetchTypes.h"
|
|
|
|
namespace mozilla::dom {
|
|
|
|
// Content-side actor for a speculation rules prefetch record.
|
|
//
|
|
// Lightweight handle: stores only the URL and anonymization policy needed by
|
|
// the spec's "prefetch record is still being speculated" garbage-collection
|
|
// algorithm:
|
|
// https://wicg.github.io/nav-speculation/prefetch.html#prefetch-record-still-being-speculated
|
|
// Authoritative state (state, redirect chain, expiry, partition keys) lives
|
|
// on the parent-side PrefetchRecordParent.
|
|
//
|
|
// Spec: https://wicg.github.io/nav-speculation/prefetch.html#prefetch-record
|
|
class PrefetchRecordChild final : public PPrefetchRecordChild {
|
|
public:
|
|
NS_INLINE_DECL_REFCOUNTING(PrefetchRecordChild, override)
|
|
|
|
PrefetchRecordChild(nsIURI* aURL, PrefetchAnonymizationPolicy aPolicy);
|
|
|
|
nsIURI* URL() const { return mURL; }
|
|
PrefetchAnonymizationPolicy AnonymizationPolicy() const {
|
|
return mAnonPolicy;
|
|
}
|
|
|
|
// TODO: wire to SpeculationRulesManager::RemoveRecord.
|
|
void ActorDestroy(ActorDestroyReason aReason) override;
|
|
|
|
private:
|
|
~PrefetchRecordChild() = default;
|
|
|
|
nsCOMPtr<nsIURI> mURL;
|
|
PrefetchAnonymizationPolicy mAnonPolicy;
|
|
};
|
|
|
|
} // namespace mozilla::dom
|
|
|
|
#endif // mozilla_dom_PrefetchRecordChild_h
|