Documentation
¶
Overview ¶
Package preload implements the Preload domain.
Index ¶
- func NewClient(conn *rpcc.Conn) *domainClient
- type AttemptKey
- type AttemptSource
- type AttemptSourcesUpdatedClient
- type AttemptSourcesUpdatedReply
- type EnabledStateUpdatedClient
- type EnabledStateUpdatedReply
- type PrefetchStatus
- type PrefetchStatusUpdatedClient
- type PrefetchStatusUpdatedReply
- type PrerenderFinalStatus
- type PrerenderMismatchedHeaders
- type PrerenderStatusUpdatedClient
- type PrerenderStatusUpdatedReply
- type RuleSet
- type RuleSetErrorType
- type RuleSetID
- type RuleSetRemovedClient
- type RuleSetRemovedReply
- type RuleSetUpdatedClient
- type RuleSetUpdatedReply
- type SpeculationAction
- type SpeculationTargetHint
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AttemptKey ¶
type AttemptKey struct { LoaderID network.LoaderID `json:"loaderId"` // No description. Action SpeculationAction `json:"action"` // No description. URL string `json:"url"` // No description. TargetHint SpeculationTargetHint `json:"targetHint,omitempty"` // No description. }
AttemptKey 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.
type AttemptSource ¶
type AttemptSource struct { Key AttemptKey `json:"key"` // No description. RuleSetIDs []RuleSetID `json:"ruleSetIds"` // No description. NodeIDs []dom.BackendNodeID `json:"nodeIds"` // No description. }
AttemptSource 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.
type AttemptSourcesUpdatedClient ¶
type AttemptSourcesUpdatedClient interface { // Recv calls RecvMsg on rpcc.Stream, blocks until the event is // triggered, context canceled or connection closed. Recv() (*AttemptSourcesUpdatedReply, error) rpcc.Stream }
AttemptSourcesUpdatedClient is a client for PreloadingAttemptSourcesUpdated events. Send a list of sources for all preloading attempts in a document.
type AttemptSourcesUpdatedReply ¶
type AttemptSourcesUpdatedReply struct { LoaderID network.LoaderID `json:"loaderId"` // No description. PreloadingAttemptSources []AttemptSource `json:"preloadingAttemptSources"` // No description. }
AttemptSourcesUpdatedReply is the reply for PreloadingAttemptSourcesUpdated events.
type EnabledStateUpdatedClient ¶
type EnabledStateUpdatedClient interface { // Recv calls RecvMsg on rpcc.Stream, blocks until the event is // triggered, context canceled or connection closed. Recv() (*EnabledStateUpdatedReply, error) rpcc.Stream }
EnabledStateUpdatedClient is a client for PreloadEnabledStateUpdated events. Fired when a preload enabled state is updated.
type EnabledStateUpdatedReply ¶
type EnabledStateUpdatedReply struct { DisabledByPreference bool `json:"disabledByPreference"` // No description. DisabledByDataSaver bool `json:"disabledByDataSaver"` // No description. DisabledByBatterySaver bool `json:"disabledByBatterySaver"` // No description. DisabledByHoldbackPrefetchSpeculationRules bool `json:"disabledByHoldbackPrefetchSpeculationRules"` // No description. DisabledByHoldbackPrerenderSpeculationRules bool `json:"disabledByHoldbackPrerenderSpeculationRules"` // No description. }
EnabledStateUpdatedReply is the reply for PreloadEnabledStateUpdated events.
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.
const ( PrefetchStatusNotSet PrefetchStatus = "" 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" 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 as enums.
func (PrefetchStatus) String ¶
func (e PrefetchStatus) String() string
func (PrefetchStatus) Valid ¶
func (e PrefetchStatus) Valid() bool
type PrefetchStatusUpdatedClient ¶
type PrefetchStatusUpdatedClient interface { // Recv calls RecvMsg on rpcc.Stream, blocks until the event is // triggered, context canceled or connection closed. Recv() (*PrefetchStatusUpdatedReply, error) rpcc.Stream }
PrefetchStatusUpdatedClient is a client for PrefetchStatusUpdated events. Fired when a prefetch attempt is updated.
type PrefetchStatusUpdatedReply ¶
type PrefetchStatusUpdatedReply struct { Key AttemptKey `json:"key"` // No description. InitiatingFrameID page.FrameID `json:"initiatingFrameId"` // The frame id of the frame initiating prefetch. PrefetchURL string `json:"prefetchUrl"` // No description. Status Status `json:"status"` // No description. PrefetchStatus PrefetchStatus `json:"prefetchStatus"` // No description. RequestID network.RequestID `json:"requestId"` // No description. }
PrefetchStatusUpdatedReply is the reply for PrefetchStatusUpdated events.
type PrerenderFinalStatus ¶
type PrerenderFinalStatus string
PrerenderFinalStatus List of FinalStatus reasons for Prerender2.
const ( PrerenderFinalStatusNotSet PrerenderFinalStatus = "" 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" )
PrerenderFinalStatus as enums.
func (PrerenderFinalStatus) String ¶
func (e PrerenderFinalStatus) String() string
func (PrerenderFinalStatus) Valid ¶
func (e PrerenderFinalStatus) Valid() bool
type PrerenderMismatchedHeaders ¶
type PrerenderMismatchedHeaders struct { HeaderName string `json:"headerName"` // No description. InitialValue *string `json:"initialValue,omitempty"` // No description. ActivationValue *string `json:"activationValue,omitempty"` // No description. }
PrerenderMismatchedHeaders Information of headers to be displayed when the header mismatch occurred.
type PrerenderStatusUpdatedClient ¶
type PrerenderStatusUpdatedClient interface { // Recv calls RecvMsg on rpcc.Stream, blocks until the event is // triggered, context canceled or connection closed. Recv() (*PrerenderStatusUpdatedReply, error) rpcc.Stream }
PrerenderStatusUpdatedClient is a client for PrerenderStatusUpdated events. Fired when a prerender attempt is updated.
type PrerenderStatusUpdatedReply ¶
type PrerenderStatusUpdatedReply struct { Key AttemptKey `json:"key"` // No description. Status Status `json:"status"` // No description. PrerenderStatus PrerenderFinalStatus `json:"prerenderStatus,omitempty"` // No description. DisallowedMojoInterface *string `json:"disallowedMojoInterface,omitempty"` // 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"` // No description. }
PrerenderStatusUpdatedReply is the reply for PrerenderStatusUpdated events.
type RuleSet ¶
type RuleSet struct { ID RuleSetID `json:"id"` // No description. LoaderID network.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 *dom.BackendNodeID `json:"backendNodeId,omitempty"` // 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"` // No description. RequestID *network.RequestID `json:"requestId,omitempty"` // No description. ErrorType RuleSetErrorType `json:"errorType,omitempty"` // Error information `errorMessage` is null iff `errorType` is null. // ErrorMessage is deprecated. // // Deprecated: TODO(https://crbug.com/1425354): Replace this property // with structured error. ErrorMessage *string `json:"errorMessage,omitempty"` }
RuleSet Corresponds to SpeculationRuleSet
type RuleSetErrorType ¶
type RuleSetErrorType string
RuleSetErrorType
const ( RuleSetErrorTypeNotSet RuleSetErrorType = "" RuleSetErrorTypeSourceIsNotJSONObject RuleSetErrorType = "SourceIsNotJsonObject" RuleSetErrorTypeInvalidRulesSkipped RuleSetErrorType = "InvalidRulesSkipped" )
RuleSetErrorType as enums.
func (RuleSetErrorType) String ¶
func (e RuleSetErrorType) String() string
func (RuleSetErrorType) Valid ¶
func (e RuleSetErrorType) Valid() bool
type RuleSetRemovedClient ¶
type RuleSetRemovedClient interface { // Recv calls RecvMsg on rpcc.Stream, blocks until the event is // triggered, context canceled or connection closed. Recv() (*RuleSetRemovedReply, error) rpcc.Stream }
RuleSetRemovedClient is a client for RuleSetRemoved events.
type RuleSetRemovedReply ¶
type RuleSetRemovedReply struct {
ID RuleSetID `json:"id"` // No description.
}
RuleSetRemovedReply is the reply for RuleSetRemoved events.
type RuleSetUpdatedClient ¶
type RuleSetUpdatedClient interface { // Recv calls RecvMsg on rpcc.Stream, blocks until the event is // triggered, context canceled or connection closed. Recv() (*RuleSetUpdatedReply, error) rpcc.Stream }
RuleSetUpdatedClient is a client for RuleSetUpdated events. Upsert. Currently, it is only emitted when a rule set added.
type RuleSetUpdatedReply ¶
type RuleSetUpdatedReply struct {
RuleSet RuleSet `json:"ruleSet"` // No description.
}
RuleSetUpdatedReply is the reply for RuleSetUpdated events.
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).
const ( SpeculationActionNotSet SpeculationAction = "" SpeculationActionPrefetch SpeculationAction = "Prefetch" SpeculationActionPrerender SpeculationAction = "Prerender" )
SpeculationAction as enums.
func (SpeculationAction) String ¶
func (e SpeculationAction) String() string
func (SpeculationAction) Valid ¶
func (e SpeculationAction) Valid() bool
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
const ( SpeculationTargetHintNotSet SpeculationTargetHint = "" SpeculationTargetHintBlank SpeculationTargetHint = "Blank" SpeculationTargetHintSelf SpeculationTargetHint = "Self" )
SpeculationTargetHint as enums.
func (SpeculationTargetHint) String ¶
func (e SpeculationTargetHint) String() string
func (SpeculationTargetHint) Valid ¶
func (e SpeculationTargetHint) Valid() bool
type Status ¶
type Status string
Status Preloading status values, see also PreloadingTriggeringOutcome. This status is shared by prefetchStatusUpdated and prerenderStatusUpdated.