diff --git a/audits/types.go b/audits/types.go index 880cb05..dbed756 100644 --- a/audits/types.go +++ b/audits/types.go @@ -301,33 +301,34 @@ func (t MixedContentResourceType) String() string { // MixedContentResourceType values. const ( - MixedContentResourceTypeAttributionSrc MixedContentResourceType = "AttributionSrc" - MixedContentResourceTypeAudio MixedContentResourceType = "Audio" - MixedContentResourceTypeBeacon MixedContentResourceType = "Beacon" - MixedContentResourceTypeCSPReport MixedContentResourceType = "CSPReport" - MixedContentResourceTypeDownload MixedContentResourceType = "Download" - MixedContentResourceTypeEventSource MixedContentResourceType = "EventSource" - MixedContentResourceTypeFavicon MixedContentResourceType = "Favicon" - MixedContentResourceTypeFont MixedContentResourceType = "Font" - MixedContentResourceTypeForm MixedContentResourceType = "Form" - MixedContentResourceTypeFrame MixedContentResourceType = "Frame" - MixedContentResourceTypeImage MixedContentResourceType = "Image" - MixedContentResourceTypeImport MixedContentResourceType = "Import" - MixedContentResourceTypeManifest MixedContentResourceType = "Manifest" - MixedContentResourceTypePing MixedContentResourceType = "Ping" - MixedContentResourceTypePluginData MixedContentResourceType = "PluginData" - MixedContentResourceTypePluginResource MixedContentResourceType = "PluginResource" - MixedContentResourceTypePrefetch MixedContentResourceType = "Prefetch" - MixedContentResourceTypeResource MixedContentResourceType = "Resource" - MixedContentResourceTypeScript MixedContentResourceType = "Script" - MixedContentResourceTypeServiceWorker MixedContentResourceType = "ServiceWorker" - MixedContentResourceTypeSharedWorker MixedContentResourceType = "SharedWorker" - MixedContentResourceTypeStylesheet MixedContentResourceType = "Stylesheet" - MixedContentResourceTypeTrack MixedContentResourceType = "Track" - MixedContentResourceTypeVideo MixedContentResourceType = "Video" - MixedContentResourceTypeWorker MixedContentResourceType = "Worker" - MixedContentResourceTypeXMLHTTPRequest MixedContentResourceType = "XMLHttpRequest" - MixedContentResourceTypeXSLT MixedContentResourceType = "XSLT" + MixedContentResourceTypeAttributionSrc MixedContentResourceType = "AttributionSrc" + MixedContentResourceTypeAudio MixedContentResourceType = "Audio" + MixedContentResourceTypeBeacon MixedContentResourceType = "Beacon" + MixedContentResourceTypeCSPReport MixedContentResourceType = "CSPReport" + MixedContentResourceTypeDownload MixedContentResourceType = "Download" + MixedContentResourceTypeEventSource MixedContentResourceType = "EventSource" + MixedContentResourceTypeFavicon MixedContentResourceType = "Favicon" + MixedContentResourceTypeFont MixedContentResourceType = "Font" + MixedContentResourceTypeForm MixedContentResourceType = "Form" + MixedContentResourceTypeFrame MixedContentResourceType = "Frame" + MixedContentResourceTypeImage MixedContentResourceType = "Image" + MixedContentResourceTypeImport MixedContentResourceType = "Import" + MixedContentResourceTypeManifest MixedContentResourceType = "Manifest" + MixedContentResourceTypePing MixedContentResourceType = "Ping" + MixedContentResourceTypePluginData MixedContentResourceType = "PluginData" + MixedContentResourceTypePluginResource MixedContentResourceType = "PluginResource" + MixedContentResourceTypePrefetch MixedContentResourceType = "Prefetch" + MixedContentResourceTypeResource MixedContentResourceType = "Resource" + MixedContentResourceTypeScript MixedContentResourceType = "Script" + MixedContentResourceTypeServiceWorker MixedContentResourceType = "ServiceWorker" + MixedContentResourceTypeSharedWorker MixedContentResourceType = "SharedWorker" + MixedContentResourceTypeSpeculationRules MixedContentResourceType = "SpeculationRules" + MixedContentResourceTypeStylesheet MixedContentResourceType = "Stylesheet" + MixedContentResourceTypeTrack MixedContentResourceType = "Track" + MixedContentResourceTypeVideo MixedContentResourceType = "Video" + MixedContentResourceTypeWorker MixedContentResourceType = "Worker" + MixedContentResourceTypeXMLHTTPRequest MixedContentResourceType = "XMLHttpRequest" + MixedContentResourceTypeXSLT MixedContentResourceType = "XSLT" ) // MarshalEasyJSON satisfies easyjson.Marshaler. @@ -386,6 +387,8 @@ func (t *MixedContentResourceType) UnmarshalEasyJSON(in *jlexer.Lexer) { *t = MixedContentResourceTypeServiceWorker case MixedContentResourceTypeSharedWorker: *t = MixedContentResourceTypeSharedWorker + case MixedContentResourceTypeSpeculationRules: + *t = MixedContentResourceTypeSpeculationRules case MixedContentResourceTypeStylesheet: *t = MixedContentResourceTypeStylesheet case MixedContentResourceTypeTrack: diff --git a/cdproto.go b/cdproto.go index ba5ea53..f23110d 100644 --- a/cdproto.go +++ b/cdproto.go @@ -357,6 +357,7 @@ const ( CommandFedCmDismissDialog = fedcm.CommandDismissDialog CommandFedCmResetCooldown = fedcm.CommandResetCooldown EventFedCmDialogShown = "FedCm.dialogShown" + EventFedCmDialogClosed = "FedCm.dialogClosed" CommandFetchDisable = fetch.CommandDisable CommandFetchEnable = fetch.CommandEnable CommandFetchFailRequest = fetch.CommandFailRequest @@ -1654,6 +1655,9 @@ func UnmarshalMessage(msg *Message) (interface{}, error) { case EventFedCmDialogShown: v = new(fedcm.EventDialogShown) + case EventFedCmDialogClosed: + v = new(fedcm.EventDialogClosed) + case CommandFetchDisable: return emptyVal, nil diff --git a/emulation/easyjson.go b/emulation/easyjson.go index 01241e8..87cc70f 100644 --- a/emulation/easyjson.go +++ b/emulation/easyjson.go @@ -1932,6 +1932,16 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation22(in *jlexer.Lexer, } (*out.DisplayFeature).UnmarshalEasyJSON(in) } + case "devicePosture": + if in.IsNull() { + in.Skip() + out.DevicePosture = nil + } else { + if out.DevicePosture == nil { + out.DevicePosture = new(DevicePosture) + } + (*out.DevicePosture).UnmarshalEasyJSON(in) + } default: in.SkipRecursive() } @@ -2011,6 +2021,11 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation22(out *jwriter.Writ out.RawString(prefix) (*in.DisplayFeature).MarshalEasyJSON(out) } + if in.DevicePosture != nil { + const prefix string = ",\"devicePosture\":" + out.RawString(prefix) + (*in.DevicePosture).MarshalEasyJSON(out) + } out.RawByte('}') } @@ -3227,7 +3242,7 @@ func (v *DisplayFeature) UnmarshalJSON(data []byte) error { func (v *DisplayFeature) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation38(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation39(in *jlexer.Lexer, out *ClearIdleOverrideParams) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation39(in *jlexer.Lexer, out *DevicePosture) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -3246,6 +3261,8 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation39(in *jlexer.Lexer, continue } switch key { + case "type": + (out.Type).UnmarshalEasyJSON(in) default: in.SkipRecursive() } @@ -3256,37 +3273,42 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation39(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation39(out *jwriter.Writer, in ClearIdleOverrideParams) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation39(out *jwriter.Writer, in DevicePosture) { out.RawByte('{') first := true _ = first + { + const prefix string = ",\"type\":" + out.RawString(prefix[1:]) + (in.Type).MarshalEasyJSON(out) + } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface -func (v ClearIdleOverrideParams) MarshalJSON() ([]byte, error) { +func (v DevicePosture) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation39(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface -func (v ClearIdleOverrideParams) MarshalEasyJSON(w *jwriter.Writer) { +func (v DevicePosture) MarshalEasyJSON(w *jwriter.Writer) { easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation39(w, v) } // UnmarshalJSON supports json.Unmarshaler interface -func (v *ClearIdleOverrideParams) UnmarshalJSON(data []byte) error { +func (v *DevicePosture) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation39(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *ClearIdleOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) { +func (v *DevicePosture) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation39(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation40(in *jlexer.Lexer, out *ClearGeolocationOverrideParams) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation40(in *jlexer.Lexer, out *ClearIdleOverrideParams) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -3315,7 +3337,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation40(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation40(out *jwriter.Writer, in ClearGeolocationOverrideParams) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation40(out *jwriter.Writer, in ClearIdleOverrideParams) { out.RawByte('{') first := true _ = first @@ -3323,29 +3345,29 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation40(out *jwriter.Writ } // MarshalJSON supports json.Marshaler interface -func (v ClearGeolocationOverrideParams) MarshalJSON() ([]byte, error) { +func (v ClearIdleOverrideParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation40(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface -func (v ClearGeolocationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) { +func (v ClearIdleOverrideParams) MarshalEasyJSON(w *jwriter.Writer) { easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation40(w, v) } // UnmarshalJSON supports json.Unmarshaler interface -func (v *ClearGeolocationOverrideParams) UnmarshalJSON(data []byte) error { +func (v *ClearIdleOverrideParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation40(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *ClearGeolocationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) { +func (v *ClearIdleOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation40(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation41(in *jlexer.Lexer, out *ClearDeviceMetricsOverrideParams) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation41(in *jlexer.Lexer, out *ClearGeolocationOverrideParams) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -3374,7 +3396,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation41(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation41(out *jwriter.Writer, in ClearDeviceMetricsOverrideParams) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation41(out *jwriter.Writer, in ClearGeolocationOverrideParams) { out.RawByte('{') first := true _ = first @@ -3382,29 +3404,88 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation41(out *jwriter.Writ } // MarshalJSON supports json.Marshaler interface -func (v ClearDeviceMetricsOverrideParams) MarshalJSON() ([]byte, error) { +func (v ClearGeolocationOverrideParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation41(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface -func (v ClearDeviceMetricsOverrideParams) MarshalEasyJSON(w *jwriter.Writer) { +func (v ClearGeolocationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) { easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation41(w, v) } // UnmarshalJSON supports json.Unmarshaler interface -func (v *ClearDeviceMetricsOverrideParams) UnmarshalJSON(data []byte) error { +func (v *ClearGeolocationOverrideParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation41(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *ClearDeviceMetricsOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) { +func (v *ClearGeolocationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation41(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation42(in *jlexer.Lexer, out *CanEmulateReturns) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation42(in *jlexer.Lexer, out *ClearDeviceMetricsOverrideParams) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation42(out *jwriter.Writer, in ClearDeviceMetricsOverrideParams) { + out.RawByte('{') + first := true + _ = first + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v ClearDeviceMetricsOverrideParams) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation42(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v ClearDeviceMetricsOverrideParams) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation42(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *ClearDeviceMetricsOverrideParams) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation42(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *ClearDeviceMetricsOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation42(l, v) +} +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation43(in *jlexer.Lexer, out *CanEmulateReturns) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -3435,7 +3516,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation42(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation42(out *jwriter.Writer, in CanEmulateReturns) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation43(out *jwriter.Writer, in CanEmulateReturns) { out.RawByte('{') first := true _ = first @@ -3451,27 +3532,27 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation42(out *jwriter.Writ // MarshalJSON supports json.Marshaler interface func (v CanEmulateReturns) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation42(&w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation43(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v CanEmulateReturns) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation42(w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation43(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CanEmulateReturns) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation42(&r, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation43(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *CanEmulateReturns) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation42(l, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation43(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation43(in *jlexer.Lexer, out *CanEmulateParams) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation44(in *jlexer.Lexer, out *CanEmulateParams) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -3500,7 +3581,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation43(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation43(out *jwriter.Writer, in CanEmulateParams) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation44(out *jwriter.Writer, in CanEmulateParams) { out.RawByte('{') first := true _ = first @@ -3510,23 +3591,23 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation43(out *jwriter.Writ // MarshalJSON supports json.Marshaler interface func (v CanEmulateParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation43(&w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation44(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v CanEmulateParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation43(w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation44(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CanEmulateParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation43(&r, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation44(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *CanEmulateParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation43(l, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation44(l, v) } diff --git a/emulation/emulation.go b/emulation/emulation.go index 43cd98c..b56a325 100644 --- a/emulation/emulation.go +++ b/emulation/emulation.go @@ -219,6 +219,7 @@ type SetDeviceMetricsOverrideParams struct { ScreenOrientation *ScreenOrientation `json:"screenOrientation,omitempty"` // Screen orientation override. Viewport *page.Viewport `json:"viewport,omitempty"` // If set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions. DisplayFeature *DisplayFeature `json:"displayFeature,omitempty"` // If set, the display feature of a multi-segment screen. If not set, multi-segment support is turned-off. + DevicePosture *DevicePosture `json:"devicePosture,omitempty"` // If set, the posture of a foldable device. If not set the posture is set to continuous. } // SetDeviceMetricsOverride overrides the values of device screen dimensions @@ -305,6 +306,13 @@ func (p SetDeviceMetricsOverrideParams) WithDisplayFeature(displayFeature *Displ return &p } +// WithDevicePosture if set, the posture of a foldable device. If not set the +// posture is set to continuous. +func (p SetDeviceMetricsOverrideParams) WithDevicePosture(devicePosture *DevicePosture) *SetDeviceMetricsOverrideParams { + p.DevicePosture = devicePosture + return &p +} + // Do executes Emulation.setDeviceMetricsOverride against the provided context. func (p *SetDeviceMetricsOverrideParams) Do(ctx context.Context) (err error) { return cdp.Execute(ctx, CommandSetDeviceMetricsOverride, p, nil) diff --git a/emulation/types.go b/emulation/types.go index 8acbea3..34a716b 100644 --- a/emulation/types.go +++ b/emulation/types.go @@ -27,6 +27,13 @@ type DisplayFeature struct { MaskLength int64 `json:"maskLength"` // A display feature may mask content such that it is not physically displayed - this length along with the offset describes this area. A display feature that only splits content will have a 0 mask_length. } +// DevicePosture [no description]. +// +// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-DevicePosture +type DevicePosture struct { + Type DevicePostureType `json:"type"` // Current posture of the device +} + // MediaFeature [no description]. // // See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-MediaFeature @@ -366,6 +373,51 @@ func (t *DisplayFeatureOrientation) UnmarshalJSON(buf []byte) error { return easyjson.Unmarshal(buf, t) } +// DevicePostureType current posture of the device. +// +// See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-DevicePosture +type DevicePostureType string + +// String returns the DevicePostureType as string value. +func (t DevicePostureType) String() string { + return string(t) +} + +// DevicePostureType values. +const ( + DevicePostureTypeContinuous DevicePostureType = "continuous" + DevicePostureTypeFolded DevicePostureType = "folded" +) + +// MarshalEasyJSON satisfies easyjson.Marshaler. +func (t DevicePostureType) MarshalEasyJSON(out *jwriter.Writer) { + out.String(string(t)) +} + +// MarshalJSON satisfies json.Marshaler. +func (t DevicePostureType) MarshalJSON() ([]byte, error) { + return easyjson.Marshal(t) +} + +// UnmarshalEasyJSON satisfies easyjson.Unmarshaler. +func (t *DevicePostureType) UnmarshalEasyJSON(in *jlexer.Lexer) { + v := in.String() + switch DevicePostureType(v) { + case DevicePostureTypeContinuous: + *t = DevicePostureTypeContinuous + case DevicePostureTypeFolded: + *t = DevicePostureTypeFolded + + default: + in.AddError(fmt.Errorf("unknown DevicePostureType value: %v", v)) + } +} + +// UnmarshalJSON satisfies json.Unmarshaler. +func (t *DevicePostureType) UnmarshalJSON(buf []byte) error { + return easyjson.Unmarshal(buf, t) +} + // SetEmitTouchEventsForMouseConfiguration touch/gesture events // configuration. Default: current platform. // diff --git a/fedcm/easyjson.go b/fedcm/easyjson.go index 5be7c9c..163f9ad 100644 --- a/fedcm/easyjson.go +++ b/fedcm/easyjson.go @@ -287,7 +287,73 @@ func (v *EventDialogShown) UnmarshalJSON(data []byte) error { func (v *EventDialogShown) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm2(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm3(in *jlexer.Lexer, out *EnableParams) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm3(in *jlexer.Lexer, out *EventDialogClosed) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "dialogId": + out.DialogID = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm3(out *jwriter.Writer, in EventDialogClosed) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"dialogId\":" + out.RawString(prefix[1:]) + out.String(string(in.DialogID)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v EventDialogClosed) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm3(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v EventDialogClosed) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm3(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *EventDialogClosed) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm3(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *EventDialogClosed) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm3(l, v) +} +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm4(in *jlexer.Lexer, out *EnableParams) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -318,7 +384,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm3(in *jlexer.Lexer, out in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm3(out *jwriter.Writer, in EnableParams) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm4(out *jwriter.Writer, in EnableParams) { out.RawByte('{') first := true _ = first @@ -334,27 +400,27 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm3(out *jwriter.Writer, i // MarshalJSON supports json.Marshaler interface func (v EnableParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm3(&w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm4(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm3(w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm4(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *EnableParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm3(&r, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm4(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm3(l, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm4(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm4(in *jlexer.Lexer, out *DismissDialogParams) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm5(in *jlexer.Lexer, out *DismissDialogParams) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -387,7 +453,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm4(in *jlexer.Lexer, out in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm4(out *jwriter.Writer, in DismissDialogParams) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm5(out *jwriter.Writer, in DismissDialogParams) { out.RawByte('{') first := true _ = first @@ -407,27 +473,27 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm4(out *jwriter.Writer, i // MarshalJSON supports json.Marshaler interface func (v DismissDialogParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm4(&w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm5(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v DismissDialogParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm4(w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm5(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *DismissDialogParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm4(&r, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm5(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *DismissDialogParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm4(l, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm5(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm5(in *jlexer.Lexer, out *DisableParams) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm6(in *jlexer.Lexer, out *DisableParams) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -456,7 +522,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm5(in *jlexer.Lexer, out in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm5(out *jwriter.Writer, in DisableParams) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm6(out *jwriter.Writer, in DisableParams) { out.RawByte('{') first := true _ = first @@ -466,27 +532,27 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm5(out *jwriter.Writer, i // MarshalJSON supports json.Marshaler interface func (v DisableParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm5(&w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm6(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm5(w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm6(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *DisableParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm5(&r, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm6(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm5(l, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm6(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm6(in *jlexer.Lexer, out *ClickDialogButtonParams) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm7(in *jlexer.Lexer, out *ClickDialogButtonParams) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -519,7 +585,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm6(in *jlexer.Lexer, out in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm6(out *jwriter.Writer, in ClickDialogButtonParams) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm7(out *jwriter.Writer, in ClickDialogButtonParams) { out.RawByte('{') first := true _ = first @@ -539,27 +605,27 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm6(out *jwriter.Writer, i // MarshalJSON supports json.Marshaler interface func (v ClickDialogButtonParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm6(&w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm7(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v ClickDialogButtonParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm6(w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm7(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *ClickDialogButtonParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm6(&r, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm7(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *ClickDialogButtonParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm6(l, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm7(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm7(in *jlexer.Lexer, out *Account) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm8(in *jlexer.Lexer, out *Account) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -608,7 +674,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm7(in *jlexer.Lexer, out in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm7(out *jwriter.Writer, in Account) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm8(out *jwriter.Writer, in Account) { out.RawByte('{') first := true _ = first @@ -668,23 +734,23 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm7(out *jwriter.Writer, i // MarshalJSON supports json.Marshaler interface func (v Account) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm7(&w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm8(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Account) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm7(w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoFedcm8(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Account) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm7(&r, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm8(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Account) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm7(l, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoFedcm8(l, v) } diff --git a/fedcm/events.go b/fedcm/events.go index 61f94aa..56208fe 100644 --- a/fedcm/events.go +++ b/fedcm/events.go @@ -12,3 +12,11 @@ type EventDialogShown struct { Title string `json:"title"` // These exist primarily so that the caller can verify the RP context was used appropriately. Subtitle string `json:"subtitle,omitempty"` } + +// EventDialogClosed triggered when a dialog is closed, either by user +// action, JS abort, or a command below. +// +// See: https://chromedevtools.github.io/devtools-protocol/tot/FedCm#event-dialogClosed +type EventDialogClosed struct { + DialogID string `json:"dialogId"` +} diff --git a/fedcm/types.go b/fedcm/types.go index a5ed1f2..01f548e 100644 --- a/fedcm/types.go +++ b/fedcm/types.go @@ -71,6 +71,7 @@ const ( DialogTypeAccountChooser DialogType = "AccountChooser" DialogTypeAutoReauthn DialogType = "AutoReauthn" DialogTypeConfirmIdpLogin DialogType = "ConfirmIdpLogin" + DialogTypeError DialogType = "Error" ) // MarshalEasyJSON satisfies easyjson.Marshaler. @@ -93,6 +94,8 @@ func (t *DialogType) UnmarshalEasyJSON(in *jlexer.Lexer) { *t = DialogTypeAutoReauthn case DialogTypeConfirmIdpLogin: *t = DialogTypeConfirmIdpLogin + case DialogTypeError: + *t = DialogTypeError default: in.AddError(fmt.Errorf("unknown DialogType value: %v", v)) @@ -117,6 +120,8 @@ func (t DialogButton) String() string { // DialogButton values. const ( DialogButtonConfirmIdpLoginContinue DialogButton = "ConfirmIdpLoginContinue" + DialogButtonErrorGotIt DialogButton = "ErrorGotIt" + DialogButtonErrorMoreDetails DialogButton = "ErrorMoreDetails" ) // MarshalEasyJSON satisfies easyjson.Marshaler. @@ -135,6 +140,10 @@ func (t *DialogButton) UnmarshalEasyJSON(in *jlexer.Lexer) { switch DialogButton(v) { case DialogButtonConfirmIdpLoginContinue: *t = DialogButtonConfirmIdpLoginContinue + case DialogButtonErrorGotIt: + *t = DialogButtonErrorGotIt + case DialogButtonErrorMoreDetails: + *t = DialogButtonErrorMoreDetails default: in.AddError(fmt.Errorf("unknown DialogButton value: %v", v)) diff --git a/page/types.go b/page/types.go index aee7d9c..cdb194e 100644 --- a/page/types.go +++ b/page/types.go @@ -110,6 +110,7 @@ const ( PermissionsPolicyFeatureSyncXhr PermissionsPolicyFeature = "sync-xhr" PermissionsPolicyFeatureUnload PermissionsPolicyFeature = "unload" PermissionsPolicyFeatureUsb PermissionsPolicyFeature = "usb" + PermissionsPolicyFeatureUsbUnrestricted PermissionsPolicyFeature = "usb-unrestricted" PermissionsPolicyFeatureVerticalScroll PermissionsPolicyFeature = "vertical-scroll" PermissionsPolicyFeatureWebPrinting PermissionsPolicyFeature = "web-printing" PermissionsPolicyFeatureWebShare PermissionsPolicyFeature = "web-share" @@ -280,6 +281,8 @@ func (t *PermissionsPolicyFeature) UnmarshalEasyJSON(in *jlexer.Lexer) { *t = PermissionsPolicyFeatureUnload case PermissionsPolicyFeatureUsb: *t = PermissionsPolicyFeatureUsb + case PermissionsPolicyFeatureUsbUnrestricted: + *t = PermissionsPolicyFeatureUsbUnrestricted case PermissionsPolicyFeatureVerticalScroll: *t = PermissionsPolicyFeatureVerticalScroll case PermissionsPolicyFeatureWebPrinting: diff --git a/webauthn/easyjson.go b/webauthn/easyjson.go index 1526e27..1b1c2a3 100644 --- a/webauthn/easyjson.go +++ b/webauthn/easyjson.go @@ -58,6 +58,10 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoWebauthn(in *jlexer.Lexer, ou out.AutomaticPresenceSimulation = bool(in.Bool()) case "isUserVerified": out.IsUserVerified = bool(in.Bool()) + case "defaultBackupEligibility": + out.DefaultBackupEligibility = bool(in.Bool()) + case "defaultBackupState": + out.DefaultBackupState = bool(in.Bool()) default: in.SkipRecursive() } @@ -127,6 +131,16 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoWebauthn(out *jwriter.Writer, out.RawString(prefix) out.Bool(bool(in.IsUserVerified)) } + if in.DefaultBackupEligibility { + const prefix string = ",\"defaultBackupEligibility\":" + out.RawString(prefix) + out.Bool(bool(in.DefaultBackupEligibility)) + } + if in.DefaultBackupState { + const prefix string = ",\"defaultBackupState\":" + out.RawString(prefix) + out.Bool(bool(in.DefaultBackupState)) + } out.RawByte('}') } diff --git a/webauthn/types.go b/webauthn/types.go index 0a882d6..1c15287 100644 --- a/webauthn/types.go +++ b/webauthn/types.go @@ -179,6 +179,8 @@ type VirtualAuthenticatorOptions struct { HasPrf bool `json:"hasPrf,omitempty"` // If set to true, the authenticator will support the prf extension. https://w3c.github.io/webauthn/#prf-extension Defaults to false. AutomaticPresenceSimulation bool `json:"automaticPresenceSimulation,omitempty"` // If set to true, tests of user presence will succeed immediately. Otherwise, they will not be resolved. Defaults to true. IsUserVerified bool `json:"isUserVerified,omitempty"` // Sets whether User Verification succeeds or fails for an authenticator. Defaults to false. + DefaultBackupEligibility bool `json:"defaultBackupEligibility,omitempty"` // Credentials created by this authenticator will have the backup eligibility (BE) flag set to this value. Defaults to false. https://w3c.github.io/webauthn/#sctn-credential-backup + DefaultBackupState bool `json:"defaultBackupState,omitempty"` // Credentials created by this authenticator will have the backup state (BS) flag set to this value. Defaults to false. https://w3c.github.io/webauthn/#sctn-credential-backup } // Credential [no description].