Documentation
¶
Overview ¶
Package preload provides the Chrome DevTools Protocol commands, types, and events for the Preload domain.
Generated by the cdproto-gen command.
Index ¶
- Constants
- type DisableParams
- type EnableParams
- type EventPrefetchStatusUpdated
- type EventPreloadEnabledStateUpdated
- type EventPreloadingAttemptSourcesUpdated
- type EventPrerenderStatusUpdated
- type EventRuleSetRemoved
- type EventRuleSetUpdated
- type IngAttemptKey
- type IngAttemptSource
- type IngStatus
- type PipelineID
- type PrefetchStatus
- type PrerenderFinalStatus
- type PrerenderMismatchedHeaders
- type RuleSet
- type RuleSetErrorType
- type RuleSetID
- type SpeculationAction
- type SpeculationTargetHint
Constants ¶
const ( CommandEnable = "Preload.enable" CommandDisable = "Preload.disable" )
Command names.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DisableParams ¶
type DisableParams struct{}
DisableParams [no description].
func Disable ¶
func Disable() *DisableParams
Disable [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#method-disable
type EnableParams ¶
type EnableParams struct{}
EnableParams [no description].
func Enable ¶
func Enable() *EnableParams
Enable [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#method-enable
type EventPrefetchStatusUpdated ¶
type EventPrefetchStatusUpdated struct { Key *IngAttemptKey `json:"key"` PipelineID PipelineID `json:"pipelineId"` InitiatingFrameID cdp.FrameID `json:"initiatingFrameId"` // The frame id of the frame initiating prefetch. PrefetchURL string `json:"prefetchUrl"` Status IngStatus `json:"status"` PrefetchStatus PrefetchStatus `json:"prefetchStatus"` RequestID network.RequestID `json:"requestId"` }
EventPrefetchStatusUpdated fired when a prefetch attempt is updated.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#event-prefetchStatusUpdated
type EventPreloadEnabledStateUpdated ¶
type EventPreloadEnabledStateUpdated struct { DisabledByPreference bool `json:"disabledByPreference"` DisabledByDataSaver bool `json:"disabledByDataSaver"` DisabledByBatterySaver bool `json:"disabledByBatterySaver"` DisabledByHoldbackPrefetchSpeculationRules bool `json:"disabledByHoldbackPrefetchSpeculationRules"` DisabledByHoldbackPrerenderSpeculationRules bool `json:"disabledByHoldbackPrerenderSpeculationRules"` }
EventPreloadEnabledStateUpdated fired when a preload enabled state is updated.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#event-preloadEnabledStateUpdated
type EventPreloadingAttemptSourcesUpdated ¶
type EventPreloadingAttemptSourcesUpdated struct { LoaderID cdp.LoaderID `json:"loaderId"` PreloadingAttemptSources []*IngAttemptSource `json:"preloadingAttemptSources"` }
EventPreloadingAttemptSourcesUpdated send a list of sources for all preloading attempts in a document.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#event-preloadingAttemptSourcesUpdated
type EventPrerenderStatusUpdated ¶
type EventPrerenderStatusUpdated struct { Key *IngAttemptKey `json:"key"` PipelineID PipelineID `json:"pipelineId"` Status IngStatus `json:"status"` PrerenderStatus PrerenderFinalStatus `json:"prerenderStatus,omitempty,omitzero"` DisallowedMojoInterface string `json:"disallowedMojoInterface,omitempty,omitzero"` // This is used to give users more information about the name of Mojo interface that is incompatible with prerender and has caused the cancellation of the attempt. MismatchedHeaders []*PrerenderMismatchedHeaders `json:"mismatchedHeaders,omitempty,omitzero"` }
EventPrerenderStatusUpdated fired when a prerender attempt is updated.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#event-prerenderStatusUpdated
type EventRuleSetRemoved ¶
type EventRuleSetRemoved struct {
ID RuleSetID `json:"id"`
}
EventRuleSetRemoved [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#event-ruleSetRemoved
type EventRuleSetUpdated ¶
type EventRuleSetUpdated struct {
RuleSet *RuleSet `json:"ruleSet"`
}
EventRuleSetUpdated upsert. Currently, it is only emitted when a rule set added.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#event-ruleSetUpdated
type IngAttemptKey ¶
type IngAttemptKey struct { LoaderID cdp.LoaderID `json:"loaderId"` Action SpeculationAction `json:"action"` URL string `json:"url"` TargetHint SpeculationTargetHint `json:"targetHint,omitempty,omitzero"` }
IngAttemptKey a key that identifies a preloading attempt. The url used is the url specified by the trigger (i.e. the initial URL), and not the final url that is navigated to. For example, prerendering allows same-origin main frame navigations during the attempt, but the attempt is still keyed with the initial URL.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-PreloadingAttemptKey
type IngAttemptSource ¶
type IngAttemptSource struct { Key *IngAttemptKey `json:"key"` RuleSetIDs []RuleSetID `json:"ruleSetIds"` NodeIDs []cdp.BackendNodeID `json:"nodeIds"` }
IngAttemptSource lists sources for a preloading attempt, specifically the ids of rule sets that had a speculation rule that triggered the attempt, and the BackendNodeIds of <a href> or <area href> elements that triggered the attempt (in the case of attempts triggered by a document rule). It is possible for multiple rule sets and links to trigger a single attempt.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-PreloadingAttemptSource
type IngStatus ¶
type IngStatus string
IngStatus preloading status values, see also PreloadingTriggeringOutcome. This status is shared by prefetchStatusUpdated and prerenderStatusUpdated.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-PreloadingStatus
const ( IngStatusPending IngStatus = "Pending" IngStatusRunning IngStatus = "Running" IngStatusReady IngStatus = "Ready" IngStatusSuccess IngStatus = "Success" IngStatusFailure IngStatus = "Failure" IngStatusNotSupported IngStatus = "NotSupported" )
IngStatus values.
func (*IngStatus) UnmarshalJSON ¶
UnmarshalJSON satisfies [json.Unmarshaler].
type PipelineID ¶
type PipelineID string
PipelineID chrome manages different types of preloads together using a concept of preloading pipeline. For example, if a site uses a SpeculationRules for prerender, Chrome first starts a prefetch and then upgrades it to prerender. CDP events for them are emitted separately but they share PreloadPipelineId.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-PreloadPipelineId
func (PipelineID) String ¶
func (t PipelineID) String() string
String returns the PipelineID as string value.
type PrefetchStatus ¶
type PrefetchStatus string
PrefetchStatus tODO(https://crbug.com/1384419): revisit the list of PrefetchStatus and filter out the ones that aren't necessary to the developers.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-PrefetchStatus
const ( PrefetchStatusPrefetchAllowed PrefetchStatus = "PrefetchAllowed" PrefetchStatusPrefetchFailedIneligibleRedirect PrefetchStatus = "PrefetchFailedIneligibleRedirect" PrefetchStatusPrefetchFailedInvalidRedirect PrefetchStatus = "PrefetchFailedInvalidRedirect" PrefetchStatusPrefetchFailedMIMENotSupported PrefetchStatus = "PrefetchFailedMIMENotSupported" PrefetchStatusPrefetchFailedNetError PrefetchStatus = "PrefetchFailedNetError" PrefetchStatusPrefetchFailedNon2xX PrefetchStatus = "PrefetchFailedNon2XX" PrefetchStatusPrefetchEvictedAfterCandidateRemoved PrefetchStatus = "PrefetchEvictedAfterCandidateRemoved" PrefetchStatusPrefetchEvictedForNewerPrefetch PrefetchStatus = "PrefetchEvictedForNewerPrefetch" PrefetchStatusPrefetchHeldback PrefetchStatus = "PrefetchHeldback" PrefetchStatusPrefetchIneligibleRetryAfter PrefetchStatus = "PrefetchIneligibleRetryAfter" PrefetchStatusPrefetchIsPrivacyDecoy PrefetchStatus = "PrefetchIsPrivacyDecoy" PrefetchStatusPrefetchIsStale PrefetchStatus = "PrefetchIsStale" PrefetchStatusPrefetchNotEligibleBrowserContextOffTheRecord PrefetchStatus = "PrefetchNotEligibleBrowserContextOffTheRecord" PrefetchStatusPrefetchNotEligibleDataSaverEnabled PrefetchStatus = "PrefetchNotEligibleDataSaverEnabled" PrefetchStatusPrefetchNotEligibleExistingProxy PrefetchStatus = "PrefetchNotEligibleExistingProxy" PrefetchStatusPrefetchNotEligibleHostIsNonUnique PrefetchStatus = "PrefetchNotEligibleHostIsNonUnique" PrefetchStatusPrefetchNotEligibleNonDefaultStoragePartition PrefetchStatus = "PrefetchNotEligibleNonDefaultStoragePartition" PrefetchStatusPrefetchNotEligibleSameSiteCrossOriginPrefetchRequiredProxy PrefetchStatus = "PrefetchNotEligibleSameSiteCrossOriginPrefetchRequiredProxy" PrefetchStatusPrefetchNotEligibleSchemeIsNotHTTPS PrefetchStatus = "PrefetchNotEligibleSchemeIsNotHttps" PrefetchStatusPrefetchNotEligibleUserHasCookies PrefetchStatus = "PrefetchNotEligibleUserHasCookies" PrefetchStatusPrefetchNotEligibleUserHasServiceWorker PrefetchStatus = "PrefetchNotEligibleUserHasServiceWorker" PrefetchStatusPrefetchNotEligibleUserHasServiceWorkerNoFetchHandler PrefetchStatus = "PrefetchNotEligibleUserHasServiceWorkerNoFetchHandler" PrefetchStatusPrefetchNotEligibleRedirectFromServiceWorker PrefetchStatus = "PrefetchNotEligibleRedirectFromServiceWorker" PrefetchStatusPrefetchNotEligibleRedirectToServiceWorker PrefetchStatus = "PrefetchNotEligibleRedirectToServiceWorker" PrefetchStatusPrefetchNotEligibleBatterySaverEnabled PrefetchStatus = "PrefetchNotEligibleBatterySaverEnabled" PrefetchStatusPrefetchNotEligiblePreloadingDisabled PrefetchStatus = "PrefetchNotEligiblePreloadingDisabled" PrefetchStatusPrefetchNotFinishedInTime PrefetchStatus = "PrefetchNotFinishedInTime" PrefetchStatusPrefetchNotStarted PrefetchStatus = "PrefetchNotStarted" PrefetchStatusPrefetchNotUsedCookiesChanged PrefetchStatus = "PrefetchNotUsedCookiesChanged" PrefetchStatusPrefetchProxyNotAvailable PrefetchStatus = "PrefetchProxyNotAvailable" PrefetchStatusPrefetchResponseUsed PrefetchStatus = "PrefetchResponseUsed" PrefetchStatusPrefetchSuccessfulButNotUsed PrefetchStatus = "PrefetchSuccessfulButNotUsed" PrefetchStatusPrefetchNotUsedProbeFailed PrefetchStatus = "PrefetchNotUsedProbeFailed" )
PrefetchStatus values.
func (PrefetchStatus) String ¶
func (t PrefetchStatus) String() string
String returns the PrefetchStatus as string value.
func (*PrefetchStatus) UnmarshalJSON ¶
func (t *PrefetchStatus) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type PrerenderFinalStatus ¶
type PrerenderFinalStatus string
PrerenderFinalStatus list of FinalStatus reasons for Prerender2.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-PrerenderFinalStatus
const ( PrerenderFinalStatusActivated PrerenderFinalStatus = "Activated" PrerenderFinalStatusDestroyed PrerenderFinalStatus = "Destroyed" PrerenderFinalStatusLowEndDevice PrerenderFinalStatus = "LowEndDevice" PrerenderFinalStatusInvalidSchemeRedirect PrerenderFinalStatus = "InvalidSchemeRedirect" PrerenderFinalStatusMojoBinderPolicy PrerenderFinalStatus = "MojoBinderPolicy" PrerenderFinalStatusRendererProcessCrashed PrerenderFinalStatus = "RendererProcessCrashed" PrerenderFinalStatusRendererProcessKilled PrerenderFinalStatus = "RendererProcessKilled" PrerenderFinalStatusDownload PrerenderFinalStatus = "Download" PrerenderFinalStatusTriggerDestroyed PrerenderFinalStatus = "TriggerDestroyed" PrerenderFinalStatusClientCertRequested PrerenderFinalStatus = "ClientCertRequested" PrerenderFinalStatusCancelAllHostsForTesting PrerenderFinalStatus = "CancelAllHostsForTesting" PrerenderFinalStatusDidFailLoad PrerenderFinalStatus = "DidFailLoad" PrerenderFinalStatusStop PrerenderFinalStatus = "Stop" PrerenderFinalStatusSslCertificateError PrerenderFinalStatus = "SslCertificateError" PrerenderFinalStatusLoginAuthRequested PrerenderFinalStatus = "LoginAuthRequested" PrerenderFinalStatusUaChangeRequiresReload PrerenderFinalStatus = "UaChangeRequiresReload" PrerenderFinalStatusBlockedByClient PrerenderFinalStatus = "BlockedByClient" PrerenderFinalStatusAudioOutputDeviceRequested PrerenderFinalStatus = "AudioOutputDeviceRequested" PrerenderFinalStatusMixedContent PrerenderFinalStatus = "MixedContent" PrerenderFinalStatusTriggerBackgrounded PrerenderFinalStatus = "TriggerBackgrounded" PrerenderFinalStatusMemoryLimitExceeded PrerenderFinalStatus = "MemoryLimitExceeded" PrerenderFinalStatusDataSaverEnabled PrerenderFinalStatus = "DataSaverEnabled" PrerenderFinalStatusTriggerURLHasEffectiveURL PrerenderFinalStatus = "TriggerUrlHasEffectiveUrl" PrerenderFinalStatusActivatedBeforeStarted PrerenderFinalStatus = "ActivatedBeforeStarted" PrerenderFinalStatusInactivePageRestriction PrerenderFinalStatus = "InactivePageRestriction" PrerenderFinalStatusStartFailed PrerenderFinalStatus = "StartFailed" PrerenderFinalStatusTimeoutBackgrounded PrerenderFinalStatus = "TimeoutBackgrounded" PrerenderFinalStatusActivatedInBackground PrerenderFinalStatus = "ActivatedInBackground" PrerenderFinalStatusEmbedderHostDisallowed PrerenderFinalStatus = "EmbedderHostDisallowed" PrerenderFinalStatusTabClosedByUserGesture PrerenderFinalStatus = "TabClosedByUserGesture" PrerenderFinalStatusTabClosedWithoutUserGesture PrerenderFinalStatus = "TabClosedWithoutUserGesture" PrerenderFinalStatusPrimaryMainFrameRendererProcessCrashed PrerenderFinalStatus = "PrimaryMainFrameRendererProcessCrashed" PrerenderFinalStatusPrimaryMainFrameRendererProcessKilled PrerenderFinalStatus = "PrimaryMainFrameRendererProcessKilled" PrerenderFinalStatusActivationFramePolicyNotCompatible PrerenderFinalStatus = "ActivationFramePolicyNotCompatible" PrerenderFinalStatusPreloadingDisabled PrerenderFinalStatus = "PreloadingDisabled" PrerenderFinalStatusBatterySaverEnabled PrerenderFinalStatus = "BatterySaverEnabled" PrerenderFinalStatusPreloadingUnsupportedByWebContents PrerenderFinalStatus = "PreloadingUnsupportedByWebContents" PrerenderFinalStatusMemoryPressureOnTrigger PrerenderFinalStatus = "MemoryPressureOnTrigger" PrerenderFinalStatusMemoryPressureAfterTriggered PrerenderFinalStatus = "MemoryPressureAfterTriggered" PrerenderFinalStatusPrerenderingDisabledByDevTools PrerenderFinalStatus = "PrerenderingDisabledByDevTools" PrerenderFinalStatusSpeculationRuleRemoved PrerenderFinalStatus = "SpeculationRuleRemoved" PrerenderFinalStatusActivatedWithAuxiliaryBrowsingContexts PrerenderFinalStatus = "ActivatedWithAuxiliaryBrowsingContexts" PrerenderFinalStatusMaxNumOfRunningEagerPrerendersExceeded PrerenderFinalStatus = "MaxNumOfRunningEagerPrerendersExceeded" PrerenderFinalStatusMaxNumOfRunningNonEagerPrerendersExceeded PrerenderFinalStatus = "MaxNumOfRunningNonEagerPrerendersExceeded" PrerenderFinalStatusMaxNumOfRunningEmbedderPrerendersExceeded PrerenderFinalStatus = "MaxNumOfRunningEmbedderPrerendersExceeded" PrerenderFinalStatusPrerenderingURLHasEffectiveURL PrerenderFinalStatus = "PrerenderingUrlHasEffectiveUrl" PrerenderFinalStatusRedirectedPrerenderingURLHasEffectiveURL PrerenderFinalStatus = "RedirectedPrerenderingUrlHasEffectiveUrl" PrerenderFinalStatusActivationURLHasEffectiveURL PrerenderFinalStatus = "ActivationUrlHasEffectiveUrl" PrerenderFinalStatusJavaScriptInterfaceAdded PrerenderFinalStatus = "JavaScriptInterfaceAdded" PrerenderFinalStatusJavaScriptInterfaceRemoved PrerenderFinalStatus = "JavaScriptInterfaceRemoved" PrerenderFinalStatusAllPrerenderingCanceled PrerenderFinalStatus = "AllPrerenderingCanceled" PrerenderFinalStatusWindowClosed PrerenderFinalStatus = "WindowClosed" PrerenderFinalStatusSlowNetwork PrerenderFinalStatus = "SlowNetwork" PrerenderFinalStatusOtherPrerenderedPageActivated PrerenderFinalStatus = "OtherPrerenderedPageActivated" PrerenderFinalStatusV8optimizerDisabled PrerenderFinalStatus = "V8OptimizerDisabled" PrerenderFinalStatusPrerenderFailedDuringPrefetch PrerenderFinalStatus = "PrerenderFailedDuringPrefetch" PrerenderFinalStatusBrowsingDataRemoved PrerenderFinalStatus = "BrowsingDataRemoved" )
PrerenderFinalStatus values.
func (PrerenderFinalStatus) String ¶
func (t PrerenderFinalStatus) String() string
String returns the PrerenderFinalStatus as string value.
func (*PrerenderFinalStatus) UnmarshalJSON ¶
func (t *PrerenderFinalStatus) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type PrerenderMismatchedHeaders ¶
type PrerenderMismatchedHeaders struct { HeaderName string `json:"headerName"` InitialValue string `json:"initialValue,omitempty,omitzero"` ActivationValue string `json:"activationValue,omitempty,omitzero"` }
PrerenderMismatchedHeaders information of headers to be displayed when the header mismatch occurred.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-PrerenderMismatchedHeaders
type RuleSet ¶
type RuleSet struct { ID RuleSetID `json:"id"` LoaderID cdp.LoaderID `json:"loaderId"` // Identifies a document which the rule set is associated with. SourceText string `json:"sourceText"` // Source text of JSON representing the rule set. If it comes from <script> tag, it is the textContent of the node. Note that it is a JSON for valid case. See also: - https://wicg.github.io/nav-speculation/speculation-rules.html - https://github.com/WICG/nav-speculation/blob/main/triggers.md BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty,omitzero"` // A speculation rule set is either added through an inline <script> tag or through an external resource via the 'Speculation-Rules' HTTP header. For the first case, we include the BackendNodeId of the relevant <script> tag. For the second case, we include the external URL where the rule set was loaded from, and also RequestId if Network domain is enabled. See also: - https://wicg.github.io/nav-speculation/speculation-rules.html#speculation-rules-script - https://wicg.github.io/nav-speculation/speculation-rules.html#speculation-rules-header URL string `json:"url,omitempty,omitzero"` RequestID network.RequestID `json:"requestId,omitempty,omitzero"` ErrorType RuleSetErrorType `json:"errorType,omitempty,omitzero"` // Error information errorMessage is null iff errorType is null. }
RuleSet corresponds to SpeculationRuleSet.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-RuleSet
type RuleSetErrorType ¶
type RuleSetErrorType string
RuleSetErrorType [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-RuleSetErrorType
const ( RuleSetErrorTypeSourceIsNotJSONObject RuleSetErrorType = "SourceIsNotJsonObject" RuleSetErrorTypeInvalidRulesSkipped RuleSetErrorType = "InvalidRulesSkipped" )
RuleSetErrorType values.
func (RuleSetErrorType) String ¶
func (t RuleSetErrorType) String() string
String returns the RuleSetErrorType as string value.
func (*RuleSetErrorType) UnmarshalJSON ¶
func (t *RuleSetErrorType) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type RuleSetID ¶
type RuleSetID string
RuleSetID unique id.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-RuleSetId
type SpeculationAction ¶
type SpeculationAction string
SpeculationAction the type of preloading attempted. It corresponds to mojom::SpeculationAction (although PrefetchWithSubresources is omitted as it isn't being used by clients).
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-SpeculationAction
const ( SpeculationActionPrefetch SpeculationAction = "Prefetch" SpeculationActionPrerender SpeculationAction = "Prerender" )
SpeculationAction values.
func (SpeculationAction) String ¶
func (t SpeculationAction) String() string
String returns the SpeculationAction as string value.
func (*SpeculationAction) UnmarshalJSON ¶
func (t *SpeculationAction) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type SpeculationTargetHint ¶
type SpeculationTargetHint string
SpeculationTargetHint corresponds to mojom::SpeculationTargetHint. See https://github.com/WICG/nav-speculation/blob/main/triggers.md#window-name-targeting-hints.
See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-SpeculationTargetHint
const ( SpeculationTargetHintBlank SpeculationTargetHint = "Blank" SpeculationTargetHintSelf SpeculationTargetHint = "Self" )
SpeculationTargetHint values.
func (SpeculationTargetHint) String ¶
func (t SpeculationTargetHint) String() string
String returns the SpeculationTargetHint as string value.
func (*SpeculationTargetHint) UnmarshalJSON ¶
func (t *SpeculationTargetHint) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].