diff --git a/cdp.go b/cdp.go index 4e1cc04..7508150 100644 --- a/cdp.go +++ b/cdp.go @@ -1261,9 +1261,6 @@ type DOMStorage interface { // Command SetDOMStorageItem SetDOMStorageItem(context.Context, *domstorage.SetDOMStorageItemArgs) error - // Command GetStorageKeyForFrame - GetStorageKeyForFrame(context.Context, *domstorage.GetStorageKeyForFrameArgs) (*domstorage.GetStorageKeyForFrameReply, error) - // Event DOMStorageItemAdded DOMStorageItemAdded(context.Context) (domstorage.ItemAddedClient, error) @@ -1706,6 +1703,11 @@ type Emulation interface { // Note: This command is experimental. SetDisabledImageTypes(context.Context, *emulation.SetDisabledImageTypesArgs) error + // Command SetHardwareConcurrencyOverride + // + // Note: This command is experimental. + SetHardwareConcurrencyOverride(context.Context, *emulation.SetHardwareConcurrencyOverrideArgs) error + // Command SetUserAgentOverride // // Allows overriding user agent with the given string. @@ -3847,6 +3849,11 @@ type ServiceWorker interface { // // Note: This domain is experimental. type Storage interface { + // Command GetStorageKeyForFrame + // + // Returns a storage key given a frame id. + GetStorageKeyForFrame(context.Context, *storage.GetStorageKeyForFrameArgs) (*storage.GetStorageKeyForFrameReply, error) + // Command ClearDataForOrigin // // Clears storage for origin. @@ -4318,7 +4325,7 @@ type WebAuthn interface { // // Enable the WebAuthn domain and start intercepting credential // storage and retrieval with a virtual authenticator. - Enable(context.Context) error + Enable(context.Context, *webauthn.EnableArgs) error // Command Disable // diff --git a/cmd/cdpgen/protodef/js_protocol.json b/cmd/cdpgen/protodef/js_protocol.json index 615b28a..0b43071 100644 --- a/cmd/cdpgen/protodef/js_protocol.json +++ b/cmd/cdpgen/protodef/js_protocol.json @@ -1557,7 +1557,6 @@ "CrossOriginWindowAlert", "CrossOriginWindowConfirm", "CSSSelectorInternalMediaControlsOverlayCastButton", - "CustomCursorIntersectsViewport", "DeprecationExample", "DocumentDomainSettingWithoutOriginAgentClusterHeader", "EventPath", @@ -1568,7 +1567,6 @@ "InsecurePrivateNetworkSubresourceRequest", "LegacyConstraintGoogIPv6", "LocalCSSFileExtensionRejected", - "MediaElementAudioSourceNode", "MediaSourceAbortRemove", "MediaSourceDurationTruncatingBuffered", "NoSysexWebMIDIWithoutPermission", @@ -1576,7 +1574,6 @@ "NotificationPermissionRequestedIframe", "ObsoleteWebRtcCipherSuite", "PaymentRequestBasicCard", - "PaymentRequestShowWithoutGesture", "PictureSourceSrc", "PrefixedCancelAnimationFrame", "PrefixedRequestAnimationFrame", @@ -1594,7 +1591,6 @@ "RTCPeerConnectionComplexPlanBSdpUsingDefaultSdpSemantics", "RTCPeerConnectionSdpSemanticsPlanB", "RtcpMuxPolicyNegotiate", - "RTPDataChannel", "SharedArrayBufferConstructedWithoutIsolation", "TextToSpeech_DisallowedByAutoplay", "V8SharedArrayBufferConstructedInExtensionWithoutIsolation", @@ -4804,6 +4800,11 @@ "name": "compatibilityMode", "optional": true, "$ref": "CompatibilityMode" + }, + { + "name": "assignedSlot", + "optional": true, + "$ref": "BackendNode" } ] }, @@ -7469,21 +7470,6 @@ "type": "string" } ] - }, - { - "name": "getStorageKeyForFrame", - "parameters": [ - { - "name": "frameId", - "$ref": "Page.FrameId" - } - ], - "returns": [ - { - "name": "storageKey", - "$ref": "SerializedStorageKey" - } - ] } ], "events": [ @@ -8318,6 +8304,17 @@ } ] }, + { + "name": "setHardwareConcurrencyOverride", + "experimental": true, + "parameters": [ + { + "name": "hardwareConcurrency", + "description": "Hardware concurrency to report", + "type": "integer" + } + ] + }, { "name": "setUserAgentOverride", "description": "Allows overriding user agent with the given string.", @@ -15008,13 +15005,13 @@ "ambient-light-sensor", "attribution-reporting", "autoplay", + "bluetooth", "browsing-topics", "camera", "ch-dpr", "ch-device-memory", "ch-downlink", "ch-ect", - "ch-partitioned-cookies", "ch-prefers-color-scheme", "ch-rtt", "ch-save-data", @@ -15993,7 +15990,6 @@ "ContentMediaDevicesDispatcherHost", "ContentWebBluetooth", "ContentWebUSB", - "ContentMediaSession", "ContentMediaSessionService", "ContentScreenReader", "EmbedderPopupBlockerTabHelper", @@ -16585,7 +16581,7 @@ }, { "name": "loaderId", - "description": "Loader identifier.", + "description": "Loader identifier. This is omitted in case of same-document navigation,\nas the previously committed loaderId would not change.", "optional": true, "$ref": "Network.LoaderId" }, @@ -18930,6 +18926,22 @@ } ], "commands": [ + { + "name": "getStorageKeyForFrame", + "description": "Returns a storage key given a frame id.", + "parameters": [ + { + "name": "frameId", + "$ref": "Page.FrameId" + } + ], + "returns": [ + { + "name": "storageKey", + "$ref": "SerializedStorageKey" + } + ] + }, { "name": "clearDataForOrigin", "description": "Clears storage for origin.", @@ -21492,7 +21504,15 @@ "commands": [ { "name": "enable", - "description": "Enable the WebAuthn domain and start intercepting credential storage and\nretrieval with a virtual authenticator." + "description": "Enable the WebAuthn domain and start intercepting credential storage and\nretrieval with a virtual authenticator.", + "parameters": [ + { + "name": "enableUI", + "description": "Whether to enable the WebAuthn user interface. Enabling the UI is\nrecommended for debugging and demo purposes, as it is closer to the real\nexperience. Disabling the UI is recommended for automated testing.\nSupported at the embedder's discretion if UI is available.\nDefaults to false.", + "optional": true, + "type": "boolean" + } + ] }, { "name": "disable", diff --git a/protocol/audits/types.go b/protocol/audits/types.go index e9d67db..944a264 100644 --- a/protocol/audits/types.go +++ b/protocol/audits/types.go @@ -527,7 +527,6 @@ const ( DeprecationIssueTypeCrossOriginWindowAlert DeprecationIssueType = "CrossOriginWindowAlert" DeprecationIssueTypeCrossOriginWindowConfirm DeprecationIssueType = "CrossOriginWindowConfirm" DeprecationIssueTypeCSSSelectorInternalMediaControlsOverlayCastButton DeprecationIssueType = "CSSSelectorInternalMediaControlsOverlayCastButton" - DeprecationIssueTypeCustomCursorIntersectsViewport DeprecationIssueType = "CustomCursorIntersectsViewport" DeprecationIssueTypeDeprecationExample DeprecationIssueType = "DeprecationExample" DeprecationIssueTypeDocumentDomainSettingWithoutOriginAgentClusterHeader DeprecationIssueType = "DocumentDomainSettingWithoutOriginAgentClusterHeader" DeprecationIssueTypeEventPath DeprecationIssueType = "EventPath" @@ -538,7 +537,6 @@ const ( DeprecationIssueTypeInsecurePrivateNetworkSubresourceRequest DeprecationIssueType = "InsecurePrivateNetworkSubresourceRequest" DeprecationIssueTypeLegacyConstraintGoogIPv6 DeprecationIssueType = "LegacyConstraintGoogIPv6" DeprecationIssueTypeLocalCSSFileExtensionRejected DeprecationIssueType = "LocalCSSFileExtensionRejected" - DeprecationIssueTypeMediaElementAudioSourceNode DeprecationIssueType = "MediaElementAudioSourceNode" DeprecationIssueTypeMediaSourceAbortRemove DeprecationIssueType = "MediaSourceAbortRemove" DeprecationIssueTypeMediaSourceDurationTruncatingBuffered DeprecationIssueType = "MediaSourceDurationTruncatingBuffered" DeprecationIssueTypeNoSysexWebMIDIWithoutPermission DeprecationIssueType = "NoSysexWebMIDIWithoutPermission" @@ -546,7 +544,6 @@ const ( DeprecationIssueTypeNotificationPermissionRequestedIframe DeprecationIssueType = "NotificationPermissionRequestedIframe" DeprecationIssueTypeObsoleteWebRtcCipherSuite DeprecationIssueType = "ObsoleteWebRtcCipherSuite" DeprecationIssueTypePaymentRequestBasicCard DeprecationIssueType = "PaymentRequestBasicCard" - DeprecationIssueTypePaymentRequestShowWithoutGesture DeprecationIssueType = "PaymentRequestShowWithoutGesture" DeprecationIssueTypePictureSourceSrc DeprecationIssueType = "PictureSourceSrc" DeprecationIssueTypePrefixedCancelAnimationFrame DeprecationIssueType = "PrefixedCancelAnimationFrame" DeprecationIssueTypePrefixedRequestAnimationFrame DeprecationIssueType = "PrefixedRequestAnimationFrame" @@ -564,7 +561,6 @@ const ( DeprecationIssueTypeRTCPeerConnectionComplexPlanBSdpUsingDefaultSdpSemantics DeprecationIssueType = "RTCPeerConnectionComplexPlanBSdpUsingDefaultSdpSemantics" DeprecationIssueTypeRTCPeerConnectionSdpSemanticsPlanB DeprecationIssueType = "RTCPeerConnectionSdpSemanticsPlanB" DeprecationIssueTypeRtcpMuxPolicyNegotiate DeprecationIssueType = "RtcpMuxPolicyNegotiate" - DeprecationIssueTypeRTPDataChannel DeprecationIssueType = "RTPDataChannel" DeprecationIssueTypeSharedArrayBufferConstructedWithoutIsolation DeprecationIssueType = "SharedArrayBufferConstructedWithoutIsolation" DeprecationIssueTypeTextToSpeechDisallowedByAutoplay DeprecationIssueType = "TextToSpeech_DisallowedByAutoplay" DeprecationIssueTypeV8SharedArrayBufferConstructedInExtensionWithoutIsolation DeprecationIssueType = "V8SharedArrayBufferConstructedInExtensionWithoutIsolation" @@ -575,7 +571,7 @@ const ( func (e DeprecationIssueType) Valid() bool { switch e { - case "AuthorizationCoveredByWildcard", "CanRequestURLHTTPContainingNewline", "ChromeLoadTimesConnectionInfo", "ChromeLoadTimesFirstPaintAfterLoadTime", "ChromeLoadTimesWasAlternateProtocolAvailable", "CookieWithTruncatingChar", "CrossOriginAccessBasedOnDocumentDomain", "CrossOriginWindowAlert", "CrossOriginWindowConfirm", "CSSSelectorInternalMediaControlsOverlayCastButton", "CustomCursorIntersectsViewport", "DeprecationExample", "DocumentDomainSettingWithoutOriginAgentClusterHeader", "EventPath", "GeolocationInsecureOrigin", "GeolocationInsecureOriginDeprecatedNotRemoved", "GetUserMediaInsecureOrigin", "HostCandidateAttributeGetter", "InsecurePrivateNetworkSubresourceRequest", "LegacyConstraintGoogIPv6", "LocalCSSFileExtensionRejected", "MediaElementAudioSourceNode", "MediaSourceAbortRemove", "MediaSourceDurationTruncatingBuffered", "NoSysexWebMIDIWithoutPermission", "NotificationInsecureOrigin", "NotificationPermissionRequestedIframe", "ObsoleteWebRtcCipherSuite", "PaymentRequestBasicCard", "PaymentRequestShowWithoutGesture", "PictureSourceSrc", "PrefixedCancelAnimationFrame", "PrefixedRequestAnimationFrame", "PrefixedStorageInfo", "PrefixedVideoDisplayingFullscreen", "PrefixedVideoEnterFullscreen", "PrefixedVideoEnterFullScreen", "PrefixedVideoExitFullscreen", "PrefixedVideoExitFullScreen", "PrefixedVideoSupportsFullscreen", "RangeExpand", "RequestedSubresourceWithEmbeddedCredentials", "RTCConstraintEnableDtlsSrtpFalse", "RTCConstraintEnableDtlsSrtpTrue", "RTCPeerConnectionComplexPlanBSdpUsingDefaultSdpSemantics", "RTCPeerConnectionSdpSemanticsPlanB", "RtcpMuxPolicyNegotiate", "RTPDataChannel", "SharedArrayBufferConstructedWithoutIsolation", "TextToSpeech_DisallowedByAutoplay", "V8SharedArrayBufferConstructedInExtensionWithoutIsolation", "XHRJSONEncodingDetection", "XMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload", "XRSupportsSession": + case "AuthorizationCoveredByWildcard", "CanRequestURLHTTPContainingNewline", "ChromeLoadTimesConnectionInfo", "ChromeLoadTimesFirstPaintAfterLoadTime", "ChromeLoadTimesWasAlternateProtocolAvailable", "CookieWithTruncatingChar", "CrossOriginAccessBasedOnDocumentDomain", "CrossOriginWindowAlert", "CrossOriginWindowConfirm", "CSSSelectorInternalMediaControlsOverlayCastButton", "DeprecationExample", "DocumentDomainSettingWithoutOriginAgentClusterHeader", "EventPath", "GeolocationInsecureOrigin", "GeolocationInsecureOriginDeprecatedNotRemoved", "GetUserMediaInsecureOrigin", "HostCandidateAttributeGetter", "InsecurePrivateNetworkSubresourceRequest", "LegacyConstraintGoogIPv6", "LocalCSSFileExtensionRejected", "MediaSourceAbortRemove", "MediaSourceDurationTruncatingBuffered", "NoSysexWebMIDIWithoutPermission", "NotificationInsecureOrigin", "NotificationPermissionRequestedIframe", "ObsoleteWebRtcCipherSuite", "PaymentRequestBasicCard", "PictureSourceSrc", "PrefixedCancelAnimationFrame", "PrefixedRequestAnimationFrame", "PrefixedStorageInfo", "PrefixedVideoDisplayingFullscreen", "PrefixedVideoEnterFullscreen", "PrefixedVideoEnterFullScreen", "PrefixedVideoExitFullscreen", "PrefixedVideoExitFullScreen", "PrefixedVideoSupportsFullscreen", "RangeExpand", "RequestedSubresourceWithEmbeddedCredentials", "RTCConstraintEnableDtlsSrtpFalse", "RTCConstraintEnableDtlsSrtpTrue", "RTCPeerConnectionComplexPlanBSdpUsingDefaultSdpSemantics", "RTCPeerConnectionSdpSemanticsPlanB", "RtcpMuxPolicyNegotiate", "SharedArrayBufferConstructedWithoutIsolation", "TextToSpeech_DisallowedByAutoplay", "V8SharedArrayBufferConstructedInExtensionWithoutIsolation", "XHRJSONEncodingDetection", "XMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload", "XRSupportsSession": return true default: return false diff --git a/protocol/dom/types.go b/protocol/dom/types.go index 6fbde4c..812f930 100644 --- a/protocol/dom/types.go +++ b/protocol/dom/types.go @@ -154,6 +154,7 @@ type Node struct { DistributedNodes []BackendNode `json:"distributedNodes,omitempty"` // Distributed nodes for given insertion point. IsSVG *bool `json:"isSVG,omitempty"` // Whether the node is SVG. CompatibilityMode CompatibilityMode `json:"compatibilityMode,omitempty"` // No description. + AssignedSlot *BackendNode `json:"assignedSlot,omitempty"` // No description. } // RGBA A structure holding an RGBA color. diff --git a/protocol/domstorage/command.go b/protocol/domstorage/command.go index cf6845a..0a486a6 100644 --- a/protocol/domstorage/command.go +++ b/protocol/domstorage/command.go @@ -2,10 +2,6 @@ package domstorage -import ( - "github.com/mafredri/cdp/protocol/page" -) - // ClearArgs represents the arguments for Clear in the DOMStorage domain. type ClearArgs struct { StorageID StorageID `json:"storageId"` // No description. @@ -64,20 +60,3 @@ func NewSetDOMStorageItemArgs(storageID StorageID, key string, value string) *Se args.Value = value return args } - -// GetStorageKeyForFrameArgs represents the arguments for GetStorageKeyForFrame in the DOMStorage domain. -type GetStorageKeyForFrameArgs struct { - FrameID page.FrameID `json:"frameId"` // No description. -} - -// NewGetStorageKeyForFrameArgs initializes GetStorageKeyForFrameArgs with the required arguments. -func NewGetStorageKeyForFrameArgs(frameID page.FrameID) *GetStorageKeyForFrameArgs { - args := new(GetStorageKeyForFrameArgs) - args.FrameID = frameID - return args -} - -// GetStorageKeyForFrameReply represents the return values for GetStorageKeyForFrame in the DOMStorage domain. -type GetStorageKeyForFrameReply struct { - StorageKey SerializedStorageKey `json:"storageKey"` // No description. -} diff --git a/protocol/domstorage/domain.go b/protocol/domstorage/domain.go index 708717d..29ba595 100644 --- a/protocol/domstorage/domain.go +++ b/protocol/domstorage/domain.go @@ -93,20 +93,6 @@ func (d *domainClient) SetDOMStorageItem(ctx context.Context, args *SetDOMStorag return } -// GetStorageKeyForFrame invokes the DOMStorage method. -func (d *domainClient) GetStorageKeyForFrame(ctx context.Context, args *GetStorageKeyForFrameArgs) (reply *GetStorageKeyForFrameReply, err error) { - reply = new(GetStorageKeyForFrameReply) - if args != nil { - err = rpcc.Invoke(ctx, "DOMStorage.getStorageKeyForFrame", args, reply, d.conn) - } else { - err = rpcc.Invoke(ctx, "DOMStorage.getStorageKeyForFrame", nil, reply, d.conn) - } - if err != nil { - err = &internal.OpError{Domain: "DOMStorage", Op: "GetStorageKeyForFrame", Err: err} - } - return -} - func (d *domainClient) DOMStorageItemAdded(ctx context.Context) (ItemAddedClient, error) { s, err := rpcc.NewStream(ctx, "DOMStorage.domStorageItemAdded", d.conn) if err != nil { diff --git a/protocol/emulation/command.go b/protocol/emulation/command.go index 195c86e..217b8df 100644 --- a/protocol/emulation/command.go +++ b/protocol/emulation/command.go @@ -515,6 +515,18 @@ func NewSetDisabledImageTypesArgs(imageTypes []DisabledImageType) *SetDisabledIm return args } +// SetHardwareConcurrencyOverrideArgs represents the arguments for SetHardwareConcurrencyOverride in the Emulation domain. +type SetHardwareConcurrencyOverrideArgs struct { + HardwareConcurrency int `json:"hardwareConcurrency"` // Hardware concurrency to report +} + +// NewSetHardwareConcurrencyOverrideArgs initializes SetHardwareConcurrencyOverrideArgs with the required arguments. +func NewSetHardwareConcurrencyOverrideArgs(hardwareConcurrency int) *SetHardwareConcurrencyOverrideArgs { + args := new(SetHardwareConcurrencyOverrideArgs) + args.HardwareConcurrency = hardwareConcurrency + return args +} + // SetUserAgentOverrideArgs represents the arguments for SetUserAgentOverride in the Emulation domain. type SetUserAgentOverrideArgs struct { UserAgent string `json:"userAgent"` // User agent to use. diff --git a/protocol/emulation/domain.go b/protocol/emulation/domain.go index 1b5877b..7704f72 100644 --- a/protocol/emulation/domain.go +++ b/protocol/emulation/domain.go @@ -369,6 +369,19 @@ func (d *domainClient) SetDisabledImageTypes(ctx context.Context, args *SetDisab return } +// SetHardwareConcurrencyOverride invokes the Emulation method. +func (d *domainClient) SetHardwareConcurrencyOverride(ctx context.Context, args *SetHardwareConcurrencyOverrideArgs) (err error) { + if args != nil { + err = rpcc.Invoke(ctx, "Emulation.setHardwareConcurrencyOverride", args, nil, d.conn) + } else { + err = rpcc.Invoke(ctx, "Emulation.setHardwareConcurrencyOverride", nil, nil, d.conn) + } + if err != nil { + err = &internal.OpError{Domain: "Emulation", Op: "SetHardwareConcurrencyOverride", Err: err} + } + return +} + // SetUserAgentOverride invokes the Emulation method. Allows overriding user // agent with the given string. func (d *domainClient) SetUserAgentOverride(ctx context.Context, args *SetUserAgentOverrideArgs) (err error) { diff --git a/protocol/page/command.go b/protocol/page/command.go index 4e2ab9e..1f2e04d 100644 --- a/protocol/page/command.go +++ b/protocol/page/command.go @@ -371,7 +371,7 @@ func (a *NavigateArgs) SetReferrerPolicy(referrerPolicy ReferrerPolicy) *Navigat // NavigateReply represents the return values for Navigate in the Page domain. type NavigateReply struct { FrameID FrameID `json:"frameId"` // Frame id that has navigated (or failed to navigate) - LoaderID *network.LoaderID `json:"loaderId,omitempty"` // Loader identifier. + LoaderID *network.LoaderID `json:"loaderId,omitempty"` // Loader identifier. This is omitted in case of same-document navigation, as the previously committed loaderId would not change. ErrorText *string `json:"errorText,omitempty"` // User friendly error message, present if and only if navigation has failed. } diff --git a/protocol/page/types.go b/protocol/page/types.go index 1b922a9..2e2f1df 100644 --- a/protocol/page/types.go +++ b/protocol/page/types.go @@ -167,13 +167,13 @@ const ( PermissionsPolicyFeatureAmbientLightSensor PermissionsPolicyFeature = "ambient-light-sensor" PermissionsPolicyFeatureAttributionReporting PermissionsPolicyFeature = "attribution-reporting" PermissionsPolicyFeatureAutoplay PermissionsPolicyFeature = "autoplay" + PermissionsPolicyFeatureBluetooth PermissionsPolicyFeature = "bluetooth" PermissionsPolicyFeatureBrowsingTopics PermissionsPolicyFeature = "browsing-topics" PermissionsPolicyFeatureCamera PermissionsPolicyFeature = "camera" PermissionsPolicyFeatureChDpr PermissionsPolicyFeature = "ch-dpr" PermissionsPolicyFeatureChDeviceMemory PermissionsPolicyFeature = "ch-device-memory" PermissionsPolicyFeatureChDownlink PermissionsPolicyFeature = "ch-downlink" PermissionsPolicyFeatureChEct PermissionsPolicyFeature = "ch-ect" - PermissionsPolicyFeatureChPartitionedCookies PermissionsPolicyFeature = "ch-partitioned-cookies" PermissionsPolicyFeatureChPrefersColorScheme PermissionsPolicyFeature = "ch-prefers-color-scheme" PermissionsPolicyFeatureChRtt PermissionsPolicyFeature = "ch-rtt" PermissionsPolicyFeatureChSaveData PermissionsPolicyFeature = "ch-save-data" @@ -236,7 +236,7 @@ const ( func (e PermissionsPolicyFeature) Valid() bool { switch e { - case "accelerometer", "ambient-light-sensor", "attribution-reporting", "autoplay", "browsing-topics", "camera", "ch-dpr", "ch-device-memory", "ch-downlink", "ch-ect", "ch-partitioned-cookies", "ch-prefers-color-scheme", "ch-rtt", "ch-save-data", "ch-ua", "ch-ua-arch", "ch-ua-bitness", "ch-ua-platform", "ch-ua-model", "ch-ua-mobile", "ch-ua-full", "ch-ua-full-version", "ch-ua-full-version-list", "ch-ua-platform-version", "ch-ua-reduced", "ch-ua-wow64", "ch-viewport-height", "ch-viewport-width", "ch-width", "clipboard-read", "clipboard-write", "cross-origin-isolated", "direct-sockets", "display-capture", "document-domain", "encrypted-media", "execution-while-out-of-viewport", "execution-while-not-rendered", "focus-without-user-activation", "fullscreen", "frobulate", "gamepad", "geolocation", "gyroscope", "hid", "idle-detection", "interest-cohort", "join-ad-interest-group", "keyboard-map", "local-fonts", "magnetometer", "microphone", "midi", "otp-credentials", "payment", "picture-in-picture", "publickey-credentials-get", "run-ad-auction", "screen-wake-lock", "serial", "shared-autofill", "storage-access-api", "sync-xhr", "trust-token-redemption", "usb", "vertical-scroll", "web-share", "window-placement", "xr-spatial-tracking": + case "accelerometer", "ambient-light-sensor", "attribution-reporting", "autoplay", "bluetooth", "browsing-topics", "camera", "ch-dpr", "ch-device-memory", "ch-downlink", "ch-ect", "ch-prefers-color-scheme", "ch-rtt", "ch-save-data", "ch-ua", "ch-ua-arch", "ch-ua-bitness", "ch-ua-platform", "ch-ua-model", "ch-ua-mobile", "ch-ua-full", "ch-ua-full-version", "ch-ua-full-version-list", "ch-ua-platform-version", "ch-ua-reduced", "ch-ua-wow64", "ch-viewport-height", "ch-viewport-width", "ch-width", "clipboard-read", "clipboard-write", "cross-origin-isolated", "direct-sockets", "display-capture", "document-domain", "encrypted-media", "execution-while-out-of-viewport", "execution-while-not-rendered", "focus-without-user-activation", "fullscreen", "frobulate", "gamepad", "geolocation", "gyroscope", "hid", "idle-detection", "interest-cohort", "join-ad-interest-group", "keyboard-map", "local-fonts", "magnetometer", "microphone", "midi", "otp-credentials", "payment", "picture-in-picture", "publickey-credentials-get", "run-ad-auction", "screen-wake-lock", "serial", "shared-autofill", "storage-access-api", "sync-xhr", "trust-token-redemption", "usb", "vertical-scroll", "web-share", "window-placement", "xr-spatial-tracking": return true default: return false @@ -897,7 +897,6 @@ const ( BackForwardCacheNotRestoredReasonContentMediaDevicesDispatcherHost BackForwardCacheNotRestoredReason = "ContentMediaDevicesDispatcherHost" BackForwardCacheNotRestoredReasonContentWebBluetooth BackForwardCacheNotRestoredReason = "ContentWebBluetooth" BackForwardCacheNotRestoredReasonContentWebUSB BackForwardCacheNotRestoredReason = "ContentWebUSB" - BackForwardCacheNotRestoredReasonContentMediaSession BackForwardCacheNotRestoredReason = "ContentMediaSession" BackForwardCacheNotRestoredReasonContentMediaSessionService BackForwardCacheNotRestoredReason = "ContentMediaSessionService" BackForwardCacheNotRestoredReasonContentScreenReader BackForwardCacheNotRestoredReason = "ContentScreenReader" BackForwardCacheNotRestoredReasonEmbedderPopupBlockerTabHelper BackForwardCacheNotRestoredReason = "EmbedderPopupBlockerTabHelper" @@ -919,7 +918,7 @@ const ( func (e BackForwardCacheNotRestoredReason) Valid() bool { switch e { - case "NotPrimaryMainFrame", "BackForwardCacheDisabled", "RelatedActiveContentsExist", "HTTPStatusNotOK", "SchemeNotHTTPOrHTTPS", "Loading", "WasGrantedMediaAccess", "DisableForRenderFrameHostCalled", "DomainNotAllowed", "HTTPMethodNotGET", "SubframeIsNavigating", "Timeout", "CacheLimit", "JavaScriptExecution", "RendererProcessKilled", "RendererProcessCrashed", "SchedulerTrackedFeatureUsed", "ConflictingBrowsingInstance", "CacheFlushed", "ServiceWorkerVersionActivation", "SessionRestored", "ServiceWorkerPostMessage", "EnteredBackForwardCacheBeforeServiceWorkerHostAdded", "RenderFrameHostReused_SameSite", "RenderFrameHostReused_CrossSite", "ServiceWorkerClaim", "IgnoreEventAndEvict", "HaveInnerContents", "TimeoutPuttingInCache", "BackForwardCacheDisabledByLowMemory", "BackForwardCacheDisabledByCommandLine", "NetworkRequestDatapipeDrainedAsBytesConsumer", "NetworkRequestRedirected", "NetworkRequestTimeout", "NetworkExceedsBufferLimit", "NavigationCancelledWhileRestoring", "NotMostRecentNavigationEntry", "BackForwardCacheDisabledForPrerender", "UserAgentOverrideDiffers", "ForegroundCacheLimit", "BrowsingInstanceNotSwapped", "BackForwardCacheDisabledForDelegate", "UnloadHandlerExistsInMainFrame", "UnloadHandlerExistsInSubFrame", "ServiceWorkerUnregistration", "CacheControlNoStore", "CacheControlNoStoreCookieModified", "CacheControlNoStoreHTTPOnlyCookieModified", "NoResponseHead", "Unknown", "ActivationNavigationsDisallowedForBug1234857", "ErrorDocument", "FencedFramesEmbedder", "WebSocket", "WebTransport", "WebRTC", "MainResourceHasCacheControlNoStore", "MainResourceHasCacheControlNoCache", "SubresourceHasCacheControlNoStore", "SubresourceHasCacheControlNoCache", "ContainsPlugins", "DocumentLoaded", "DedicatedWorkerOrWorklet", "OutstandingNetworkRequestOthers", "OutstandingIndexedDBTransaction", "RequestedNotificationsPermission", "RequestedMIDIPermission", "RequestedAudioCapturePermission", "RequestedVideoCapturePermission", "RequestedBackForwardCacheBlockedSensors", "RequestedBackgroundWorkPermission", "BroadcastChannel", "IndexedDBConnection", "WebXR", "SharedWorker", "WebLocks", "WebHID", "WebShare", "RequestedStorageAccessGrant", "WebNfc", "OutstandingNetworkRequestFetch", "OutstandingNetworkRequestXHR", "AppBanner", "Printing", "WebDatabase", "PictureInPicture", "Portal", "SpeechRecognizer", "IdleManager", "PaymentManager", "SpeechSynthesis", "KeyboardLock", "WebOTPService", "OutstandingNetworkRequestDirectSocket", "InjectedJavascript", "InjectedStyleSheet", "Dummy", "ContentSecurityHandler", "ContentWebAuthenticationAPI", "ContentFileChooser", "ContentSerial", "ContentFileSystemAccess", "ContentMediaDevicesDispatcherHost", "ContentWebBluetooth", "ContentWebUSB", "ContentMediaSession", "ContentMediaSessionService", "ContentScreenReader", "EmbedderPopupBlockerTabHelper", "EmbedderSafeBrowsingTriggeredPopupBlocker", "EmbedderSafeBrowsingThreatDetails", "EmbedderAppBannerManager", "EmbedderDomDistillerViewerSource", "EmbedderDomDistillerSelfDeletingRequestDelegate", "EmbedderOomInterventionTabHelper", "EmbedderOfflinePage", "EmbedderChromePasswordManagerClientBindCredentialManager", "EmbedderPermissionRequestManager", "EmbedderModalDialog", "EmbedderExtensions", "EmbedderExtensionMessaging", "EmbedderExtensionMessagingForOpenPort", "EmbedderExtensionSentMessageToCachedFrame": + case "NotPrimaryMainFrame", "BackForwardCacheDisabled", "RelatedActiveContentsExist", "HTTPStatusNotOK", "SchemeNotHTTPOrHTTPS", "Loading", "WasGrantedMediaAccess", "DisableForRenderFrameHostCalled", "DomainNotAllowed", "HTTPMethodNotGET", "SubframeIsNavigating", "Timeout", "CacheLimit", "JavaScriptExecution", "RendererProcessKilled", "RendererProcessCrashed", "SchedulerTrackedFeatureUsed", "ConflictingBrowsingInstance", "CacheFlushed", "ServiceWorkerVersionActivation", "SessionRestored", "ServiceWorkerPostMessage", "EnteredBackForwardCacheBeforeServiceWorkerHostAdded", "RenderFrameHostReused_SameSite", "RenderFrameHostReused_CrossSite", "ServiceWorkerClaim", "IgnoreEventAndEvict", "HaveInnerContents", "TimeoutPuttingInCache", "BackForwardCacheDisabledByLowMemory", "BackForwardCacheDisabledByCommandLine", "NetworkRequestDatapipeDrainedAsBytesConsumer", "NetworkRequestRedirected", "NetworkRequestTimeout", "NetworkExceedsBufferLimit", "NavigationCancelledWhileRestoring", "NotMostRecentNavigationEntry", "BackForwardCacheDisabledForPrerender", "UserAgentOverrideDiffers", "ForegroundCacheLimit", "BrowsingInstanceNotSwapped", "BackForwardCacheDisabledForDelegate", "UnloadHandlerExistsInMainFrame", "UnloadHandlerExistsInSubFrame", "ServiceWorkerUnregistration", "CacheControlNoStore", "CacheControlNoStoreCookieModified", "CacheControlNoStoreHTTPOnlyCookieModified", "NoResponseHead", "Unknown", "ActivationNavigationsDisallowedForBug1234857", "ErrorDocument", "FencedFramesEmbedder", "WebSocket", "WebTransport", "WebRTC", "MainResourceHasCacheControlNoStore", "MainResourceHasCacheControlNoCache", "SubresourceHasCacheControlNoStore", "SubresourceHasCacheControlNoCache", "ContainsPlugins", "DocumentLoaded", "DedicatedWorkerOrWorklet", "OutstandingNetworkRequestOthers", "OutstandingIndexedDBTransaction", "RequestedNotificationsPermission", "RequestedMIDIPermission", "RequestedAudioCapturePermission", "RequestedVideoCapturePermission", "RequestedBackForwardCacheBlockedSensors", "RequestedBackgroundWorkPermission", "BroadcastChannel", "IndexedDBConnection", "WebXR", "SharedWorker", "WebLocks", "WebHID", "WebShare", "RequestedStorageAccessGrant", "WebNfc", "OutstandingNetworkRequestFetch", "OutstandingNetworkRequestXHR", "AppBanner", "Printing", "WebDatabase", "PictureInPicture", "Portal", "SpeechRecognizer", "IdleManager", "PaymentManager", "SpeechSynthesis", "KeyboardLock", "WebOTPService", "OutstandingNetworkRequestDirectSocket", "InjectedJavascript", "InjectedStyleSheet", "Dummy", "ContentSecurityHandler", "ContentWebAuthenticationAPI", "ContentFileChooser", "ContentSerial", "ContentFileSystemAccess", "ContentMediaDevicesDispatcherHost", "ContentWebBluetooth", "ContentWebUSB", "ContentMediaSessionService", "ContentScreenReader", "EmbedderPopupBlockerTabHelper", "EmbedderSafeBrowsingTriggeredPopupBlocker", "EmbedderSafeBrowsingThreatDetails", "EmbedderAppBannerManager", "EmbedderDomDistillerViewerSource", "EmbedderDomDistillerSelfDeletingRequestDelegate", "EmbedderOomInterventionTabHelper", "EmbedderOfflinePage", "EmbedderChromePasswordManagerClientBindCredentialManager", "EmbedderPermissionRequestManager", "EmbedderModalDialog", "EmbedderExtensions", "EmbedderExtensionMessaging", "EmbedderExtensionMessagingForOpenPort", "EmbedderExtensionSentMessageToCachedFrame": return true default: return false diff --git a/protocol/storage/command.go b/protocol/storage/command.go index b6d5655..5faa190 100644 --- a/protocol/storage/command.go +++ b/protocol/storage/command.go @@ -5,8 +5,26 @@ package storage import ( "github.com/mafredri/cdp/protocol/browser" "github.com/mafredri/cdp/protocol/network" + "github.com/mafredri/cdp/protocol/page" ) +// GetStorageKeyForFrameArgs represents the arguments for GetStorageKeyForFrame in the Storage domain. +type GetStorageKeyForFrameArgs struct { + FrameID page.FrameID `json:"frameId"` // No description. +} + +// NewGetStorageKeyForFrameArgs initializes GetStorageKeyForFrameArgs with the required arguments. +func NewGetStorageKeyForFrameArgs(frameID page.FrameID) *GetStorageKeyForFrameArgs { + args := new(GetStorageKeyForFrameArgs) + args.FrameID = frameID + return args +} + +// GetStorageKeyForFrameReply represents the return values for GetStorageKeyForFrame in the Storage domain. +type GetStorageKeyForFrameReply struct { + StorageKey SerializedStorageKey `json:"storageKey"` // No description. +} + // ClearDataForOriginArgs represents the arguments for ClearDataForOrigin in the Storage domain. type ClearDataForOriginArgs struct { Origin string `json:"origin"` // Security origin. diff --git a/protocol/storage/domain.go b/protocol/storage/domain.go index 2f24b85..920704b 100644 --- a/protocol/storage/domain.go +++ b/protocol/storage/domain.go @@ -18,6 +18,21 @@ func NewClient(conn *rpcc.Conn) *domainClient { return &domainClient{conn: conn} } +// GetStorageKeyForFrame invokes the Storage method. Returns a storage key +// given a frame id. +func (d *domainClient) GetStorageKeyForFrame(ctx context.Context, args *GetStorageKeyForFrameArgs) (reply *GetStorageKeyForFrameReply, err error) { + reply = new(GetStorageKeyForFrameReply) + if args != nil { + err = rpcc.Invoke(ctx, "Storage.getStorageKeyForFrame", args, reply, d.conn) + } else { + err = rpcc.Invoke(ctx, "Storage.getStorageKeyForFrame", nil, reply, d.conn) + } + if err != nil { + err = &internal.OpError{Domain: "Storage", Op: "GetStorageKeyForFrame", Err: err} + } + return +} + // ClearDataForOrigin invokes the Storage method. Clears storage for origin. func (d *domainClient) ClearDataForOrigin(ctx context.Context, args *ClearDataForOriginArgs) (err error) { if args != nil { diff --git a/protocol/webauthn/command.go b/protocol/webauthn/command.go index 9fbf332..b64f0f8 100644 --- a/protocol/webauthn/command.go +++ b/protocol/webauthn/command.go @@ -2,6 +2,28 @@ package webauthn +// EnableArgs represents the arguments for Enable in the WebAuthn domain. +type EnableArgs struct { + EnableUI *bool `json:"enableUI,omitempty"` // Whether to enable the WebAuthn user interface. Enabling the UI is recommended for debugging and demo purposes, as it is closer to the real experience. Disabling the UI is recommended for automated testing. Supported at the embedder's discretion if UI is available. Defaults to false. +} + +// NewEnableArgs initializes EnableArgs with the required arguments. +func NewEnableArgs() *EnableArgs { + args := new(EnableArgs) + + return args +} + +// SetEnableUI sets the EnableUI optional argument. Whether to enable +// the WebAuthn user interface. Enabling the UI is recommended for +// debugging and demo purposes, as it is closer to the real experience. +// Disabling the UI is recommended for automated testing. Supported at +// the embedder's discretion if UI is available. Defaults to false. +func (a *EnableArgs) SetEnableUI(enableUI bool) *EnableArgs { + a.EnableUI = &enableUI + return a +} + // AddVirtualAuthenticatorArgs represents the arguments for AddVirtualAuthenticator in the WebAuthn domain. type AddVirtualAuthenticatorArgs struct { Options VirtualAuthenticatorOptions `json:"options"` // No description. diff --git a/protocol/webauthn/domain.go b/protocol/webauthn/domain.go index 7d21118..13b71dd 100644 --- a/protocol/webauthn/domain.go +++ b/protocol/webauthn/domain.go @@ -22,8 +22,12 @@ func NewClient(conn *rpcc.Conn) *domainClient { // Enable invokes the WebAuthn method. Enable the WebAuthn domain and start // intercepting credential storage and retrieval with a virtual authenticator. -func (d *domainClient) Enable(ctx context.Context) (err error) { - err = rpcc.Invoke(ctx, "WebAuthn.enable", nil, nil, d.conn) +func (d *domainClient) Enable(ctx context.Context, args *EnableArgs) (err error) { + if args != nil { + err = rpcc.Invoke(ctx, "WebAuthn.enable", args, nil, d.conn) + } else { + err = rpcc.Invoke(ctx, "WebAuthn.enable", nil, nil, d.conn) + } if err != nil { err = &internal.OpError{Domain: "WebAuthn", Op: "Enable", Err: err} }