1use serde::{Serialize, Deserialize};
2
3pub type RuleSetId = String;
6
7#[derive(Debug, Clone, Serialize, Deserialize, Default)]
10#[serde(rename_all = "camelCase")]
11pub struct RuleSet {
12
13 pub id: RuleSetId,
14 pub loaderId: crate::network::LoaderId,
17 pub sourceText: String,
26 #[serde(skip_serializing_if = "Option::is_none")]
38 pub backendNodeId: Option<crate::dom::BackendNodeId>,
39
40 #[serde(skip_serializing_if = "Option::is_none")]
41 pub url: Option<String>,
42
43 #[serde(skip_serializing_if = "Option::is_none")]
44 pub requestId: Option<crate::network::RequestId>,
45 #[serde(skip_serializing_if = "Option::is_none")]
49 pub errorType: Option<RuleSetErrorType>,
50 #[serde(skip_serializing_if = "Option::is_none")]
53 pub errorMessage: Option<String>,
54 #[serde(skip_serializing_if = "Option::is_none")]
58 pub tag: Option<String>,
59}
60
61
62#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
63pub enum RuleSetErrorType {
64 #[default]
65 SourceIsNotJsonObject,
66 InvalidRulesSkipped,
67 InvalidRulesetLevelTag,
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
75pub enum SpeculationAction {
76 #[default]
77 Prefetch,
78 Prerender,
79 PrerenderUntilScript,
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
86pub enum SpeculationTargetHint {
87 #[default]
88 Blank,
89 SelfValue,
90}
91
92#[derive(Debug, Clone, Serialize, Deserialize, Default)]
100#[serde(rename_all = "camelCase")]
101pub struct PreloadingAttemptKey {
102
103 pub loaderId: crate::network::LoaderId,
104
105 pub action: SpeculationAction,
106
107 pub url: String,
108
109 #[serde(skip_serializing_if = "Option::is_none")]
110 pub formSubmission: Option<bool>,
111
112 #[serde(skip_serializing_if = "Option::is_none")]
113 pub targetHint: Option<SpeculationTargetHint>,
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize, Default)]
123#[serde(rename_all = "camelCase")]
124pub struct PreloadingAttemptSource {
125
126 pub key: PreloadingAttemptKey,
127
128 pub ruleSetIds: Vec<RuleSetId>,
129
130 pub nodeIds: Vec<crate::dom::BackendNodeId>,
131}
132
133pub type PreloadPipelineId = String;
142
143#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
146pub enum PrerenderFinalStatus {
147 #[default]
148 Activated,
149 Destroyed,
150 LowEndDevice,
151 InvalidSchemeRedirect,
152 InvalidSchemeNavigation,
153 NavigationRequestBlockedByCsp,
154 MojoBinderPolicy,
155 RendererProcessCrashed,
156 RendererProcessKilled,
157 Download,
158 TriggerDestroyed,
159 NavigationNotCommitted,
160 NavigationBadHttpStatus,
161 ClientCertRequested,
162 NavigationRequestNetworkError,
163 CancelAllHostsForTesting,
164 DidFailLoad,
165 Stop,
166 SslCertificateError,
167 LoginAuthRequested,
168 UaChangeRequiresReload,
169 BlockedByClient,
170 AudioOutputDeviceRequested,
171 MixedContent,
172 TriggerBackgrounded,
173 MemoryLimitExceeded,
174 DataSaverEnabled,
175 TriggerUrlHasEffectiveUrl,
176 ActivatedBeforeStarted,
177 InactivePageRestriction,
178 StartFailed,
179 TimeoutBackgrounded,
180 CrossSiteRedirectInInitialNavigation,
181 CrossSiteNavigationInInitialNavigation,
182 SameSiteCrossOriginRedirectNotOptInInInitialNavigation,
183 SameSiteCrossOriginNavigationNotOptInInInitialNavigation,
184 ActivationNavigationParameterMismatch,
185 ActivatedInBackground,
186 EmbedderHostDisallowed,
187 ActivationNavigationDestroyedBeforeSuccess,
188 TabClosedByUserGesture,
189 TabClosedWithoutUserGesture,
190 PrimaryMainFrameRendererProcessCrashed,
191 PrimaryMainFrameRendererProcessKilled,
192 ActivationFramePolicyNotCompatible,
193 PreloadingDisabled,
194 BatterySaverEnabled,
195 ActivatedDuringMainFrameNavigation,
196 PreloadingUnsupportedByWebContents,
197 CrossSiteRedirectInMainFrameNavigation,
198 CrossSiteNavigationInMainFrameNavigation,
199 SameSiteCrossOriginRedirectNotOptInInMainFrameNavigation,
200 SameSiteCrossOriginNavigationNotOptInInMainFrameNavigation,
201 MemoryPressureOnTrigger,
202 MemoryPressureAfterTriggered,
203 PrerenderingDisabledByDevTools,
204 SpeculationRuleRemoved,
205 ActivatedWithAuxiliaryBrowsingContexts,
206 MaxNumOfRunningEagerPrerendersExceeded,
207 MaxNumOfRunningNonEagerPrerendersExceeded,
208 MaxNumOfRunningEmbedderPrerendersExceeded,
209 PrerenderingUrlHasEffectiveUrl,
210 RedirectedPrerenderingUrlHasEffectiveUrl,
211 ActivationUrlHasEffectiveUrl,
212 JavaScriptInterfaceAdded,
213 JavaScriptInterfaceRemoved,
214 AllPrerenderingCanceled,
215 WindowClosed,
216 SlowNetwork,
217 OtherPrerenderedPageActivated,
218 V8OptimizerDisabled,
219 PrerenderFailedDuringPrefetch,
220 BrowsingDataRemoved,
221 PrerenderHostReused,
222 FormSubmitWhenPrerendering,
223}
224
225#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
229pub enum PreloadingStatus {
230 #[default]
231 Pending,
232 Running,
233 Ready,
234 Success,
235 Failure,
236 NotSupported,
237}
238
239#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
243pub enum PrefetchStatus {
244 #[default]
245 PrefetchAllowed,
246 PrefetchFailedIneligibleRedirect,
247 PrefetchFailedInvalidRedirect,
248 PrefetchFailedMIMENotSupported,
249 PrefetchFailedNetError,
250 PrefetchFailedNon2XX,
251 PrefetchEvictedAfterBrowsingDataRemoved,
252 PrefetchEvictedAfterCandidateRemoved,
253 PrefetchEvictedForNewerPrefetch,
254 PrefetchHeldback,
255 PrefetchIneligibleRetryAfter,
256 PrefetchIsPrivacyDecoy,
257 PrefetchIsStale,
258 PrefetchNotEligibleBrowserContextOffTheRecord,
259 PrefetchNotEligibleDataSaverEnabled,
260 PrefetchNotEligibleExistingProxy,
261 PrefetchNotEligibleHostIsNonUnique,
262 PrefetchNotEligibleNonDefaultStoragePartition,
263 PrefetchNotEligibleSameSiteCrossOriginPrefetchRequiredProxy,
264 PrefetchNotEligibleSchemeIsNotHttps,
265 PrefetchNotEligibleUserHasCookies,
266 PrefetchNotEligibleUserHasServiceWorker,
267 PrefetchNotEligibleUserHasServiceWorkerNoFetchHandler,
268 PrefetchNotEligibleRedirectFromServiceWorker,
269 PrefetchNotEligibleRedirectToServiceWorker,
270 PrefetchNotEligibleBatterySaverEnabled,
271 PrefetchNotEligiblePreloadingDisabled,
272 PrefetchNotFinishedInTime,
273 PrefetchNotStarted,
274 PrefetchNotUsedCookiesChanged,
275 PrefetchProxyNotAvailable,
276 PrefetchResponseUsed,
277 PrefetchSuccessfulButNotUsed,
278 PrefetchNotUsedProbeFailed,
279}
280
281#[derive(Debug, Clone, Serialize, Deserialize, Default)]
284#[serde(rename_all = "camelCase")]
285pub struct PrerenderMismatchedHeaders {
286
287 pub headerName: String,
288
289 #[serde(skip_serializing_if = "Option::is_none")]
290 pub initialValue: Option<String>,
291
292 #[serde(skip_serializing_if = "Option::is_none")]
293 pub activationValue: Option<String>,
294}