2017-01-24 15:09:23 +00:00
|
|
|
// Package storage provides the Chrome Debugging Protocol
|
|
|
|
// commands, types, and events for the Chrome Storage domain.
|
|
|
|
//
|
|
|
|
// Generated by the chromedp-gen command.
|
|
|
|
package storage
|
|
|
|
|
|
|
|
// AUTOGENERATED. DO NOT EDIT.
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
cdp "github.com/knq/chromedp/cdp"
|
2017-01-24 15:09:23 +00:00
|
|
|
"github.com/mailru/easyjson"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ClearDataForOriginParams clears storage for origin.
|
|
|
|
type ClearDataForOriginParams struct {
|
|
|
|
Origin string `json:"origin"` // Security origin.
|
|
|
|
StorageTypes string `json:"storageTypes"` // Comma separated origin names.
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearDataForOrigin clears storage for origin.
|
|
|
|
//
|
|
|
|
// parameters:
|
|
|
|
// origin - Security origin.
|
|
|
|
// storageTypes - Comma separated origin names.
|
|
|
|
func ClearDataForOrigin(origin string, storageTypes string) *ClearDataForOriginParams {
|
|
|
|
return &ClearDataForOriginParams{
|
|
|
|
Origin: origin,
|
|
|
|
StorageTypes: storageTypes,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do executes Storage.clearDataForOrigin.
|
2017-01-26 07:28:34 +00:00
|
|
|
func (p *ClearDataForOriginParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
|
2017-01-24 15:09:23 +00:00
|
|
|
if ctxt == nil {
|
|
|
|
ctxt = context.Background()
|
|
|
|
}
|
|
|
|
|
|
|
|
// marshal
|
|
|
|
buf, err := easyjson.Marshal(p)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// execute
|
2017-01-26 07:28:34 +00:00
|
|
|
ch := h.Execute(ctxt, cdp.CommandStorageClearDataForOrigin, easyjson.RawMessage(buf))
|
2017-01-24 15:09:23 +00:00
|
|
|
|
|
|
|
// read response
|
|
|
|
select {
|
|
|
|
case res := <-ch:
|
|
|
|
if res == nil {
|
2017-01-26 07:28:34 +00:00
|
|
|
return cdp.ErrChannelClosed
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch v := res.(type) {
|
|
|
|
case easyjson.RawMessage:
|
|
|
|
return nil
|
|
|
|
|
|
|
|
case error:
|
|
|
|
return v
|
|
|
|
}
|
|
|
|
|
|
|
|
case <-ctxt.Done():
|
2017-01-26 07:28:34 +00:00
|
|
|
return cdp.ErrContextDone
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
return cdp.ErrUnknownResult
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|