diff --git a/audits/types.go b/audits/types.go index 28335f9..05c3a13 100644 --- a/audits/types.go +++ b/audits/types.go @@ -829,6 +829,7 @@ const ( AttributionReportingIssueTypeInvalidRegisterOsSourceHeader AttributionReportingIssueType = "InvalidRegisterOsSourceHeader" AttributionReportingIssueTypeInvalidRegisterOsTriggerHeader AttributionReportingIssueType = "InvalidRegisterOsTriggerHeader" AttributionReportingIssueTypeWebAndOsHeaders AttributionReportingIssueType = "WebAndOsHeaders" + AttributionReportingIssueTypeNoWebOrOsSupport AttributionReportingIssueType = "NoWebOrOsSupport" ) // MarshalEasyJSON satisfies easyjson.Marshaler. @@ -873,6 +874,8 @@ func (t *AttributionReportingIssueType) UnmarshalEasyJSON(in *jlexer.Lexer) { *t = AttributionReportingIssueTypeInvalidRegisterOsTriggerHeader case AttributionReportingIssueTypeWebAndOsHeaders: *t = AttributionReportingIssueTypeWebAndOsHeaders + case AttributionReportingIssueTypeNoWebOrOsSupport: + *t = AttributionReportingIssueTypeNoWebOrOsSupport default: in.AddError(fmt.Errorf("unknown AttributionReportingIssueType value: %v", v)) diff --git a/cdproto.go b/cdproto.go index 47b0d01..aeb5ffd 100644 --- a/cdproto.go +++ b/cdproto.go @@ -603,6 +603,7 @@ const ( EventPreloadRuleSetUpdated = "Preload.ruleSetUpdated" EventPreloadRuleSetRemoved = "Preload.ruleSetRemoved" EventPreloadPrerenderAttemptCompleted = "Preload.prerenderAttemptCompleted" + EventPreloadPreloadEnabledStateUpdated = "Preload.preloadEnabledStateUpdated" EventPreloadPrefetchStatusUpdated = "Preload.prefetchStatusUpdated" EventPreloadPrerenderStatusUpdated = "Preload.prerenderStatusUpdated" EventPreloadPreloadingAttemptSourcesUpdated = "Preload.preloadingAttemptSourcesUpdated" @@ -697,6 +698,7 @@ const ( CommandStorageSetSharedStorageTracking = storage.CommandSetSharedStorageTracking CommandStorageSetStorageBucketTracking = storage.CommandSetStorageBucketTracking CommandStorageDeleteStorageBucket = storage.CommandDeleteStorageBucket + CommandStorageRunBounceTrackingMitigations = storage.CommandRunBounceTrackingMitigations EventStorageCacheStorageContentUpdated = "Storage.cacheStorageContentUpdated" EventStorageCacheStorageListUpdated = "Storage.cacheStorageListUpdated" EventStorageIndexedDBContentUpdated = "Storage.indexedDBContentUpdated" @@ -2376,6 +2378,9 @@ func UnmarshalMessage(msg *Message) (interface{}, error) { case EventPreloadPrerenderAttemptCompleted: v = new(preload.EventPrerenderAttemptCompleted) + case EventPreloadPreloadEnabledStateUpdated: + v = new(preload.EventPreloadEnabledStateUpdated) + case EventPreloadPrefetchStatusUpdated: v = new(preload.EventPrefetchStatusUpdated) @@ -2658,6 +2663,9 @@ func UnmarshalMessage(msg *Message) (interface{}, error) { case CommandStorageDeleteStorageBucket: return emptyVal, nil + case CommandStorageRunBounceTrackingMitigations: + v = new(storage.RunBounceTrackingMitigationsReturns) + case EventStorageCacheStorageContentUpdated: v = new(storage.EventCacheStorageContentUpdated) diff --git a/indexeddb/easyjson.go b/indexeddb/easyjson.go index 5c2a68c..08ec00a 100644 --- a/indexeddb/easyjson.go +++ b/indexeddb/easyjson.go @@ -5,6 +5,7 @@ package indexeddb import ( json "encoding/json" runtime "github.com/chromedp/cdproto/runtime" + storage "github.com/chromedp/cdproto/storage" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -116,6 +117,16 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb1(in *jlexer.Lexer, out.SecurityOrigin = string(in.String()) case "storageKey": out.StorageKey = string(in.String()) + case "storageBucket": + if in.IsNull() { + in.Skip() + out.StorageBucket = nil + } else { + if out.StorageBucket == nil { + out.StorageBucket = new(storage.Bucket) + } + (*out.StorageBucket).UnmarshalEasyJSON(in) + } case "databaseName": out.DatabaseName = string(in.String()) default: @@ -148,6 +159,16 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb1(out *jwriter.Write } out.String(string(in.StorageKey)) } + if in.StorageBucket != nil { + const prefix string = ",\"storageBucket\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + (*in.StorageBucket).MarshalEasyJSON(out) + } { const prefix string = ",\"databaseName\":" if first { @@ -304,6 +325,16 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb3(in *jlexer.Lexer, out.SecurityOrigin = string(in.String()) case "storageKey": out.StorageKey = string(in.String()) + case "storageBucket": + if in.IsNull() { + in.Skip() + out.StorageBucket = nil + } else { + if out.StorageBucket == nil { + out.StorageBucket = new(storage.Bucket) + } + (*out.StorageBucket).UnmarshalEasyJSON(in) + } default: in.SkipRecursive() } @@ -334,6 +365,16 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb3(out *jwriter.Write } out.String(string(in.StorageKey)) } + if in.StorageBucket != nil { + const prefix string = ",\"storageBucket\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + (*in.StorageBucket).MarshalEasyJSON(out) + } out.RawByte('}') } @@ -504,6 +545,16 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb5(in *jlexer.Lexer, out.SecurityOrigin = string(in.String()) case "storageKey": out.StorageKey = string(in.String()) + case "storageBucket": + if in.IsNull() { + in.Skip() + out.StorageBucket = nil + } else { + if out.StorageBucket == nil { + out.StorageBucket = new(storage.Bucket) + } + (*out.StorageBucket).UnmarshalEasyJSON(in) + } case "databaseName": out.DatabaseName = string(in.String()) case "objectStoreName": @@ -554,6 +605,16 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb5(out *jwriter.Write } out.String(string(in.StorageKey)) } + if in.StorageBucket != nil { + const prefix string = ",\"storageBucket\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + (*in.StorageBucket).MarshalEasyJSON(out) + } { const prefix string = ",\"databaseName\":" if first { @@ -1319,6 +1380,16 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb12(in *jlexer.Lexer, out.SecurityOrigin = string(in.String()) case "storageKey": out.StorageKey = string(in.String()) + case "storageBucket": + if in.IsNull() { + in.Skip() + out.StorageBucket = nil + } else { + if out.StorageBucket == nil { + out.StorageBucket = new(storage.Bucket) + } + (*out.StorageBucket).UnmarshalEasyJSON(in) + } case "databaseName": out.DatabaseName = string(in.String()) case "objectStoreName": @@ -1353,6 +1424,16 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb12(out *jwriter.Writ } out.String(string(in.StorageKey)) } + if in.StorageBucket != nil { + const prefix string = ",\"storageBucket\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + (*in.StorageBucket).MarshalEasyJSON(out) + } { const prefix string = ",\"databaseName\":" if first { @@ -1535,6 +1616,16 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb15(in *jlexer.Lexer, out.SecurityOrigin = string(in.String()) case "storageKey": out.StorageKey = string(in.String()) + case "storageBucket": + if in.IsNull() { + in.Skip() + out.StorageBucket = nil + } else { + if out.StorageBucket == nil { + out.StorageBucket = new(storage.Bucket) + } + (*out.StorageBucket).UnmarshalEasyJSON(in) + } case "databaseName": out.DatabaseName = string(in.String()) case "objectStoreName": @@ -1579,6 +1670,16 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb15(out *jwriter.Writ } out.String(string(in.StorageKey)) } + if in.StorageBucket != nil { + const prefix string = ",\"storageBucket\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + (*in.StorageBucket).MarshalEasyJSON(out) + } { const prefix string = ",\"databaseName\":" if first { @@ -1652,6 +1753,16 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb16(in *jlexer.Lexer, out.SecurityOrigin = string(in.String()) case "storageKey": out.StorageKey = string(in.String()) + case "storageBucket": + if in.IsNull() { + in.Skip() + out.StorageBucket = nil + } else { + if out.StorageBucket == nil { + out.StorageBucket = new(storage.Bucket) + } + (*out.StorageBucket).UnmarshalEasyJSON(in) + } case "databaseName": out.DatabaseName = string(in.String()) default: @@ -1684,6 +1795,16 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb16(out *jwriter.Writ } out.String(string(in.StorageKey)) } + if in.StorageBucket != nil { + const prefix string = ",\"storageBucket\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + (*in.StorageBucket).MarshalEasyJSON(out) + } { const prefix string = ",\"databaseName\":" if first { @@ -1983,6 +2104,16 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb19(in *jlexer.Lexer, out.SecurityOrigin = string(in.String()) case "storageKey": out.StorageKey = string(in.String()) + case "storageBucket": + if in.IsNull() { + in.Skip() + out.StorageBucket = nil + } else { + if out.StorageBucket == nil { + out.StorageBucket = new(storage.Bucket) + } + (*out.StorageBucket).UnmarshalEasyJSON(in) + } case "databaseName": out.DatabaseName = string(in.String()) case "objectStoreName": @@ -2017,6 +2148,16 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb19(out *jwriter.Writ } out.String(string(in.StorageKey)) } + if in.StorageBucket != nil { + const prefix string = ",\"storageBucket\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + (*in.StorageBucket).MarshalEasyJSON(out) + } { const prefix string = ",\"databaseName\":" if first { diff --git a/indexeddb/indexeddb.go b/indexeddb/indexeddb.go index de70f76..0de909f 100644 --- a/indexeddb/indexeddb.go +++ b/indexeddb/indexeddb.go @@ -10,14 +10,16 @@ import ( "context" "github.com/chromedp/cdproto/cdp" + "github.com/chromedp/cdproto/storage" ) // ClearObjectStoreParams clears all entries from an object store. type ClearObjectStoreParams struct { - SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin. - StorageKey string `json:"storageKey,omitempty"` // Storage key. - DatabaseName string `json:"databaseName"` // Database name. - ObjectStoreName string `json:"objectStoreName"` // Object store name. + SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. + StorageKey string `json:"storageKey,omitempty"` // Storage key. + StorageBucket *storage.Bucket `json:"storageBucket,omitempty"` // Storage bucket. If not specified, it uses the default bucket. + DatabaseName string `json:"databaseName"` // Database name. + ObjectStoreName string `json:"objectStoreName"` // Object store name. } // ClearObjectStore clears all entries from an object store. @@ -35,8 +37,8 @@ func ClearObjectStore(databaseName string, objectStoreName string) *ClearObjectS } } -// WithSecurityOrigin at least and at most one of securityOrigin, storageKey -// must be specified. Security origin. +// WithSecurityOrigin at least and at most one of securityOrigin, storageKey, +// or storageBucket must be specified. Security origin. func (p ClearObjectStoreParams) WithSecurityOrigin(securityOrigin string) *ClearObjectStoreParams { p.SecurityOrigin = securityOrigin return &p @@ -48,6 +50,13 @@ func (p ClearObjectStoreParams) WithStorageKey(storageKey string) *ClearObjectSt return &p } +// WithStorageBucket storage bucket. If not specified, it uses the default +// bucket. +func (p ClearObjectStoreParams) WithStorageBucket(storageBucket *storage.Bucket) *ClearObjectStoreParams { + p.StorageBucket = storageBucket + return &p +} + // Do executes IndexedDB.clearObjectStore against the provided context. func (p *ClearObjectStoreParams) Do(ctx context.Context) (err error) { return cdp.Execute(ctx, CommandClearObjectStore, p, nil) @@ -55,9 +64,10 @@ func (p *ClearObjectStoreParams) Do(ctx context.Context) (err error) { // DeleteDatabaseParams deletes a database. type DeleteDatabaseParams struct { - SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin. - StorageKey string `json:"storageKey,omitempty"` // Storage key. - DatabaseName string `json:"databaseName"` // Database name. + SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. + StorageKey string `json:"storageKey,omitempty"` // Storage key. + StorageBucket *storage.Bucket `json:"storageBucket,omitempty"` // Storage bucket. If not specified, it uses the default bucket. + DatabaseName string `json:"databaseName"` // Database name. } // DeleteDatabase deletes a database. @@ -73,8 +83,8 @@ func DeleteDatabase(databaseName string) *DeleteDatabaseParams { } } -// WithSecurityOrigin at least and at most one of securityOrigin, storageKey -// must be specified. Security origin. +// WithSecurityOrigin at least and at most one of securityOrigin, storageKey, +// or storageBucket must be specified. Security origin. func (p DeleteDatabaseParams) WithSecurityOrigin(securityOrigin string) *DeleteDatabaseParams { p.SecurityOrigin = securityOrigin return &p @@ -86,6 +96,13 @@ func (p DeleteDatabaseParams) WithStorageKey(storageKey string) *DeleteDatabaseP return &p } +// WithStorageBucket storage bucket. If not specified, it uses the default +// bucket. +func (p DeleteDatabaseParams) WithStorageBucket(storageBucket *storage.Bucket) *DeleteDatabaseParams { + p.StorageBucket = storageBucket + return &p +} + // Do executes IndexedDB.deleteDatabase against the provided context. func (p *DeleteDatabaseParams) Do(ctx context.Context) (err error) { return cdp.Execute(ctx, CommandDeleteDatabase, p, nil) @@ -94,11 +111,12 @@ func (p *DeleteDatabaseParams) Do(ctx context.Context) (err error) { // DeleteObjectStoreEntriesParams delete a range of entries from an object // store. type DeleteObjectStoreEntriesParams struct { - SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin. - StorageKey string `json:"storageKey,omitempty"` // Storage key. - DatabaseName string `json:"databaseName"` - ObjectStoreName string `json:"objectStoreName"` - KeyRange *KeyRange `json:"keyRange"` // Range of entry keys to delete + SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. + StorageKey string `json:"storageKey,omitempty"` // Storage key. + StorageBucket *storage.Bucket `json:"storageBucket,omitempty"` // Storage bucket. If not specified, it uses the default bucket. + DatabaseName string `json:"databaseName"` + ObjectStoreName string `json:"objectStoreName"` + KeyRange *KeyRange `json:"keyRange"` // Range of entry keys to delete } // DeleteObjectStoreEntries delete a range of entries from an object store. @@ -118,8 +136,8 @@ func DeleteObjectStoreEntries(databaseName string, objectStoreName string, keyRa } } -// WithSecurityOrigin at least and at most one of securityOrigin, storageKey -// must be specified. Security origin. +// WithSecurityOrigin at least and at most one of securityOrigin, storageKey, +// or storageBucket must be specified. Security origin. func (p DeleteObjectStoreEntriesParams) WithSecurityOrigin(securityOrigin string) *DeleteObjectStoreEntriesParams { p.SecurityOrigin = securityOrigin return &p @@ -131,6 +149,13 @@ func (p DeleteObjectStoreEntriesParams) WithStorageKey(storageKey string) *Delet return &p } +// WithStorageBucket storage bucket. If not specified, it uses the default +// bucket. +func (p DeleteObjectStoreEntriesParams) WithStorageBucket(storageBucket *storage.Bucket) *DeleteObjectStoreEntriesParams { + p.StorageBucket = storageBucket + return &p +} + // Do executes IndexedDB.deleteObjectStoreEntries against the provided context. func (p *DeleteObjectStoreEntriesParams) Do(ctx context.Context) (err error) { return cdp.Execute(ctx, CommandDeleteObjectStoreEntries, p, nil) @@ -168,14 +193,15 @@ func (p *EnableParams) Do(ctx context.Context) (err error) { // RequestDataParams requests data from object store or index. type RequestDataParams struct { - SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin. - StorageKey string `json:"storageKey,omitempty"` // Storage key. - DatabaseName string `json:"databaseName"` // Database name. - ObjectStoreName string `json:"objectStoreName"` // Object store name. - IndexName string `json:"indexName"` // Index name, empty string for object store data requests. - SkipCount int64 `json:"skipCount"` // Number of records to skip. - PageSize int64 `json:"pageSize"` // Number of records to fetch. - KeyRange *KeyRange `json:"keyRange,omitempty"` // Key range. + SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. + StorageKey string `json:"storageKey,omitempty"` // Storage key. + StorageBucket *storage.Bucket `json:"storageBucket,omitempty"` // Storage bucket. If not specified, it uses the default bucket. + DatabaseName string `json:"databaseName"` // Database name. + ObjectStoreName string `json:"objectStoreName"` // Object store name. + IndexName string `json:"indexName"` // Index name, empty string for object store data requests. + SkipCount int64 `json:"skipCount"` // Number of records to skip. + PageSize int64 `json:"pageSize"` // Number of records to fetch. + KeyRange *KeyRange `json:"keyRange,omitempty"` // Key range. } // RequestData requests data from object store or index. @@ -199,8 +225,8 @@ func RequestData(databaseName string, objectStoreName string, indexName string, } } -// WithSecurityOrigin at least and at most one of securityOrigin, storageKey -// must be specified. Security origin. +// WithSecurityOrigin at least and at most one of securityOrigin, storageKey, +// or storageBucket must be specified. Security origin. func (p RequestDataParams) WithSecurityOrigin(securityOrigin string) *RequestDataParams { p.SecurityOrigin = securityOrigin return &p @@ -212,6 +238,13 @@ func (p RequestDataParams) WithStorageKey(storageKey string) *RequestDataParams return &p } +// WithStorageBucket storage bucket. If not specified, it uses the default +// bucket. +func (p RequestDataParams) WithStorageBucket(storageBucket *storage.Bucket) *RequestDataParams { + p.StorageBucket = storageBucket + return &p +} + // WithKeyRange key range. func (p RequestDataParams) WithKeyRange(keyRange *KeyRange) *RequestDataParams { p.KeyRange = keyRange @@ -243,10 +276,11 @@ func (p *RequestDataParams) Do(ctx context.Context) (objectStoreDataEntries []*D // GetMetadataParams gets metadata of an object store. type GetMetadataParams struct { - SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin. - StorageKey string `json:"storageKey,omitempty"` // Storage key. - DatabaseName string `json:"databaseName"` // Database name. - ObjectStoreName string `json:"objectStoreName"` // Object store name. + SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. + StorageKey string `json:"storageKey,omitempty"` // Storage key. + StorageBucket *storage.Bucket `json:"storageBucket,omitempty"` // Storage bucket. If not specified, it uses the default bucket. + DatabaseName string `json:"databaseName"` // Database name. + ObjectStoreName string `json:"objectStoreName"` // Object store name. } // GetMetadata gets metadata of an object store. @@ -264,8 +298,8 @@ func GetMetadata(databaseName string, objectStoreName string) *GetMetadataParams } } -// WithSecurityOrigin at least and at most one of securityOrigin, storageKey -// must be specified. Security origin. +// WithSecurityOrigin at least and at most one of securityOrigin, storageKey, +// or storageBucket must be specified. Security origin. func (p GetMetadataParams) WithSecurityOrigin(securityOrigin string) *GetMetadataParams { p.SecurityOrigin = securityOrigin return &p @@ -277,6 +311,13 @@ func (p GetMetadataParams) WithStorageKey(storageKey string) *GetMetadataParams return &p } +// WithStorageBucket storage bucket. If not specified, it uses the default +// bucket. +func (p GetMetadataParams) WithStorageBucket(storageBucket *storage.Bucket) *GetMetadataParams { + p.StorageBucket = storageBucket + return &p +} + // GetMetadataReturns return values. type GetMetadataReturns struct { EntriesCount float64 `json:"entriesCount,omitempty"` // the entries count @@ -302,9 +343,10 @@ func (p *GetMetadataParams) Do(ctx context.Context) (entriesCount float64, keyGe // RequestDatabaseParams requests database with given name in given frame. type RequestDatabaseParams struct { - SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin. - StorageKey string `json:"storageKey,omitempty"` // Storage key. - DatabaseName string `json:"databaseName"` // Database name. + SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. + StorageKey string `json:"storageKey,omitempty"` // Storage key. + StorageBucket *storage.Bucket `json:"storageBucket,omitempty"` // Storage bucket. If not specified, it uses the default bucket. + DatabaseName string `json:"databaseName"` // Database name. } // RequestDatabase requests database with given name in given frame. @@ -320,8 +362,8 @@ func RequestDatabase(databaseName string) *RequestDatabaseParams { } } -// WithSecurityOrigin at least and at most one of securityOrigin, storageKey -// must be specified. Security origin. +// WithSecurityOrigin at least and at most one of securityOrigin, storageKey, +// or storageBucket must be specified. Security origin. func (p RequestDatabaseParams) WithSecurityOrigin(securityOrigin string) *RequestDatabaseParams { p.SecurityOrigin = securityOrigin return &p @@ -333,6 +375,13 @@ func (p RequestDatabaseParams) WithStorageKey(storageKey string) *RequestDatabas return &p } +// WithStorageBucket storage bucket. If not specified, it uses the default +// bucket. +func (p RequestDatabaseParams) WithStorageBucket(storageBucket *storage.Bucket) *RequestDatabaseParams { + p.StorageBucket = storageBucket + return &p +} + // RequestDatabaseReturns return values. type RequestDatabaseReturns struct { DatabaseWithObjectStores *DatabaseWithObjectStores `json:"databaseWithObjectStores,omitempty"` // Database with an array of object stores. @@ -357,8 +406,9 @@ func (p *RequestDatabaseParams) Do(ctx context.Context) (databaseWithObjectStore // RequestDatabaseNamesParams requests database names for given security // origin. type RequestDatabaseNamesParams struct { - SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin. - StorageKey string `json:"storageKey,omitempty"` // Storage key. + SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. + StorageKey string `json:"storageKey,omitempty"` // Storage key. + StorageBucket *storage.Bucket `json:"storageBucket,omitempty"` // Storage bucket. If not specified, it uses the default bucket. } // RequestDatabaseNames requests database names for given security origin. @@ -370,8 +420,8 @@ func RequestDatabaseNames() *RequestDatabaseNamesParams { return &RequestDatabaseNamesParams{} } -// WithSecurityOrigin at least and at most one of securityOrigin, storageKey -// must be specified. Security origin. +// WithSecurityOrigin at least and at most one of securityOrigin, storageKey, +// or storageBucket must be specified. Security origin. func (p RequestDatabaseNamesParams) WithSecurityOrigin(securityOrigin string) *RequestDatabaseNamesParams { p.SecurityOrigin = securityOrigin return &p @@ -383,6 +433,13 @@ func (p RequestDatabaseNamesParams) WithStorageKey(storageKey string) *RequestDa return &p } +// WithStorageBucket storage bucket. If not specified, it uses the default +// bucket. +func (p RequestDatabaseNamesParams) WithStorageBucket(storageBucket *storage.Bucket) *RequestDatabaseNamesParams { + p.StorageBucket = storageBucket + return &p +} + // RequestDatabaseNamesReturns return values. type RequestDatabaseNamesReturns struct { DatabaseNames []string `json:"databaseNames,omitempty"` // Database names for origin. diff --git a/layertree/easyjson.go b/layertree/easyjson.go index ce40844..0d1b54a 100644 --- a/layertree/easyjson.go +++ b/layertree/easyjson.go @@ -1793,6 +1793,29 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree19(in *jlexer.Lexer, continue } switch key { + case "compositingReasons": + if in.IsNull() { + in.Skip() + out.CompositingReasons = nil + } else { + in.Delim('[') + if out.CompositingReasons == nil { + if !in.IsDelim(']') { + out.CompositingReasons = make([]string, 0, 4) + } else { + out.CompositingReasons = []string{} + } + } else { + out.CompositingReasons = (out.CompositingReasons)[:0] + } + for !in.IsDelim(']') { + var v22 string + v22 = string(in.String()) + out.CompositingReasons = append(out.CompositingReasons, v22) + in.WantComma() + } + in.Delim(']') + } case "compositingReasonIds": if in.IsNull() { in.Skip() @@ -1809,9 +1832,9 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree19(in *jlexer.Lexer, out.CompositingReasonIDs = (out.CompositingReasonIDs)[:0] } for !in.IsDelim(']') { - var v22 string - v22 = string(in.String()) - out.CompositingReasonIDs = append(out.CompositingReasonIDs, v22) + var v23 string + v23 = string(in.String()) + out.CompositingReasonIDs = append(out.CompositingReasonIDs, v23) in.WantComma() } in.Delim(']') @@ -1830,17 +1853,36 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree19(out *jwriter.Writ out.RawByte('{') first := true _ = first - if len(in.CompositingReasonIDs) != 0 { - const prefix string = ",\"compositingReasonIds\":" + if len(in.CompositingReasons) != 0 { + const prefix string = ",\"compositingReasons\":" first = false out.RawString(prefix[1:]) { out.RawByte('[') - for v23, v24 := range in.CompositingReasonIDs { - if v23 > 0 { + for v24, v25 := range in.CompositingReasons { + if v24 > 0 { + out.RawByte(',') + } + out.String(string(v25)) + } + out.RawByte(']') + } + } + if len(in.CompositingReasonIDs) != 0 { + const prefix string = ",\"compositingReasonIds\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v26, v27 := range in.CompositingReasonIDs { + if v26 > 0 { out.RawByte(',') } - out.String(string(v24)) + out.String(string(v27)) } out.RawByte(']') } diff --git a/layertree/layertree.go b/layertree/layertree.go index 22949dc..ce8a58d 100644 --- a/layertree/layertree.go +++ b/layertree/layertree.go @@ -36,6 +36,7 @@ func CompositingReasons(layerID LayerID) *CompositingReasonsParams { // CompositingReasonsReturns return values. type CompositingReasonsReturns struct { + CompositingReasons []string `json:"compositingReasons,omitempty"` // A list of strings specifying reasons for the given layer to become composited. CompositingReasonIDs []string `json:"compositingReasonIds,omitempty"` // A list of strings specifying reason IDs for the given layer to become composited. } @@ -43,16 +44,17 @@ type CompositingReasonsReturns struct { // // returns: // +// compositingReasons - A list of strings specifying reasons for the given layer to become composited. // compositingReasonIDs - A list of strings specifying reason IDs for the given layer to become composited. -func (p *CompositingReasonsParams) Do(ctx context.Context) (compositingReasonIDs []string, err error) { +func (p *CompositingReasonsParams) Do(ctx context.Context) (compositingReasons []string, compositingReasonIDs []string, err error) { // execute var res CompositingReasonsReturns err = cdp.Execute(ctx, CommandCompositingReasons, p, &res) if err != nil { - return nil, err + return nil, nil, err } - return res.CompositingReasonIDs, nil + return res.CompositingReasons, res.CompositingReasonIDs, nil } // DisableParams disables compositing tree inspection. diff --git a/page/types.go b/page/types.go index b1330cc..b28706a 100644 --- a/page/types.go +++ b/page/types.go @@ -96,6 +96,8 @@ const ( PermissionsPolicyFeaturePayment PermissionsPolicyFeature = "payment" PermissionsPolicyFeaturePictureInPicture PermissionsPolicyFeature = "picture-in-picture" PermissionsPolicyFeaturePrivateAggregation PermissionsPolicyFeature = "private-aggregation" + PermissionsPolicyFeaturePrivateStateTokenIssuance PermissionsPolicyFeature = "private-state-token-issuance" + PermissionsPolicyFeaturePrivateStateTokenRedemption PermissionsPolicyFeature = "private-state-token-redemption" PermissionsPolicyFeaturePublickeyCredentialsGet PermissionsPolicyFeature = "publickey-credentials-get" PermissionsPolicyFeatureRunAdAuction PermissionsPolicyFeature = "run-ad-auction" PermissionsPolicyFeatureScreenWakeLock PermissionsPolicyFeature = "screen-wake-lock" @@ -106,7 +108,6 @@ const ( PermissionsPolicyFeatureSmartCard PermissionsPolicyFeature = "smart-card" PermissionsPolicyFeatureStorageAccess PermissionsPolicyFeature = "storage-access" PermissionsPolicyFeatureSyncXhr PermissionsPolicyFeature = "sync-xhr" - PermissionsPolicyFeatureTrustTokenRedemption PermissionsPolicyFeature = "trust-token-redemption" PermissionsPolicyFeatureUnload PermissionsPolicyFeature = "unload" PermissionsPolicyFeatureUsb PermissionsPolicyFeature = "usb" PermissionsPolicyFeatureVerticalScroll PermissionsPolicyFeature = "vertical-scroll" @@ -250,6 +251,10 @@ func (t *PermissionsPolicyFeature) UnmarshalEasyJSON(in *jlexer.Lexer) { *t = PermissionsPolicyFeaturePictureInPicture case PermissionsPolicyFeaturePrivateAggregation: *t = PermissionsPolicyFeaturePrivateAggregation + case PermissionsPolicyFeaturePrivateStateTokenIssuance: + *t = PermissionsPolicyFeaturePrivateStateTokenIssuance + case PermissionsPolicyFeaturePrivateStateTokenRedemption: + *t = PermissionsPolicyFeaturePrivateStateTokenRedemption case PermissionsPolicyFeaturePublickeyCredentialsGet: *t = PermissionsPolicyFeaturePublickeyCredentialsGet case PermissionsPolicyFeatureRunAdAuction: @@ -270,8 +275,6 @@ func (t *PermissionsPolicyFeature) UnmarshalEasyJSON(in *jlexer.Lexer) { *t = PermissionsPolicyFeatureStorageAccess case PermissionsPolicyFeatureSyncXhr: *t = PermissionsPolicyFeatureSyncXhr - case PermissionsPolicyFeatureTrustTokenRedemption: - *t = PermissionsPolicyFeatureTrustTokenRedemption case PermissionsPolicyFeatureUnload: *t = PermissionsPolicyFeatureUnload case PermissionsPolicyFeatureUsb: diff --git a/preload/easyjson.go b/preload/easyjson.go index 5e2d76d..0d7579a 100644 --- a/preload/easyjson.go +++ b/preload/easyjson.go @@ -5,6 +5,7 @@ package preload import ( json "encoding/json" cdp "github.com/chromedp/cdproto/cdp" + network "github.com/chromedp/cdproto/network" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -43,6 +44,12 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload(in *jlexer.Lexer, out out.LoaderID = cdp.LoaderID(in.String()) case "sourceText": out.SourceText = string(in.String()) + case "backendNodeId": + (out.BackendNodeID).UnmarshalEasyJSON(in) + case "url": + out.URL = string(in.String()) + case "requestId": + out.RequestID = network.RequestID(in.String()) case "errorType": (out.ErrorType).UnmarshalEasyJSON(in) default: @@ -74,6 +81,21 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload(out *jwriter.Writer, out.RawString(prefix) out.String(string(in.SourceText)) } + if in.BackendNodeID != 0 { + const prefix string = ",\"backendNodeId\":" + out.RawString(prefix) + out.Int64(int64(in.BackendNodeID)) + } + if in.URL != "" { + const prefix string = ",\"url\":" + out.RawString(prefix) + out.String(string(in.URL)) + } + if in.RequestID != "" { + const prefix string = ",\"requestId\":" + out.RawString(prefix) + out.String(string(in.RequestID)) + } if in.ErrorType != "" { const prefix string = ",\"errorType\":" out.RawString(prefix) @@ -814,7 +836,73 @@ func (v *EventPreloadingAttemptSourcesUpdated) UnmarshalJSON(data []byte) error func (v *EventPreloadingAttemptSourcesUpdated) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload7(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload8(in *jlexer.Lexer, out *EventPrefetchStatusUpdated) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload8(in *jlexer.Lexer, out *EventPreloadEnabledStateUpdated) { + 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 "state": + (out.State).UnmarshalEasyJSON(in) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload8(out *jwriter.Writer, in EventPreloadEnabledStateUpdated) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"state\":" + out.RawString(prefix[1:]) + (in.State).MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v EventPreloadEnabledStateUpdated) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload8(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v EventPreloadEnabledStateUpdated) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload8(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *EventPreloadEnabledStateUpdated) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload8(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *EventPreloadEnabledStateUpdated) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload8(l, v) +} +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload9(in *jlexer.Lexer, out *EventPrefetchStatusUpdated) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -859,7 +947,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload8(in *jlexer.Lexer, ou in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload8(out *jwriter.Writer, in EventPrefetchStatusUpdated) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload9(out *jwriter.Writer, in EventPrefetchStatusUpdated) { out.RawByte('{') first := true _ = first @@ -893,27 +981,27 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload8(out *jwriter.Writer, // MarshalJSON supports json.Marshaler interface func (v EventPrefetchStatusUpdated) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload8(&w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload9(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v EventPrefetchStatusUpdated) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload8(w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload9(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *EventPrefetchStatusUpdated) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload8(&r, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload9(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *EventPrefetchStatusUpdated) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload8(l, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload9(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload9(in *jlexer.Lexer, out *EnableParams) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload10(in *jlexer.Lexer, out *EnableParams) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -942,7 +1030,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload9(in *jlexer.Lexer, ou in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload9(out *jwriter.Writer, in EnableParams) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload10(out *jwriter.Writer, in EnableParams) { out.RawByte('{') first := true _ = first @@ -952,27 +1040,27 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload9(out *jwriter.Writer, // MarshalJSON supports json.Marshaler interface func (v EnableParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload9(&w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload10(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload9(w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload10(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *EnableParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload9(&r, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload10(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload9(l, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload10(l, v) } -func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload10(in *jlexer.Lexer, out *DisableParams) { +func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload11(in *jlexer.Lexer, out *DisableParams) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1001,7 +1089,7 @@ func easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload10(in *jlexer.Lexer, o in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload10(out *jwriter.Writer, in DisableParams) { +func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload11(out *jwriter.Writer, in DisableParams) { out.RawByte('{') first := true _ = first @@ -1011,23 +1099,23 @@ func easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload10(out *jwriter.Writer // MarshalJSON supports json.Marshaler interface func (v DisableParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload10(&w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload11(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload10(w, v) + easyjsonC5a4559bEncodeGithubComChromedpCdprotoPreload11(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *DisableParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload10(&r, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload11(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload10(l, v) + easyjsonC5a4559bDecodeGithubComChromedpCdprotoPreload11(l, v) } diff --git a/preload/events.go b/preload/events.go index 341c18c..d444a33 100644 --- a/preload/events.go +++ b/preload/events.go @@ -33,6 +33,14 @@ type EventPrerenderAttemptCompleted struct { DisallowedAPIMethod string `json:"disallowedApiMethod,omitempty"` // This is used to give users more information about the name of the API call that is incompatible with prerender and has caused the cancellation of the attempt } +// EventPreloadEnabledStateUpdated fired when a preload enabled state is +// updated. +// +// See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#event-preloadEnabledStateUpdated +type EventPreloadEnabledStateUpdated struct { + State EnabledState `json:"state"` +} + // EventPrefetchStatusUpdated fired when a prefetch attempt is updated. // // See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#event-prefetchStatusUpdated diff --git a/preload/types.go b/preload/types.go index d8868fb..2500799 100644 --- a/preload/types.go +++ b/preload/types.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/chromedp/cdproto/cdp" + "github.com/chromedp/cdproto/network" "github.com/mailru/easyjson" "github.com/mailru/easyjson/jlexer" "github.com/mailru/easyjson/jwriter" @@ -25,10 +26,13 @@ func (t RuleSetID) String() string { // // See: https://chromedevtools.github.io/devtools-protocol/tot/Preload#type-RuleSet type RuleSet struct { - ID RuleSetID `json:"id"` - LoaderID cdp.LoaderID `json:"loaderId"` // Identifies a document which the rule set is associated with. - SourceText string `json:"sourceText"` // Source text of JSON representing the rule set. If it comes from