Updating to latest protocol.json (clarifying timestamp behavior)

* Disabled AddOnLoadScript/RemoveOnLoadScript
* Updated chromedp-gen fixups for latest timestamp declarations
* Updated to latest protocol.json definitions
This commit is contained in:
Kenneth Shaw 2017-07-09 08:40:29 +07:00
parent 57826bddb1
commit 1e295eddfb
24 changed files with 1054 additions and 929 deletions

View File

@ -9,6 +9,7 @@ import (
"sync"
"time"
"github.com/knq/sysutil"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
@ -74,8 +75,8 @@ const (
EventPageNavigationRequested MethodType = "Page.navigationRequested"
CommandPageEnable MethodType = "Page.enable"
CommandPageDisable MethodType = "Page.disable"
CommandPageAddScriptToEvaluateOnLoad MethodType = "Page.addScriptToEvaluateOnLoad"
CommandPageRemoveScriptToEvaluateOnLoad MethodType = "Page.removeScriptToEvaluateOnLoad"
CommandPageAddScriptToEvaluateOnNewDocument MethodType = "Page.addScriptToEvaluateOnNewDocument"
CommandPageRemoveScriptToEvaluateOnNewDocument MethodType = "Page.removeScriptToEvaluateOnNewDocument"
CommandPageSetAutoAttachToCreatedPages MethodType = "Page.setAutoAttachToCreatedPages"
CommandPageReload MethodType = "Page.reload"
CommandPageNavigate MethodType = "Page.navigate"
@ -177,7 +178,7 @@ const (
CommandNetworkSetBypassServiceWorker MethodType = "Network.setBypassServiceWorker"
CommandNetworkSetDataSizeLimitsForTest MethodType = "Network.setDataSizeLimitsForTest"
CommandNetworkGetCertificate MethodType = "Network.getCertificate"
CommandNetworkEnableRequestInterception MethodType = "Network.enableRequestInterception"
CommandNetworkSetRequestInterceptionEnabled MethodType = "Network.setRequestInterceptionEnabled"
CommandNetworkContinueInterceptedRequest MethodType = "Network.continueInterceptedRequest"
EventDatabaseAddDatabase MethodType = "Database.addDatabase"
CommandDatabaseEnable MethodType = "Database.enable"
@ -536,10 +537,10 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandPageEnable
case CommandPageDisable:
*t = CommandPageDisable
case CommandPageAddScriptToEvaluateOnLoad:
*t = CommandPageAddScriptToEvaluateOnLoad
case CommandPageRemoveScriptToEvaluateOnLoad:
*t = CommandPageRemoveScriptToEvaluateOnLoad
case CommandPageAddScriptToEvaluateOnNewDocument:
*t = CommandPageAddScriptToEvaluateOnNewDocument
case CommandPageRemoveScriptToEvaluateOnNewDocument:
*t = CommandPageRemoveScriptToEvaluateOnNewDocument
case CommandPageSetAutoAttachToCreatedPages:
*t = CommandPageSetAutoAttachToCreatedPages
case CommandPageReload:
@ -742,8 +743,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandNetworkSetDataSizeLimitsForTest
case CommandNetworkGetCertificate:
*t = CommandNetworkGetCertificate
case CommandNetworkEnableRequestInterception:
*t = CommandNetworkEnableRequestInterception
case CommandNetworkSetRequestInterceptionEnabled:
*t = CommandNetworkSetRequestInterceptionEnabled
case CommandNetworkContinueInterceptedRequest:
*t = CommandNetworkContinueInterceptedRequest
case EventDatabaseAddDatabase:
@ -1501,16 +1502,16 @@ func (t LoaderID) String() string {
return string(t)
}
// Timestamp number of seconds since epoch.
type Timestamp time.Time
// TimeSinceEpoch uTC time in seconds, counted from January 1, 1970.
type TimeSinceEpoch time.Time
// Time returns the Timestamp as time.Time value.
func (t Timestamp) Time() time.Time {
// Time returns the TimeSinceEpoch as time.Time value.
func (t TimeSinceEpoch) Time() time.Time {
return time.Time(t)
}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Timestamp) MarshalEasyJSON(out *jwriter.Writer) {
func (t TimeSinceEpoch) MarshalEasyJSON(out *jwriter.Writer) {
v := float64(time.Time(t).UnixNano() / int64(time.Second))
out.Buffer.EnsureSpace(20)
@ -1518,17 +1519,58 @@ func (t Timestamp) MarshalEasyJSON(out *jwriter.Writer) {
}
// MarshalJSON satisfies json.Marshaler.
func (t Timestamp) MarshalJSON() ([]byte, error) {
func (t TimeSinceEpoch) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Timestamp) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = Timestamp(time.Unix(0, int64(in.Float64()*float64(time.Second))))
func (t *TimeSinceEpoch) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = TimeSinceEpoch(time.Unix(0, int64(in.Float64()*float64(time.Second))))
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Timestamp) UnmarshalJSON(buf []byte) error {
func (t *TimeSinceEpoch) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// MonotonicTime monotonically increasing time in seconds since an arbitrary
// point in the past.
type MonotonicTime time.Time
// Time returns the MonotonicTime as time.Time value.
func (t MonotonicTime) Time() time.Time {
return time.Time(t)
}
// MonotonicTimeEpoch is the MonotonicTime time epoch.
var MonotonicTimeEpoch *time.Time
func init() {
// initialize epoch
bt := sysutil.BootTime()
MonotonicTimeEpoch = &bt
}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t MonotonicTime) MarshalEasyJSON(out *jwriter.Writer) {
v := float64(time.Time(t).Sub(*MonotonicTimeEpoch)) / float64(time.Second)
out.Buffer.EnsureSpace(20)
out.Buffer.Buf = strconv.AppendFloat(out.Buffer.Buf, v, 'f', -1, 64)
}
// MarshalJSON satisfies json.Marshaler.
func (t MonotonicTime) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *MonotonicTime) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = MonotonicTime(MonotonicTimeEpoch.Add(time.Duration(in.Float64() * float64(time.Second))))
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *MonotonicTime) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@ -77,10 +77,10 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandPageDisable:
return emptyVal, nil
case cdp.CommandPageAddScriptToEvaluateOnLoad:
v = new(page.AddScriptToEvaluateOnLoadReturns)
case cdp.CommandPageAddScriptToEvaluateOnNewDocument:
v = new(page.AddScriptToEvaluateOnNewDocumentReturns)
case cdp.CommandPageRemoveScriptToEvaluateOnLoad:
case cdp.CommandPageRemoveScriptToEvaluateOnNewDocument:
return emptyVal, nil
case cdp.CommandPageSetAutoAttachToCreatedPages:
@ -389,7 +389,7 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandNetworkGetCertificate:
v = new(network.GetCertificateReturns)
case cdp.CommandNetworkEnableRequestInterception:
case cdp.CommandNetworkSetRequestInterceptionEnabled:
return emptyVal, nil
case cdp.CommandNetworkContinueInterceptedRequest:

View File

@ -4,7 +4,6 @@ package heapprofiler
import (
json "encoding/json"
cdp "github.com/knq/chromedp/cdp"
runtime "github.com/knq/chromedp/cdp/runtime"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
@ -1113,15 +1112,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeapprofiler14(in *jlexer.Lexe
case "lastSeenObjectId":
out.LastSeenObjectID = int64(in.Int64())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = float64(in.Float64())
default:
in.SkipRecursive()
}
@ -1147,11 +1138,7 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeapprofiler14(out *jwriter.Wr
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
out.RawByte('}')
}

View File

@ -27,8 +27,8 @@ type EventReportHeapSnapshotProgress struct {
// then one or more heapStatsUpdate events will be sent before a new
// lastSeenObjectId event.
type EventLastSeenObjectID struct {
LastSeenObjectID int64 `json:"lastSeenObjectId"`
Timestamp *cdp.Timestamp `json:"timestamp"`
LastSeenObjectID int64 `json:"lastSeenObjectId"`
Timestamp float64 `json:"timestamp"`
}
// EventHeapStatsUpdate if heap objects tracking has been started then

View File

@ -4,7 +4,6 @@ package input
import (
json "encoding/json"
cdp "github.com/knq/chromedp/cdp"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
@ -632,7 +631,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput5(in *jlexer.Lexer, out *
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
out.Timestamp = new(TimeSinceEpoch)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
@ -812,7 +811,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput6(in *jlexer.Lexer, out *
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
out.Timestamp = new(TimeSinceEpoch)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
@ -936,7 +935,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput7(in *jlexer.Lexer, out *
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
out.Timestamp = new(TimeSinceEpoch)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
@ -1067,7 +1066,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput8(in *jlexer.Lexer, out *
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
out.Timestamp = new(TimeSinceEpoch)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}

View File

@ -36,19 +36,19 @@ func (p *SetIgnoreInputEventsParams) Do(ctxt context.Context, h cdp.Handler) (er
// DispatchKeyEventParams dispatches a key event to the page.
type DispatchKeyEventParams struct {
Type KeyType `json:"type"` // Type of the key event.
Modifiers Modifier `json:"modifiers,omitempty"` // Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time).
Text string `json:"text,omitempty"` // Text as generated by processing a virtual key code with a keyboard layout. Not needed for for keyUp and rawKeyDown events (default: "")
UnmodifiedText string `json:"unmodifiedText,omitempty"` // Text that would have been generated by the keyboard if no modifiers were pressed (except for shift). Useful for shortcut (accelerator) key handling (default: "").
KeyIdentifier string `json:"keyIdentifier,omitempty"` // Unique key identifier (e.g., 'U+0041') (default: "").
Code string `json:"code,omitempty"` // Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
Key string `json:"key,omitempty"` // Unique DOM defined string value describing the meaning of the key in the context of active modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
WindowsVirtualKeyCode int64 `json:"windowsVirtualKeyCode,omitempty"` // Windows virtual key code (default: 0).
NativeVirtualKeyCode int64 `json:"nativeVirtualKeyCode,omitempty"` // Native virtual key code (default: 0).
AutoRepeat bool `json:"autoRepeat,omitempty"` // Whether the event was generated from auto repeat (default: false).
IsKeypad bool `json:"isKeypad,omitempty"` // Whether the event was generated from the keypad (default: false).
IsSystemKey bool `json:"isSystemKey,omitempty"` // Whether the event was a system key event (default: false).
Type KeyType `json:"type"` // Type of the key event.
Modifiers Modifier `json:"modifiers,omitempty"` // Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
Timestamp *TimeSinceEpoch `json:"timestamp,omitempty"` // Time at which the event occurred.
Text string `json:"text,omitempty"` // Text as generated by processing a virtual key code with a keyboard layout. Not needed for for keyUp and rawKeyDown events (default: "")
UnmodifiedText string `json:"unmodifiedText,omitempty"` // Text that would have been generated by the keyboard if no modifiers were pressed (except for shift). Useful for shortcut (accelerator) key handling (default: "").
KeyIdentifier string `json:"keyIdentifier,omitempty"` // Unique key identifier (e.g., 'U+0041') (default: "").
Code string `json:"code,omitempty"` // Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
Key string `json:"key,omitempty"` // Unique DOM defined string value describing the meaning of the key in the context of active modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
WindowsVirtualKeyCode int64 `json:"windowsVirtualKeyCode,omitempty"` // Windows virtual key code (default: 0).
NativeVirtualKeyCode int64 `json:"nativeVirtualKeyCode,omitempty"` // Native virtual key code (default: 0).
AutoRepeat bool `json:"autoRepeat,omitempty"` // Whether the event was generated from auto repeat (default: false).
IsKeypad bool `json:"isKeypad,omitempty"` // Whether the event was generated from the keypad (default: false).
IsSystemKey bool `json:"isSystemKey,omitempty"` // Whether the event was a system key event (default: false).
}
// DispatchKeyEvent dispatches a key event to the page.
@ -68,9 +68,8 @@ func (p DispatchKeyEventParams) WithModifiers(modifiers Modifier) *DispatchKeyEv
return &p
}
// WithTimestamp time at which the event occurred. Measured in UTC time in
// seconds since January 1, 1970 (default: current time).
func (p DispatchKeyEventParams) WithTimestamp(timestamp *cdp.Timestamp) *DispatchKeyEventParams {
// WithTimestamp time at which the event occurred.
func (p DispatchKeyEventParams) WithTimestamp(timestamp *TimeSinceEpoch) *DispatchKeyEventParams {
p.Timestamp = timestamp
return &p
}
@ -152,13 +151,13 @@ func (p *DispatchKeyEventParams) Do(ctxt context.Context, h cdp.Handler) (err er
// DispatchMouseEventParams dispatches a mouse event to the page.
type DispatchMouseEventParams struct {
Type MouseType `json:"type"` // Type of the mouse event.
X int64 `json:"x"` // X coordinate of the event relative to the main frame's viewport.
Y int64 `json:"y"` // Y coordinate of the event relative to the main frame's viewport. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
Modifiers Modifier `json:"modifiers,omitempty"` // Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time).
Button ButtonType `json:"button,omitempty"` // Mouse button (default: "none").
ClickCount int64 `json:"clickCount,omitempty"` // Number of times the mouse button was clicked (default: 0).
Type MouseType `json:"type"` // Type of the mouse event.
X int64 `json:"x"` // X coordinate of the event relative to the main frame's viewport.
Y int64 `json:"y"` // Y coordinate of the event relative to the main frame's viewport. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
Modifiers Modifier `json:"modifiers,omitempty"` // Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
Timestamp *TimeSinceEpoch `json:"timestamp,omitempty"` // Time at which the event occurred.
Button ButtonType `json:"button,omitempty"` // Mouse button (default: "none").
ClickCount int64 `json:"clickCount,omitempty"` // Number of times the mouse button was clicked (default: 0).
}
// DispatchMouseEvent dispatches a mouse event to the page.
@ -182,9 +181,8 @@ func (p DispatchMouseEventParams) WithModifiers(modifiers Modifier) *DispatchMou
return &p
}
// WithTimestamp time at which the event occurred. Measured in UTC time in
// seconds since January 1, 1970 (default: current time).
func (p DispatchMouseEventParams) WithTimestamp(timestamp *cdp.Timestamp) *DispatchMouseEventParams {
// WithTimestamp time at which the event occurred.
func (p DispatchMouseEventParams) WithTimestamp(timestamp *TimeSinceEpoch) *DispatchMouseEventParams {
p.Timestamp = timestamp
return &p
}
@ -209,10 +207,10 @@ func (p *DispatchMouseEventParams) Do(ctxt context.Context, h cdp.Handler) (err
// DispatchTouchEventParams dispatches a touch event to the page.
type DispatchTouchEventParams struct {
Type TouchType `json:"type"` // Type of the touch event.
TouchPoints []*TouchPoint `json:"touchPoints"` // Touch points.
Modifiers Modifier `json:"modifiers,omitempty"` // Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time).
Type TouchType `json:"type"` // Type of the touch event.
TouchPoints []*TouchPoint `json:"touchPoints"` // Touch points.
Modifiers Modifier `json:"modifiers,omitempty"` // Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
Timestamp *TimeSinceEpoch `json:"timestamp,omitempty"` // Time at which the event occurred.
}
// DispatchTouchEvent dispatches a touch event to the page.
@ -234,9 +232,8 @@ func (p DispatchTouchEventParams) WithModifiers(modifiers Modifier) *DispatchTou
return &p
}
// WithTimestamp time at which the event occurred. Measured in UTC time in
// seconds since January 1, 1970 (default: current time).
func (p DispatchTouchEventParams) WithTimestamp(timestamp *cdp.Timestamp) *DispatchTouchEventParams {
// WithTimestamp time at which the event occurred.
func (p DispatchTouchEventParams) WithTimestamp(timestamp *TimeSinceEpoch) *DispatchTouchEventParams {
p.Timestamp = timestamp
return &p
}
@ -250,15 +247,15 @@ func (p *DispatchTouchEventParams) Do(ctxt context.Context, h cdp.Handler) (err
// EmulateTouchFromMouseEventParams emulates touch event from the mouse event
// parameters.
type EmulateTouchFromMouseEventParams struct {
Type MouseType `json:"type"` // Type of the mouse event.
X int64 `json:"x"` // X coordinate of the mouse pointer in DIP.
Y int64 `json:"y"` // Y coordinate of the mouse pointer in DIP.
Timestamp *cdp.Timestamp `json:"timestamp"` // Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970.
Button ButtonType `json:"button"` // Mouse button.
DeltaX float64 `json:"deltaX,omitempty"` // X delta in DIP for mouse wheel event (default: 0).
DeltaY float64 `json:"deltaY,omitempty"` // Y delta in DIP for mouse wheel event (default: 0).
Modifiers Modifier `json:"modifiers,omitempty"` // Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
ClickCount int64 `json:"clickCount,omitempty"` // Number of times the mouse button was clicked (default: 0).
Type MouseType `json:"type"` // Type of the mouse event.
X int64 `json:"x"` // X coordinate of the mouse pointer in DIP.
Y int64 `json:"y"` // Y coordinate of the mouse pointer in DIP.
Timestamp *TimeSinceEpoch `json:"timestamp"` // Time at which the event occurred.
Button ButtonType `json:"button"` // Mouse button.
DeltaX float64 `json:"deltaX,omitempty"` // X delta in DIP for mouse wheel event (default: 0).
DeltaY float64 `json:"deltaY,omitempty"` // Y delta in DIP for mouse wheel event (default: 0).
Modifiers Modifier `json:"modifiers,omitempty"` // Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
ClickCount int64 `json:"clickCount,omitempty"` // Number of times the mouse button was clicked (default: 0).
}
// EmulateTouchFromMouseEvent emulates touch event from the mouse event
@ -268,9 +265,9 @@ type EmulateTouchFromMouseEventParams struct {
// type - Type of the mouse event.
// x - X coordinate of the mouse pointer in DIP.
// y - Y coordinate of the mouse pointer in DIP.
// timestamp - Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970.
// timestamp - Time at which the event occurred.
// button - Mouse button.
func EmulateTouchFromMouseEvent(typeVal MouseType, x int64, y int64, timestamp *cdp.Timestamp, button ButtonType) *EmulateTouchFromMouseEventParams {
func EmulateTouchFromMouseEvent(typeVal MouseType, x int64, y int64, timestamp *TimeSinceEpoch, button ButtonType) *EmulateTouchFromMouseEventParams {
return &EmulateTouchFromMouseEventParams{
Type: typeVal,
X: x,

View File

@ -3,6 +3,8 @@ package input
import (
"errors"
"fmt"
"strconv"
"time"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
@ -68,6 +70,37 @@ func (t *GestureType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// TimeSinceEpoch uTC time in seconds, counted from January 1, 1970.
type TimeSinceEpoch time.Time
// Time returns the TimeSinceEpoch as time.Time value.
func (t TimeSinceEpoch) Time() time.Time {
return time.Time(t)
}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t TimeSinceEpoch) MarshalEasyJSON(out *jwriter.Writer) {
v := float64(time.Time(t).UnixNano() / int64(time.Second))
out.Buffer.EnsureSpace(20)
out.Buffer.Buf = strconv.AppendFloat(out.Buffer.Buf, v, 'f', -1, 64)
}
// MarshalJSON satisfies json.Marshaler.
func (t TimeSinceEpoch) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *TimeSinceEpoch) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = TimeSinceEpoch(time.Unix(0, int64(in.Float64()*float64(time.Second))))
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *TimeSinceEpoch) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Modifier input key modifier type.
type Modifier int64

File diff suppressed because it is too large Load Diff

View File

@ -10,23 +10,23 @@ import (
// EventResourceChangedPriority fired when resource loading priority is
// changed.
type EventResourceChangedPriority struct {
RequestID RequestID `json:"requestId"` // Request identifier.
NewPriority ResourcePriority `json:"newPriority"` // New priority
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
RequestID RequestID `json:"requestId"` // Request identifier.
NewPriority ResourcePriority `json:"newPriority"` // New priority
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
}
// EventRequestWillBeSent fired when page is about to send HTTP request.
type EventRequestWillBeSent struct {
RequestID RequestID `json:"requestId"` // Request identifier.
LoaderID cdp.LoaderID `json:"loaderId"` // Loader identifier. Empty string if the request is fetched form worker.
DocumentURL string `json:"documentURL"` // URL of the document this request is loaded for.
Request *Request `json:"request"` // Request data.
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
WallTime *cdp.Timestamp `json:"wallTime"` // UTC Timestamp.
Initiator *Initiator `json:"initiator"` // Request initiator.
RedirectResponse *Response `json:"redirectResponse,omitempty"` // Redirect response data.
Type page.ResourceType `json:"type,omitempty"` // Type of this resource.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier.
RequestID RequestID `json:"requestId"` // Request identifier.
LoaderID cdp.LoaderID `json:"loaderId"` // Loader identifier. Empty string if the request is fetched form worker.
DocumentURL string `json:"documentURL"` // URL of the document this request is loaded for.
Request *Request `json:"request"` // Request data.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
WallTime *cdp.TimeSinceEpoch `json:"wallTime"` // Timestamp.
Initiator *Initiator `json:"initiator"` // Request initiator.
RedirectResponse *Response `json:"redirectResponse,omitempty"` // Redirect response data.
Type page.ResourceType `json:"type,omitempty"` // Type of this resource.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier.
}
// EventRequestServedFromCache fired if request ended up loading from cache.
@ -36,53 +36,53 @@ type EventRequestServedFromCache struct {
// EventResponseReceived fired when HTTP response is available.
type EventResponseReceived struct {
RequestID RequestID `json:"requestId"` // Request identifier.
LoaderID cdp.LoaderID `json:"loaderId"` // Loader identifier. Empty string if the request is fetched form worker.
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
Type page.ResourceType `json:"type"` // Resource type.
Response *Response `json:"response"` // Response data.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier.
RequestID RequestID `json:"requestId"` // Request identifier.
LoaderID cdp.LoaderID `json:"loaderId"` // Loader identifier. Empty string if the request is fetched form worker.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
Type page.ResourceType `json:"type"` // Resource type.
Response *Response `json:"response"` // Response data.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier.
}
// EventDataReceived fired when data chunk was received over the network.
type EventDataReceived struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
DataLength int64 `json:"dataLength"` // Data chunk length.
EncodedDataLength int64 `json:"encodedDataLength"` // Actual bytes received (might be less than dataLength for compressed encodings).
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
DataLength int64 `json:"dataLength"` // Data chunk length.
EncodedDataLength int64 `json:"encodedDataLength"` // Actual bytes received (might be less than dataLength for compressed encodings).
}
// EventLoadingFinished fired when HTTP request has finished loading.
type EventLoadingFinished struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
EncodedDataLength float64 `json:"encodedDataLength"` // Total number of bytes received for this request.
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
EncodedDataLength float64 `json:"encodedDataLength"` // Total number of bytes received for this request.
}
// EventLoadingFailed fired when HTTP request has failed to load.
type EventLoadingFailed struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
Type page.ResourceType `json:"type"` // Resource type.
ErrorText string `json:"errorText"` // User friendly error message.
Canceled bool `json:"canceled,omitempty"` // True if loading was canceled.
BlockedReason BlockedReason `json:"blockedReason,omitempty"` // The reason why loading was blocked, if any.
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
Type page.ResourceType `json:"type"` // Resource type.
ErrorText string `json:"errorText"` // User friendly error message.
Canceled bool `json:"canceled,omitempty"` // True if loading was canceled.
BlockedReason BlockedReason `json:"blockedReason,omitempty"` // The reason why loading was blocked, if any.
}
// EventWebSocketWillSendHandshakeRequest fired when WebSocket is about to
// initiate handshake.
type EventWebSocketWillSendHandshakeRequest struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
WallTime *cdp.Timestamp `json:"wallTime"` // UTC Timestamp.
Request *WebSocketRequest `json:"request"` // WebSocket request data.
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
WallTime *cdp.TimeSinceEpoch `json:"wallTime"` // UTC Timestamp.
Request *WebSocketRequest `json:"request"` // WebSocket request data.
}
// EventWebSocketHandshakeResponseReceived fired when WebSocket handshake
// response becomes available.
type EventWebSocketHandshakeResponseReceived struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
Response *WebSocketResponse `json:"response"` // WebSocket response data.
}
@ -95,39 +95,39 @@ type EventWebSocketCreated struct {
// EventWebSocketClosed fired when WebSocket is closed.
type EventWebSocketClosed struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
}
// EventWebSocketFrameReceived fired when WebSocket frame is received.
type EventWebSocketFrameReceived struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
Response *WebSocketFrame `json:"response"` // WebSocket response data.
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
Response *WebSocketFrame `json:"response"` // WebSocket response data.
}
// EventWebSocketFrameError fired when WebSocket frame error occurs.
type EventWebSocketFrameError struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
ErrorMessage string `json:"errorMessage"` // WebSocket frame error message.
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
ErrorMessage string `json:"errorMessage"` // WebSocket frame error message.
}
// EventWebSocketFrameSent fired when WebSocket frame is sent.
type EventWebSocketFrameSent struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
Response *WebSocketFrame `json:"response"` // WebSocket response data.
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
Response *WebSocketFrame `json:"response"` // WebSocket response data.
}
// EventEventSourceMessageReceived fired when EventSource message is
// received.
type EventEventSourceMessageReceived struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp.
EventName string `json:"eventName"` // Message type.
EventID string `json:"eventId"` // Message identifier.
Data string `json:"data"` // Message content.
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
EventName string `json:"eventName"` // Message type.
EventID string `json:"eventId"` // Message identifier.
Data string `json:"data"` // Message content.
}
// EventRequestIntercepted details of an intercepted HTTP request, which must

View File

@ -399,15 +399,15 @@ func (p *DeleteCookieParams) Do(ctxt context.Context, h cdp.Handler) (err error)
// SetCookieParams sets a cookie with the given cookie data; may overwrite
// equivalent cookies if they exist.
type SetCookieParams struct {
URL string `json:"url"` // The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie.
Name string `json:"name"` // The name of the cookie.
Value string `json:"value"` // The value of the cookie.
Domain string `json:"domain,omitempty"` // If omitted, the cookie becomes a host-only cookie.
Path string `json:"path,omitempty"` // Defaults to the path portion of the url parameter.
Secure bool `json:"secure,omitempty"` // Defaults ot false.
HTTPOnly bool `json:"httpOnly,omitempty"` // Defaults to false.
SameSite CookieSameSite `json:"sameSite,omitempty"` // Defaults to browser default behavior.
ExpirationDate *cdp.Timestamp `json:"expirationDate,omitempty"` // If omitted, the cookie becomes a session cookie.
URL string `json:"url"` // The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie.
Name string `json:"name"` // The name of the cookie.
Value string `json:"value"` // The value of the cookie.
Domain string `json:"domain,omitempty"` // If omitted, the cookie becomes a host-only cookie.
Path string `json:"path,omitempty"` // Defaults to the path portion of the url parameter.
Secure bool `json:"secure,omitempty"` // Defaults ot false.
HTTPOnly bool `json:"httpOnly,omitempty"` // Defaults to false.
SameSite CookieSameSite `json:"sameSite,omitempty"` // Defaults to browser default behavior.
ExpirationDate *cdp.TimeSinceEpoch `json:"expirationDate,omitempty"` // If omitted, the cookie becomes a session cookie.
}
// SetCookie sets a cookie with the given cookie data; may overwrite
@ -456,7 +456,7 @@ func (p SetCookieParams) WithSameSite(sameSite CookieSameSite) *SetCookieParams
}
// WithExpirationDate if omitted, the cookie becomes a session cookie.
func (p SetCookieParams) WithExpirationDate(expirationDate *cdp.Timestamp) *SetCookieParams {
func (p SetCookieParams) WithExpirationDate(expirationDate *cdp.TimeSinceEpoch) *SetCookieParams {
p.ExpirationDate = expirationDate
return &p
}
@ -656,25 +656,25 @@ func (p *GetCertificateParams) Do(ctxt context.Context, h cdp.Handler) (tableNam
return res.TableNames, nil
}
// EnableRequestInterceptionParams [no description].
type EnableRequestInterceptionParams struct {
// SetRequestInterceptionEnabledParams [no description].
type SetRequestInterceptionEnabledParams struct {
Enabled bool `json:"enabled"` // Whether or not HTTP requests should be intercepted and Network.requestIntercepted events sent.
}
// EnableRequestInterception [no description].
// SetRequestInterceptionEnabled [no description].
//
// parameters:
// enabled - Whether or not HTTP requests should be intercepted and Network.requestIntercepted events sent.
func EnableRequestInterception(enabled bool) *EnableRequestInterceptionParams {
return &EnableRequestInterceptionParams{
func SetRequestInterceptionEnabled(enabled bool) *SetRequestInterceptionEnabledParams {
return &SetRequestInterceptionEnabledParams{
Enabled: enabled,
}
}
// Do executes Network.enableRequestInterception against the provided context and
// Do executes Network.setRequestInterceptionEnabled against the provided context and
// target handler.
func (p *EnableRequestInterceptionParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkEnableRequestInterception, p, nil)
func (p *SetRequestInterceptionEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkSetRequestInterceptionEnabled, p, nil)
}
// ContinueInterceptedRequestParams response to Network.requestIntercepted

View File

@ -284,27 +284,27 @@ func (t *ResourcePriority) UnmarshalJSON(buf []byte) error {
// Request hTTP request data.
type Request struct {
URL string `json:"url"` // Request URL.
Method string `json:"method"` // HTTP request method.
Headers Headers `json:"headers"` // HTTP request headers.
PostData string `json:"postData,omitempty"` // HTTP POST request data.
MixedContentType MixedContentType `json:"mixedContentType,omitempty"` // The mixed content status of the request, as defined in http://www.w3.org/TR/mixed-content/
InitialPriority ResourcePriority `json:"initialPriority"` // Priority of the resource request at the time request is sent.
ReferrerPolicy ReferrerPolicy `json:"referrerPolicy"` // The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/
IsLinkPreload bool `json:"isLinkPreload,omitempty"` // Whether is loaded via link preload.
URL string `json:"url"` // Request URL.
Method string `json:"method"` // HTTP request method.
Headers Headers `json:"headers"` // HTTP request headers.
PostData string `json:"postData,omitempty"` // HTTP POST request data.
MixedContentType security.MixedContentType `json:"mixedContentType,omitempty"` // The mixed content type of the request.
InitialPriority ResourcePriority `json:"initialPriority"` // Priority of the resource request at the time request is sent.
ReferrerPolicy ReferrerPolicy `json:"referrerPolicy"` // The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/
IsLinkPreload bool `json:"isLinkPreload,omitempty"` // Whether is loaded via link preload.
}
// SignedCertificateTimestamp details of a signed certificate timestamp
// (SCT).
type SignedCertificateTimestamp struct {
Status string `json:"status"` // Validation status.
Origin string `json:"origin"` // Origin.
LogDescription string `json:"logDescription"` // Log name / description.
LogID string `json:"logId"` // Log ID.
Timestamp *cdp.Timestamp `json:"timestamp"` // Issuance date.
HashAlgorithm string `json:"hashAlgorithm"` // Hash algorithm.
SignatureAlgorithm string `json:"signatureAlgorithm"` // Signature algorithm.
SignatureData string `json:"signatureData"` // Signature data.
Status string `json:"status"` // Validation status.
Origin string `json:"origin"` // Origin.
LogDescription string `json:"logDescription"` // Log name / description.
LogID string `json:"logId"` // Log ID.
Timestamp *cdp.TimeSinceEpoch `json:"timestamp"` // Issuance date.
HashAlgorithm string `json:"hashAlgorithm"` // Hash algorithm.
SignatureAlgorithm string `json:"signatureAlgorithm"` // Signature algorithm.
SignatureData string `json:"signatureData"` // Signature data.
}
// SecurityDetails security details about a request.
@ -318,8 +318,8 @@ type SecurityDetails struct {
SubjectName string `json:"subjectName"` // Certificate subject name.
SanList []string `json:"sanList"` // Subject Alternative Name (SAN) DNS names and IP addresses.
Issuer string `json:"issuer"` // Name of the issuing CA.
ValidFrom *cdp.Timestamp `json:"validFrom"` // Certificate valid from date.
ValidTo *cdp.Timestamp `json:"validTo"` // Certificate valid to (expiration) date
ValidFrom *cdp.TimeSinceEpoch `json:"validFrom"` // Certificate valid from date.
ValidTo *cdp.TimeSinceEpoch `json:"validTo"` // Certificate valid to (expiration) date
SignedCertificateTimestampList []*SignedCertificateTimestamp `json:"signedCertificateTimestampList"` // List of signed certificate timestamps (SCTs).
}
@ -467,52 +467,6 @@ type AuthChallengeResponse struct {
Password string `json:"password,omitempty"` // The password to provide, possibly empty. Should only be set if response is ProvideCredentials.
}
// MixedContentType the mixed content status of the request, as defined in
// http://www.w3.org/TR/mixed-content/.
type MixedContentType string
// String returns the MixedContentType as string value.
func (t MixedContentType) String() string {
return string(t)
}
// MixedContentType values.
const (
MixedContentTypeBlockable MixedContentType = "blockable"
MixedContentTypeOptionallyBlockable MixedContentType = "optionally-blockable"
MixedContentTypeNone MixedContentType = "none"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t MixedContentType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t MixedContentType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *MixedContentType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch MixedContentType(in.String()) {
case MixedContentTypeBlockable:
*t = MixedContentTypeBlockable
case MixedContentTypeOptionallyBlockable:
*t = MixedContentTypeOptionallyBlockable
case MixedContentTypeNone:
*t = MixedContentTypeNone
default:
in.AddError(errors.New("unknown MixedContentType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *MixedContentType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ReferrerPolicy the referrer policy of the request, as defined in
// https://www.w3.org/TR/referrer-policy/.
type ReferrerPolicy string

View File

@ -825,7 +825,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage9(in *jlexer.Lexer, out *S
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(Bootstamp)
out.Timestamp = new(cdp.TimeSinceEpoch)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
@ -1043,7 +1043,7 @@ func (v *RequestAppBannerParams) UnmarshalJSON(data []byte) error {
func (v *RequestAppBannerParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage11(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage12(in *jlexer.Lexer, out *RemoveScriptToEvaluateOnLoadParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage12(in *jlexer.Lexer, out *RemoveScriptToEvaluateOnNewDocumentParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1074,7 +1074,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage12(in *jlexer.Lexer, out *
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage12(out *jwriter.Writer, in RemoveScriptToEvaluateOnLoadParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage12(out *jwriter.Writer, in RemoveScriptToEvaluateOnNewDocumentParams) {
out.RawByte('{')
first := true
_ = first
@ -1088,26 +1088,26 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage12(out *jwriter.Writer, in
}
// MarshalJSON supports json.Marshaler interface
func (v RemoveScriptToEvaluateOnLoadParams) MarshalJSON() ([]byte, error) {
func (v RemoveScriptToEvaluateOnNewDocumentParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage12(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v RemoveScriptToEvaluateOnLoadParams) MarshalEasyJSON(w *jwriter.Writer) {
func (v RemoveScriptToEvaluateOnNewDocumentParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage12(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *RemoveScriptToEvaluateOnLoadParams) UnmarshalJSON(data []byte) error {
func (v *RemoveScriptToEvaluateOnNewDocumentParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage12(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *RemoveScriptToEvaluateOnLoadParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
func (v *RemoveScriptToEvaluateOnNewDocumentParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage12(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage13(in *jlexer.Lexer, out *ReloadParams) {
@ -3060,7 +3060,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage34(in *jlexer.Lexer, out *
out.LastModified = nil
} else {
if out.LastModified == nil {
out.LastModified = new(cdp.Timestamp)
out.LastModified = new(cdp.TimeSinceEpoch)
}
(*out.LastModified).UnmarshalEasyJSON(in)
}
@ -3442,7 +3442,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage38(in *jlexer.Lexer, out *
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(Bootstamp)
out.Timestamp = new(cdp.MonotonicTime)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
@ -4359,7 +4359,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage51(in *jlexer.Lexer, out *
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(Bootstamp)
out.Timestamp = new(cdp.MonotonicTime)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
@ -4936,7 +4936,7 @@ func (v *AppManifestError) UnmarshalJSON(data []byte) error {
func (v *AppManifestError) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage58(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(in *jlexer.Lexer, out *AddScriptToEvaluateOnLoadReturns) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(in *jlexer.Lexer, out *AddScriptToEvaluateOnNewDocumentReturns) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -4967,7 +4967,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(in *jlexer.Lexer, out *
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(out *jwriter.Writer, in AddScriptToEvaluateOnLoadReturns) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(out *jwriter.Writer, in AddScriptToEvaluateOnNewDocumentReturns) {
out.RawByte('{')
first := true
_ = first
@ -4983,29 +4983,29 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(out *jwriter.Writer, in
}
// MarshalJSON supports json.Marshaler interface
func (v AddScriptToEvaluateOnLoadReturns) MarshalJSON() ([]byte, error) {
func (v AddScriptToEvaluateOnNewDocumentReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v AddScriptToEvaluateOnLoadReturns) MarshalEasyJSON(w *jwriter.Writer) {
func (v AddScriptToEvaluateOnNewDocumentReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage59(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *AddScriptToEvaluateOnLoadReturns) UnmarshalJSON(data []byte) error {
func (v *AddScriptToEvaluateOnNewDocumentReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *AddScriptToEvaluateOnLoadReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
func (v *AddScriptToEvaluateOnNewDocumentReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage59(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage60(in *jlexer.Lexer, out *AddScriptToEvaluateOnLoadParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage60(in *jlexer.Lexer, out *AddScriptToEvaluateOnNewDocumentParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -5024,8 +5024,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage60(in *jlexer.Lexer, out *
continue
}
switch key {
case "scriptSource":
out.ScriptSource = string(in.String())
case "source":
out.Source = string(in.String())
default:
in.SkipRecursive()
}
@ -5036,7 +5036,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage60(in *jlexer.Lexer, out *
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage60(out *jwriter.Writer, in AddScriptToEvaluateOnLoadParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage60(out *jwriter.Writer, in AddScriptToEvaluateOnNewDocumentParams) {
out.RawByte('{')
first := true
_ = first
@ -5044,31 +5044,31 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage60(out *jwriter.Writer, in
out.RawByte(',')
}
first = false
out.RawString("\"scriptSource\":")
out.String(string(in.ScriptSource))
out.RawString("\"source\":")
out.String(string(in.Source))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v AddScriptToEvaluateOnLoadParams) MarshalJSON() ([]byte, error) {
func (v AddScriptToEvaluateOnNewDocumentParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage60(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v AddScriptToEvaluateOnLoadParams) MarshalEasyJSON(w *jwriter.Writer) {
func (v AddScriptToEvaluateOnNewDocumentParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage60(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *AddScriptToEvaluateOnLoadParams) UnmarshalJSON(data []byte) error {
func (v *AddScriptToEvaluateOnNewDocumentParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage60(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *AddScriptToEvaluateOnLoadParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
func (v *AddScriptToEvaluateOnNewDocumentParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage60(l, v)
}

View File

@ -9,12 +9,12 @@ import (
// EventDomContentEventFired [no description].
type EventDomContentEventFired struct {
Timestamp *Bootstamp `json:"timestamp"`
Timestamp *cdp.MonotonicTime `json:"timestamp"`
}
// EventLoadEventFired [no description].
type EventLoadEventFired struct {
Timestamp *Bootstamp `json:"timestamp"`
Timestamp *cdp.MonotonicTime `json:"timestamp"`
}
// EventFrameAttached fired when frame has been attached to its parent.

View File

@ -47,35 +47,37 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandPageDisable, nil, nil)
}
// AddScriptToEvaluateOnLoadParams [no description].
type AddScriptToEvaluateOnLoadParams struct {
ScriptSource string `json:"scriptSource"`
// AddScriptToEvaluateOnNewDocumentParams evaluates given script in every
// frame upon creation (before loading frame's scripts).
type AddScriptToEvaluateOnNewDocumentParams struct {
Source string `json:"source"`
}
// AddScriptToEvaluateOnLoad [no description].
// AddScriptToEvaluateOnNewDocument evaluates given script in every frame
// upon creation (before loading frame's scripts).
//
// parameters:
// scriptSource
func AddScriptToEvaluateOnLoad(scriptSource string) *AddScriptToEvaluateOnLoadParams {
return &AddScriptToEvaluateOnLoadParams{
ScriptSource: scriptSource,
// source
func AddScriptToEvaluateOnNewDocument(source string) *AddScriptToEvaluateOnNewDocumentParams {
return &AddScriptToEvaluateOnNewDocumentParams{
Source: source,
}
}
// AddScriptToEvaluateOnLoadReturns return values.
type AddScriptToEvaluateOnLoadReturns struct {
// AddScriptToEvaluateOnNewDocumentReturns return values.
type AddScriptToEvaluateOnNewDocumentReturns struct {
Identifier ScriptIdentifier `json:"identifier,omitempty"` // Identifier of the added script.
}
// Do executes Page.addScriptToEvaluateOnLoad against the provided context and
// Do executes Page.addScriptToEvaluateOnNewDocument against the provided context and
// target handler.
//
// returns:
// identifier - Identifier of the added script.
func (p *AddScriptToEvaluateOnLoadParams) Do(ctxt context.Context, h cdp.Handler) (identifier ScriptIdentifier, err error) {
func (p *AddScriptToEvaluateOnNewDocumentParams) Do(ctxt context.Context, h cdp.Handler) (identifier ScriptIdentifier, err error) {
// execute
var res AddScriptToEvaluateOnLoadReturns
err = h.Execute(ctxt, cdp.CommandPageAddScriptToEvaluateOnLoad, p, &res)
var res AddScriptToEvaluateOnNewDocumentReturns
err = h.Execute(ctxt, cdp.CommandPageAddScriptToEvaluateOnNewDocument, p, &res)
if err != nil {
return "", err
}
@ -83,25 +85,26 @@ func (p *AddScriptToEvaluateOnLoadParams) Do(ctxt context.Context, h cdp.Handler
return res.Identifier, nil
}
// RemoveScriptToEvaluateOnLoadParams [no description].
type RemoveScriptToEvaluateOnLoadParams struct {
// RemoveScriptToEvaluateOnNewDocumentParams removes given script from the
// list.
type RemoveScriptToEvaluateOnNewDocumentParams struct {
Identifier ScriptIdentifier `json:"identifier"`
}
// RemoveScriptToEvaluateOnLoad [no description].
// RemoveScriptToEvaluateOnNewDocument removes given script from the list.
//
// parameters:
// identifier
func RemoveScriptToEvaluateOnLoad(identifier ScriptIdentifier) *RemoveScriptToEvaluateOnLoadParams {
return &RemoveScriptToEvaluateOnLoadParams{
func RemoveScriptToEvaluateOnNewDocument(identifier ScriptIdentifier) *RemoveScriptToEvaluateOnNewDocumentParams {
return &RemoveScriptToEvaluateOnNewDocumentParams{
Identifier: identifier,
}
}
// Do executes Page.removeScriptToEvaluateOnLoad against the provided context and
// Do executes Page.removeScriptToEvaluateOnNewDocument against the provided context and
// target handler.
func (p *RemoveScriptToEvaluateOnLoadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandPageRemoveScriptToEvaluateOnLoad, p, nil)
func (p *RemoveScriptToEvaluateOnNewDocumentParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandPageRemoveScriptToEvaluateOnNewDocument, p, nil)
}
// SetAutoAttachToCreatedPagesParams controls whether browser will open a new

View File

@ -4,11 +4,8 @@ package page
import (
"errors"
"strconv"
"time"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/sysutil"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
@ -91,13 +88,13 @@ func (t *ResourceType) UnmarshalJSON(buf []byte) error {
// FrameResource information about the Resource on the page.
type FrameResource struct {
URL string `json:"url"` // Resource URL.
Type ResourceType `json:"type"` // Type of this resource.
MimeType string `json:"mimeType"` // Resource mimeType as determined by the browser.
LastModified *cdp.Timestamp `json:"lastModified,omitempty"` // last-modified timestamp as reported by server.
ContentSize float64 `json:"contentSize,omitempty"` // Resource content size.
Failed bool `json:"failed,omitempty"` // True if the resource failed to load.
Canceled bool `json:"canceled,omitempty"` // True if the resource was canceled during loading.
URL string `json:"url"` // Resource URL.
Type ResourceType `json:"type"` // Type of this resource.
MimeType string `json:"mimeType"` // Resource mimeType as determined by the browser.
LastModified *cdp.TimeSinceEpoch `json:"lastModified,omitempty"` // last-modified timestamp as reported by server.
ContentSize float64 `json:"contentSize,omitempty"` // Resource content size.
Failed bool `json:"failed,omitempty"` // True if the resource failed to load.
Canceled bool `json:"canceled,omitempty"` // True if the resource was canceled during loading.
}
// FrameResourceTree information about the Frame hierarchy along with their
@ -199,13 +196,13 @@ type NavigationEntry struct {
// ScreencastFrameMetadata screencast frame metadata.
type ScreencastFrameMetadata struct {
OffsetTop float64 `json:"offsetTop"` // Top offset in DIP.
PageScaleFactor float64 `json:"pageScaleFactor"` // Page scale factor.
DeviceWidth float64 `json:"deviceWidth"` // Device screen width in DIP.
DeviceHeight float64 `json:"deviceHeight"` // Device screen height in DIP.
ScrollOffsetX float64 `json:"scrollOffsetX"` // Position of horizontal scroll in CSS pixels.
ScrollOffsetY float64 `json:"scrollOffsetY"` // Position of vertical scroll in CSS pixels.
Timestamp *Bootstamp `json:"timestamp,omitempty"` // Frame swap timestamp.
OffsetTop float64 `json:"offsetTop"` // Top offset in DIP.
PageScaleFactor float64 `json:"pageScaleFactor"` // Page scale factor.
DeviceWidth float64 `json:"deviceWidth"` // Device screen width in DIP.
DeviceHeight float64 `json:"deviceHeight"` // Device screen height in DIP.
ScrollOffsetX float64 `json:"scrollOffsetX"` // Position of horizontal scroll in CSS pixels.
ScrollOffsetY float64 `json:"scrollOffsetY"` // Position of vertical scroll in CSS pixels.
Timestamp *cdp.TimeSinceEpoch `json:"timestamp,omitempty"` // Frame swap timestamp.
}
// DialogType javascript dialog type.
@ -330,37 +327,6 @@ type VisualViewport struct {
Scale float64 `json:"scale"` // Scale relative to the ideal viewport (size at width=device-width).
}
// Bootstamp bootstamp type.
type Bootstamp time.Time
// Time returns the Bootstamp as time.Time value.
func (t Bootstamp) Time() time.Time {
return time.Time(t)
}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Bootstamp) MarshalEasyJSON(out *jwriter.Writer) {
v := float64(time.Time(t).Sub(sysutil.BootTime())) / float64(time.Second)
out.Buffer.EnsureSpace(20)
out.Buffer.Buf = strconv.AppendFloat(out.Buffer.Buf, v, 'f', -1, 64)
}
// MarshalJSON satisfies json.Marshaler.
func (t Bootstamp) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Bootstamp) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = Bootstamp(sysutil.BootTime().Add(time.Duration(in.Float64() * float64(time.Second))))
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Bootstamp) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// CaptureScreenshotFormat image compression format (defaults to png).
type CaptureScreenshotFormat string

View File

@ -44,6 +44,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(in *jlexer.Lexer, out
out.Description = string(in.String())
case "hasCertificate":
out.HasCertificate = bool(in.Bool())
case "mixedContentType":
(out.MixedContentType).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
@ -82,6 +84,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(out *jwriter.Writer,
first = false
out.RawString("\"hasCertificate\":")
out.Bool(bool(in.HasCertificate))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"mixedContentType\":")
(in.MixedContentType).MarshalEasyJSON(out)
out.RawByte('}')
}

View File

@ -18,6 +18,52 @@ func (t CertificateID) Int64() int64 {
return int64(t)
}
// MixedContentType a description of mixed content (HTTP resources on HTTPS
// pages), as defined by https://www.w3.org/TR/mixed-content/#categories.
type MixedContentType string
// String returns the MixedContentType as string value.
func (t MixedContentType) String() string {
return string(t)
}
// MixedContentType values.
const (
MixedContentTypeBlockable MixedContentType = "blockable"
MixedContentTypeOptionallyBlockable MixedContentType = "optionally-blockable"
MixedContentTypeNone MixedContentType = "none"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t MixedContentType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t MixedContentType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *MixedContentType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch MixedContentType(in.String()) {
case MixedContentTypeBlockable:
*t = MixedContentTypeBlockable
case MixedContentTypeOptionallyBlockable:
*t = MixedContentTypeOptionallyBlockable
case MixedContentTypeNone:
*t = MixedContentTypeNone
default:
in.AddError(errors.New("unknown MixedContentType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *MixedContentType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// State the security level of a page or resource.
type State string
@ -75,10 +121,11 @@ func (t *State) UnmarshalJSON(buf []byte) error {
// StateExplanation an explanation of an factor contributing to the security
// state.
type StateExplanation struct {
SecurityState State `json:"securityState"` // Security state representing the severity of the factor being explained.
Summary string `json:"summary"` // Short phrase describing the type of factor.
Description string `json:"description"` // Full text explanation of the factor.
HasCertificate bool `json:"hasCertificate"` // True if the page has a certificate.
SecurityState State `json:"securityState"` // Security state representing the severity of the factor being explained.
Summary string `json:"summary"` // Short phrase describing the type of factor.
Description string `json:"description"` // Full text explanation of the factor.
HasCertificate bool `json:"hasCertificate"` // True if the page has a certificate.
MixedContentType MixedContentType `json:"mixedContentType"` // The type of mixed content described by the explanation.
}
// InsecureContentStatus information about insecure content on the page.

View File

@ -12,11 +12,8 @@
// - add 'Inspector.Message' type as a object with id (integer), method (MethodType), params (interface{}), error (MessageError).
// - add 'Inspector.DetachReason' type and change event 'Inspector.detached''s parameter reason's type.
// - add 'Inspector.ErrorType' type.
// - change type of Network.Timestamp and Runtime.Timestamp to internal Timestamp type.
// - add 'Page.Bootstamp' type and convert all command/event parameters named
// 'timestamp' in the Page domain to the Bootstamp type.
// - change any object property or command/event parameter named 'timestamp'
// that doesn't have a $ref defined to 'Network.Timestamp'.
// - change type of Network.TimeSinceEpoch, Network.MonotonicTime, and
// Runtime.Timestamp to internal Timestamp type.
// - convert object properties and event/command parameters that are enums into independent types.
// - change '*.modifiers' parameters to type Input.Modifier.
// - add 'DOM.NodeType' type and convert "nodeType" parameters to it.
@ -59,7 +56,8 @@ func setup() {
"Inspector.Message": true,
"Inspector.MethodType": true,
"Network.LoaderId": true,
"Network.Timestamp": true,
"Network.MonotonicTime": true,
"Network.TimeSinceEpoch": true,
"Page.FrameId": true,
"Page.Frame": true,
}
@ -206,14 +204,6 @@ func FixDomains(domains []*internal.Domain) {
},
}
// bootstamp type
bootstampType := &internal.Type{
ID: "Bootstamp",
Type: internal.TypeTimestamp,
TimestampType: internal.TimestampTypeBootstamp,
Description: "Bootstamp type.",
}
// process domains
for _, d := range domains {
switch d.Domain {
@ -246,8 +236,14 @@ func FixDomains(domains []*internal.Domain) {
// add Input types
d.Types = append(d.Types, modifierType)
for _, t := range d.Types {
if t.ID == "GestureSourceType" {
switch t.ID {
case "GestureSourceType":
t.ID = "GestureType"
case "TimeSinceEpoch":
t.Type = internal.TypeTimestamp
t.TimestampType = internal.TimestampTypeSecond
t.Extra = templates.ExtraTimestampTemplate(t, d)
}
}
@ -296,14 +292,8 @@ func FixDomains(domains []*internal.Domain) {
}
case internal.DomainPage:
// add Page types
d.Types = append(d.Types, bootstampType)
for _, t := range d.Types {
switch t.ID {
case "Bootstamp":
t.Extra += templates.ExtraTimestampTemplate(t, d)
case "FrameId":
t.Extra += templates.ExtraFixStringUnmarshaler(internal.ForceCamel(t.ID), "", "")
@ -352,13 +342,20 @@ func FixDomains(domains []*internal.Domain) {
case internal.DomainNetwork:
for _, t := range d.Types {
// change Timestamp to TypeTimestamp and add extra unmarshaling template
if t.ID == "Timestamp" {
// change Monotonic to TypeTimestamp and add extra unmarshaling template
if t.ID == "TimeSinceEpoch" {
t.Type = internal.TypeTimestamp
t.TimestampType = internal.TimestampTypeSecond
t.Extra = templates.ExtraTimestampTemplate(t, d)
}
// change Monotonic to TypeTimestamp and add extra unmarshaling template
if t.ID == "MonotonicTime" {
t.Type = internal.TypeTimestamp
t.TimestampType = internal.TimestampTypeMonotonic
t.Extra = templates.ExtraTimestampTemplate(t, d)
}
// change Headers to be a map[string]interface{}
if t.ID == "Headers" {
t.Type = internal.TypeAny
@ -464,22 +461,6 @@ func convertObjectProperties(params []*internal.Type, d *internal.Domain, name s
case p.Enum != nil:
r = append(r, fixupEnumParameter(name, p, d))
case p.Name == "timestamp" && p.Ref == "" && d.Domain == internal.DomainPage:
r = append(r, &internal.Type{
Name: p.Name,
Ref: "Page.Bootstamp",
Description: p.Description,
Optional: p.Optional,
})
case p.Name == "timestamp" && p.Ref == "":
r = append(r, &internal.Type{
Name: p.Name,
Ref: "Network.Timestamp",
Description: p.Description,
Optional: p.Optional,
})
case p.Name == "modifiers":
r = append(r, &internal.Type{
Name: p.Name,

View File

@ -156,5 +156,5 @@ type TimestampType int
const (
TimestampTypeMillisecond TimestampType = 1 + iota
TimestampTypeSecond
TimestampTypeBootstamp
TimestampTypeMonotonic
)

View File

@ -97,7 +97,8 @@
"description": "Actions and events related to the inspected page belong to the page domain.",
"dependencies": [
"Debugger",
"DOM"
"DOM",
"Network"
],
"types": [
{
@ -191,7 +192,7 @@
},
{
"name": "lastModified",
"$ref": "Network.Timestamp",
"$ref": "Network.TimeSinceEpoch",
"description": "last-modified timestamp as reported by server.",
"optional": true
},
@ -348,7 +349,7 @@
},
{
"name": "timestamp",
"type": "number",
"$ref": "Network.TimeSinceEpoch",
"optional": true,
"experimental": true,
"description": "Frame swap timestamp."
@ -503,6 +504,8 @@
"description": "Identifier of the added script."
}
],
"deprecated": true,
"description": "Deprecated, please use addScriptToEvaluateOnNewDocument instead.",
"experimental": true
},
{
@ -513,6 +516,37 @@
"$ref": "ScriptIdentifier"
}
],
"deprecated": true,
"description": "Deprecated, please use removeScriptToEvaluateOnNewDocument instead.",
"experimental": true
},
{
"name": "addScriptToEvaluateOnNewDocument",
"parameters": [
{
"name": "source",
"type": "string"
}
],
"returns": [
{
"name": "identifier",
"$ref": "ScriptIdentifier",
"description": "Identifier of the added script."
}
],
"description": "Evaluates given script in every frame upon creation (before loading frame's scripts).",
"experimental": true
},
{
"name": "removeScriptToEvaluateOnNewDocument",
"parameters": [
{
"name": "identifier",
"$ref": "ScriptIdentifier"
}
],
"description": "Removes given script from the list.",
"experimental": true
},
{
@ -1226,7 +1260,7 @@
"parameters": [
{
"name": "timestamp",
"type": "number"
"$ref": "Network.MonotonicTime"
}
]
},
@ -1235,7 +1269,7 @@
"parameters": [
{
"name": "timestamp",
"type": "number"
"$ref": "Network.MonotonicTime"
}
]
},
@ -2140,6 +2174,16 @@
"type": "integer",
"description": "An internal certificate ID value."
},
{
"id": "MixedContentType",
"type": "string",
"enum": [
"blockable",
"optionally-blockable",
"none"
],
"description": "A description of mixed content (HTTP resources on HTTPS pages), as defined by https://www.w3.org/TR/mixed-content/#categories"
},
{
"id": "SecurityState",
"type": "string",
@ -2176,6 +2220,11 @@
"name": "hasCertificate",
"type": "boolean",
"description": "True if the page has a certificate."
},
{
"name": "mixedContentType",
"$ref": "MixedContentType",
"description": "The type of mixed content described by the explanation."
}
],
"description": "An explanation of an factor contributing to the security state."
@ -2375,9 +2424,14 @@
"description": "Network level fetch failure reason."
},
{
"id": "Timestamp",
"id": "TimeSinceEpoch",
"type": "number",
"description": "Number of seconds since epoch."
"description": "UTC time in seconds, counted from January 1, 1970."
},
{
"id": "MonotonicTime",
"type": "number",
"description": "Monotonically increasing time in seconds since an arbitrary point in the past."
},
{
"id": "Headers",
@ -2540,14 +2594,9 @@
},
{
"name": "mixedContentType",
"$ref": "Security.MixedContentType",
"optional": true,
"type": "string",
"enum": [
"blockable",
"optionally-blockable",
"none"
],
"description": "The mixed content status of the request, as defined in http://www.w3.org/TR/mixed-content/"
"description": "The mixed content type of the request."
},
{
"name": "initialPriority",
@ -2604,7 +2653,7 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "TimeSinceEpoch",
"description": "Issuance date."
},
{
@ -2681,12 +2730,12 @@
},
{
"name": "validFrom",
"$ref": "Timestamp",
"$ref": "TimeSinceEpoch",
"description": "Certificate valid from date."
},
{
"name": "validTo",
"$ref": "Timestamp",
"$ref": "TimeSinceEpoch",
"description": "Certificate valid to (expiration) date"
},
{
@ -3327,7 +3376,7 @@
},
{
"name": "expirationDate",
"$ref": "Timestamp",
"$ref": "TimeSinceEpoch",
"optional": true,
"description": "If omitted, the cookie becomes a session cookie."
}
@ -3448,7 +3497,7 @@
"experimental": true
},
{
"name": "enableRequestInterception",
"name": "setRequestInterceptionEnabled",
"parameters": [
{
"name": "enabled",
@ -3529,7 +3578,7 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
}
],
@ -3561,14 +3610,14 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
},
{
"name": "wallTime",
"$ref": "Timestamp",
"$ref": "TimeSinceEpoch",
"experimental": true,
"description": "UTC Timestamp."
"description": "Timestamp."
},
{
"name": "initiator",
@ -3624,7 +3673,7 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
},
{
@ -3657,7 +3706,7 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
},
{
@ -3683,7 +3732,7 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
},
{
@ -3704,7 +3753,7 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
},
{
@ -3743,12 +3792,12 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
},
{
"name": "wallTime",
"$ref": "Timestamp",
"$ref": "TimeSinceEpoch",
"experimental": true,
"description": "UTC Timestamp."
},
@ -3771,7 +3820,7 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
},
{
@ -3816,7 +3865,7 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
}
],
@ -3833,7 +3882,7 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
},
{
@ -3855,7 +3904,7 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
},
{
@ -3877,7 +3926,7 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
},
{
@ -3899,7 +3948,7 @@
},
{
"name": "timestamp",
"$ref": "Timestamp",
"$ref": "MonotonicTime",
"description": "Timestamp."
},
{
@ -8642,6 +8691,11 @@
"touch",
"mouse"
]
},
{
"id": "TimeSinceEpoch",
"type": "number",
"description": "UTC time in seconds, counted from January 1, 1970."
}
],
"commands": [
@ -8678,9 +8732,9 @@
},
{
"name": "timestamp",
"type": "number",
"$ref": "TimeSinceEpoch",
"optional": true,
"description": "Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time)."
"description": "Time at which the event occurred."
},
{
"name": "text",
@ -8776,9 +8830,9 @@
},
{
"name": "timestamp",
"type": "number",
"$ref": "TimeSinceEpoch",
"optional": true,
"description": "Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time)."
"description": "Time at which the event occurred."
},
{
"name": "button",
@ -8831,9 +8885,9 @@
},
{
"name": "timestamp",
"type": "number",
"$ref": "TimeSinceEpoch",
"optional": true,
"description": "Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970 (default: current time)."
"description": "Time at which the event occurred."
}
],
"description": "Dispatches a touch event to the page."
@ -8865,8 +8919,8 @@
},
{
"name": "timestamp",
"type": "number",
"description": "Time at which the event occurred. Measured in UTC time in seconds since January 1, 1970."
"$ref": "TimeSinceEpoch",
"description": "Time at which the event occurred."
},
{
"name": "button",

View File

@ -6,15 +6,26 @@
// defines its JSON unmarshaling.
{% func ExtraTimestampTemplate(t *internal.Type, d *internal.Domain) %}{%code
typ := t.IDorName()
bootstamp := t.TimestampType == internal.TimestampTypeBootstamp
monotonic := t.TimestampType == internal.TimestampTypeMonotonic
timeRes := "time.Millisecond"
if t.TimestampType != internal.TimestampTypeMillisecond {
timeRes = "time.Second"
}
%}
{% if monotonic %}
// {%s= typ %}Epoch is the {%s= typ %} time epoch.
var {%s= typ %}Epoch *time.Time
func init() {
// initialize epoch
bt := sysutil.BootTime()
{%s= typ %}Epoch = &bt
}
{% endif %}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t {%s= typ %}) MarshalEasyJSON(out *jwriter.Writer) {
v := {% if bootstamp %}float64(time.Time(t).Sub(sysutil.BootTime()))/float64(time.Second){% else %}float64(time.Time(t).UnixNano()/int64({%s= timeRes %})){% endif %}
v := {% if monotonic %}float64(time.Time(t).Sub(*{%s= typ %}Epoch))/float64(time.Second){% else %}float64(time.Time(t).UnixNano()/int64({%s= timeRes %})){% endif %}
out.Buffer.EnsureSpace(20)
out.Buffer.Buf = strconv.AppendFloat(out.Buffer.Buf, v, 'f', -1, 64)
@ -26,8 +37,8 @@ func (t {%s= typ %}) MarshalJSON() ([]byte, error) {
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *{%s= typ %}) UnmarshalEasyJSON(in *jlexer.Lexer) {{% if bootstamp %}
*t = {%s= typ %}(sysutil.BootTime().Add(time.Duration(in.Float64()*float64(time.Second)))){% else %}
func (t *{%s= typ %}) UnmarshalEasyJSON(in *jlexer.Lexer) {{% if monotonic %}
*t = {%s= typ %}({%s= typ %}Epoch.Add(time.Duration(in.Float64()*float64(time.Second)))){% else %}
*t = {%s= typ %}(time.Unix(0, int64(in.Float64()*float64({%s= timeRes %})))){% endif %}
}

View File

@ -29,7 +29,7 @@ var (
func StreamExtraTimestampTemplate(qw422016 *qt422016.Writer, t *internal.Type, d *internal.Domain) {
//line templates/extra.qtpl:8
typ := t.IDorName()
bootstamp := t.TimestampType == internal.TimestampTypeBootstamp
monotonic := t.TimestampType == internal.TimestampTypeMonotonic
timeRes := "time.Millisecond"
if t.TimestampType != internal.TimestampTypeMillisecond {
timeRes = "time.Second"
@ -37,28 +37,67 @@ func StreamExtraTimestampTemplate(qw422016 *qt422016.Writer, t *internal.Type, d
//line templates/extra.qtpl:14
qw422016.N().S(`
`)
//line templates/extra.qtpl:15
if monotonic {
//line templates/extra.qtpl:15
qw422016.N().S(`
// `)
//line templates/extra.qtpl:16
qw422016.N().S(typ)
//line templates/extra.qtpl:16
qw422016.N().S(`Epoch is the `)
//line templates/extra.qtpl:16
qw422016.N().S(typ)
//line templates/extra.qtpl:16
qw422016.N().S(` time epoch.
var `)
//line templates/extra.qtpl:17
qw422016.N().S(typ)
//line templates/extra.qtpl:17
qw422016.N().S(`Epoch *time.Time
func init() {
// initialize epoch
bt := sysutil.BootTime()
`)
//line templates/extra.qtpl:22
qw422016.N().S(typ)
//line templates/extra.qtpl:22
qw422016.N().S(`Epoch = &bt
}
`)
//line templates/extra.qtpl:24
}
//line templates/extra.qtpl:24
qw422016.N().S(`
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t `)
//line templates/extra.qtpl:16
//line templates/extra.qtpl:27
qw422016.N().S(typ)
//line templates/extra.qtpl:16
//line templates/extra.qtpl:27
qw422016.N().S(`) MarshalEasyJSON(out *jwriter.Writer) {
v := `)
//line templates/extra.qtpl:17
if bootstamp {
//line templates/extra.qtpl:17
qw422016.N().S(`float64(time.Time(t).Sub(sysutil.BootTime()))/float64(time.Second)`)
//line templates/extra.qtpl:17
//line templates/extra.qtpl:28
if monotonic {
//line templates/extra.qtpl:28
qw422016.N().S(`float64(time.Time(t).Sub(*`)
//line templates/extra.qtpl:28
qw422016.N().S(typ)
//line templates/extra.qtpl:28
qw422016.N().S(`Epoch))/float64(time.Second)`)
//line templates/extra.qtpl:28
} else {
//line templates/extra.qtpl:17
//line templates/extra.qtpl:28
qw422016.N().S(`float64(time.Time(t).UnixNano()/int64(`)
//line templates/extra.qtpl:17
//line templates/extra.qtpl:28
qw422016.N().S(timeRes)
//line templates/extra.qtpl:17
//line templates/extra.qtpl:28
qw422016.N().S(`))`)
//line templates/extra.qtpl:17
//line templates/extra.qtpl:28
}
//line templates/extra.qtpl:17
//line templates/extra.qtpl:28
qw422016.N().S(`
out.Buffer.EnsureSpace(20)
@ -67,90 +106,94 @@ func (t `)
// MarshalJSON satisfies json.Marshaler.
func (t `)
//line templates/extra.qtpl:24
//line templates/extra.qtpl:35
qw422016.N().S(typ)
//line templates/extra.qtpl:24
//line templates/extra.qtpl:35
qw422016.N().S(`) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *`)
//line templates/extra.qtpl:29
//line templates/extra.qtpl:40
qw422016.N().S(typ)
//line templates/extra.qtpl:29
//line templates/extra.qtpl:40
qw422016.N().S(`) UnmarshalEasyJSON(in *jlexer.Lexer) {`)
//line templates/extra.qtpl:29
if bootstamp {
//line templates/extra.qtpl:29
//line templates/extra.qtpl:40
if monotonic {
//line templates/extra.qtpl:40
qw422016.N().S(`
*t = `)
//line templates/extra.qtpl:30
//line templates/extra.qtpl:41
qw422016.N().S(typ)
//line templates/extra.qtpl:30
qw422016.N().S(`(sysutil.BootTime().Add(time.Duration(in.Float64()*float64(time.Second))))`)
//line templates/extra.qtpl:30
//line templates/extra.qtpl:41
qw422016.N().S(`(`)
//line templates/extra.qtpl:41
qw422016.N().S(typ)
//line templates/extra.qtpl:41
qw422016.N().S(`Epoch.Add(time.Duration(in.Float64()*float64(time.Second))))`)
//line templates/extra.qtpl:41
} else {
//line templates/extra.qtpl:30
//line templates/extra.qtpl:41
qw422016.N().S(`
*t = `)
//line templates/extra.qtpl:31
//line templates/extra.qtpl:42
qw422016.N().S(typ)
//line templates/extra.qtpl:31
//line templates/extra.qtpl:42
qw422016.N().S(`(time.Unix(0, int64(in.Float64()*float64(`)
//line templates/extra.qtpl:31
//line templates/extra.qtpl:42
qw422016.N().S(timeRes)
//line templates/extra.qtpl:31
//line templates/extra.qtpl:42
qw422016.N().S(`))))`)
//line templates/extra.qtpl:31
//line templates/extra.qtpl:42
}
//line templates/extra.qtpl:31
//line templates/extra.qtpl:42
qw422016.N().S(`
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *`)
//line templates/extra.qtpl:35
//line templates/extra.qtpl:46
qw422016.N().S(typ)
//line templates/extra.qtpl:35
//line templates/extra.qtpl:46
qw422016.N().S(`) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
`)
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
}
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
func WriteExtraTimestampTemplate(qq422016 qtio422016.Writer, t *internal.Type, d *internal.Domain) {
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
StreamExtraTimestampTemplate(qw422016, t, d)
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
}
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
func ExtraTimestampTemplate(t *internal.Type, d *internal.Domain) string {
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
WriteExtraTimestampTemplate(qb422016, t, d)
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
return qs422016
//line templates/extra.qtpl:38
//line templates/extra.qtpl:49
}
// ExtraFrameTemplate is a special template for the Page.Frame type, adding FrameState.
//line templates/extra.qtpl:41
//line templates/extra.qtpl:52
func StreamExtraFrameTemplate(qw422016 *qt422016.Writer) {
//line templates/extra.qtpl:41
//line templates/extra.qtpl:52
qw422016.N().S(`
// FrameState is the state of a Frame.
type FrameState uint16
@ -189,40 +232,40 @@ func (fs FrameState) String() string {
// EmptyFrameID is the "non-existent" frame id.
const EmptyFrameID = FrameID("")
`)
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
}
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
func WriteExtraFrameTemplate(qq422016 qtio422016.Writer) {
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
StreamExtraFrameTemplate(qw422016)
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
}
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
func ExtraFrameTemplate() string {
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
WriteExtraFrameTemplate(qb422016)
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
return qs422016
//line templates/extra.qtpl:78
//line templates/extra.qtpl:89
}
// ExtraNodeTemplate is a special template for the DOM.Node type, adding NodeState.
//line templates/extra.qtpl:81
//line templates/extra.qtpl:92
func StreamExtraNodeTemplate(qw422016 *qt422016.Writer) {
//line templates/extra.qtpl:81
//line templates/extra.qtpl:92
qw422016.N().S(`
// AttributeValue returns the named attribute for the node.
func (n *Node) AttributeValue(name string) string {
@ -256,21 +299,21 @@ func (n *Node) xpath(stopAtDocument, stopAtID bool) string {
case stopAtID && id != "":
p = "/"
pos = `)
//line templates/extra.qtpl:81
//line templates/extra.qtpl:92
qw422016.N().S("`")
//line templates/extra.qtpl:81
//line templates/extra.qtpl:92
qw422016.N().S(`[@id='`)
//line templates/extra.qtpl:81
//line templates/extra.qtpl:92
qw422016.N().S("`")
//line templates/extra.qtpl:81
//line templates/extra.qtpl:92
qw422016.N().S(`+id+`)
//line templates/extra.qtpl:81
//line templates/extra.qtpl:92
qw422016.N().S("`")
//line templates/extra.qtpl:81
//line templates/extra.qtpl:92
qw422016.N().S(`']`)
//line templates/extra.qtpl:81
//line templates/extra.qtpl:92
qw422016.N().S("`")
//line templates/extra.qtpl:81
//line templates/extra.qtpl:92
qw422016.N().S(`
case n.Parent != nil:
@ -354,136 +397,136 @@ func (ns NodeState) String() string {
// EmptyNodeID is the "non-existent" node id.
const EmptyNodeID = NodeID(0)
`)
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
}
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
func WriteExtraNodeTemplate(qq422016 qtio422016.Writer) {
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
StreamExtraNodeTemplate(qw422016)
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
}
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
func ExtraNodeTemplate() string {
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
WriteExtraNodeTemplate(qb422016)
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
return qs422016
//line templates/extra.qtpl:195
//line templates/extra.qtpl:206
}
// ExtraFixStringUnmarshaler is a template that forces values to be parsed properly.
//line templates/extra.qtpl:198
//line templates/extra.qtpl:209
func StreamExtraFixStringUnmarshaler(qw422016 *qt422016.Writer, typ, parseFunc, extra string) {
//line templates/extra.qtpl:198
//line templates/extra.qtpl:209
qw422016.N().S(`
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *`)
//line templates/extra.qtpl:200
//line templates/extra.qtpl:211
qw422016.N().S(typ)
//line templates/extra.qtpl:200
//line templates/extra.qtpl:211
qw422016.N().S(`) UnmarshalEasyJSON(in *jlexer.Lexer) {
buf := in.Raw()
if l := len(buf); l > 2 && buf[0] == '"' && buf[l-1] == '"' {
buf = buf[1:l-1]
}
`)
//line templates/extra.qtpl:205
//line templates/extra.qtpl:216
if parseFunc != "" {
//line templates/extra.qtpl:205
//line templates/extra.qtpl:216
qw422016.N().S(`
v, err := strconv.`)
//line templates/extra.qtpl:206
//line templates/extra.qtpl:217
qw422016.N().S(parseFunc)
//line templates/extra.qtpl:206
//line templates/extra.qtpl:217
qw422016.N().S(`(string(buf)`)
//line templates/extra.qtpl:206
//line templates/extra.qtpl:217
qw422016.N().S(extra)
//line templates/extra.qtpl:206
//line templates/extra.qtpl:217
qw422016.N().S(`)
if err != nil {
in.AddError(err)
}
`)
//line templates/extra.qtpl:210
//line templates/extra.qtpl:221
}
//line templates/extra.qtpl:210
//line templates/extra.qtpl:221
qw422016.N().S(`
*t = `)
//line templates/extra.qtpl:211
//line templates/extra.qtpl:222
qw422016.N().S(typ)
//line templates/extra.qtpl:211
//line templates/extra.qtpl:222
qw422016.N().S(`(`)
//line templates/extra.qtpl:211
//line templates/extra.qtpl:222
if parseFunc != "" {
//line templates/extra.qtpl:211
//line templates/extra.qtpl:222
qw422016.N().S(`v`)
//line templates/extra.qtpl:211
//line templates/extra.qtpl:222
} else {
//line templates/extra.qtpl:211
//line templates/extra.qtpl:222
qw422016.N().S(`buf`)
//line templates/extra.qtpl:211
//line templates/extra.qtpl:222
}
//line templates/extra.qtpl:211
//line templates/extra.qtpl:222
qw422016.N().S(`)
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *`)
//line templates/extra.qtpl:215
//line templates/extra.qtpl:226
qw422016.N().S(typ)
//line templates/extra.qtpl:215
//line templates/extra.qtpl:226
qw422016.N().S(`) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
`)
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
}
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
func WriteExtraFixStringUnmarshaler(qq422016 qtio422016.Writer, typ, parseFunc, extra string) {
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
StreamExtraFixStringUnmarshaler(qw422016, typ, parseFunc, extra)
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
}
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
func ExtraFixStringUnmarshaler(typ, parseFunc, extra string) string {
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
WriteExtraFixStringUnmarshaler(qb422016, typ, parseFunc, extra)
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
return qs422016
//line templates/extra.qtpl:218
//line templates/extra.qtpl:229
}
// ExtraExceptionDetailsTemplate is a special template for the Runtime.ExceptionDetails type that
// defines the standard error interface.
//line templates/extra.qtpl:222
//line templates/extra.qtpl:233
func StreamExtraExceptionDetailsTemplate(qw422016 *qt422016.Writer) {
//line templates/extra.qtpl:222
//line templates/extra.qtpl:233
qw422016.N().S(`
// Error satisfies the error interface.
func (e *ExceptionDetails) Error() string {
@ -492,41 +535,41 @@ func (e *ExceptionDetails) Error() string {
return fmt.Sprintf("encountered exception '%s' (%d:%d)", e.Text, e.LineNumber, e.ColumnNumber)
}
`)
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
}
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
func WriteExtraExceptionDetailsTemplate(qq422016 qtio422016.Writer) {
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
StreamExtraExceptionDetailsTemplate(qw422016)
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
}
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
func ExtraExceptionDetailsTemplate() string {
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
WriteExtraExceptionDetailsTemplate(qb422016)
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
return qs422016
//line templates/extra.qtpl:229
//line templates/extra.qtpl:240
}
// ExtraCDPTypes is the template for additional internal type
// declarations.
//line templates/extra.qtpl:233
//line templates/extra.qtpl:244
func StreamExtraCDPTypes(qw422016 *qt422016.Writer) {
//line templates/extra.qtpl:233
//line templates/extra.qtpl:244
qw422016.N().S(`
// Error satisfies the error interface.
@ -560,40 +603,40 @@ type Handler interface {
Release(<-chan interface{})
}
`)
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
}
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
func WriteExtraCDPTypes(qq422016 qtio422016.Writer) {
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
StreamExtraCDPTypes(qw422016)
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
}
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
func ExtraCDPTypes() string {
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
WriteExtraCDPTypes(qb422016)
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
return qs422016
//line templates/extra.qtpl:265
//line templates/extra.qtpl:276
}
// ExtraUtilTemplate generates the decode func for the Message type.
//line templates/extra.qtpl:268
//line templates/extra.qtpl:279
func StreamExtraUtilTemplate(qw422016 *qt422016.Writer, domains []*internal.Domain) {
//line templates/extra.qtpl:268
//line templates/extra.qtpl:279
qw422016.N().S(`
type empty struct{}
var emptyVal = &empty{}
@ -602,66 +645,66 @@ var emptyVal = &empty{}
func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
var v easyjson.Unmarshaler
switch msg.Method {`)
//line templates/extra.qtpl:275
//line templates/extra.qtpl:286
for _, d := range domains {
//line templates/extra.qtpl:275
//line templates/extra.qtpl:286
for _, c := range d.Commands {
//line templates/extra.qtpl:275
//line templates/extra.qtpl:286
qw422016.N().S(`
case cdp.`)
//line templates/extra.qtpl:276
//line templates/extra.qtpl:287
qw422016.N().S(c.CommandMethodType(d))
//line templates/extra.qtpl:276
//line templates/extra.qtpl:287
qw422016.N().S(`:`)
//line templates/extra.qtpl:276
//line templates/extra.qtpl:287
if len(c.Returns) == 0 {
//line templates/extra.qtpl:276
//line templates/extra.qtpl:287
qw422016.N().S(`
return emptyVal, nil`)
//line templates/extra.qtpl:277
//line templates/extra.qtpl:288
} else {
//line templates/extra.qtpl:277
//line templates/extra.qtpl:288
qw422016.N().S(`
v = new(`)
//line templates/extra.qtpl:278
//line templates/extra.qtpl:289
qw422016.N().S(d.PackageRefName())
//line templates/extra.qtpl:278
//line templates/extra.qtpl:289
qw422016.N().S(`.`)
//line templates/extra.qtpl:278
//line templates/extra.qtpl:289
qw422016.N().S(c.CommandReturnsType())
//line templates/extra.qtpl:278
//line templates/extra.qtpl:289
qw422016.N().S(`)`)
//line templates/extra.qtpl:278
//line templates/extra.qtpl:289
}
//line templates/extra.qtpl:278
//line templates/extra.qtpl:289
qw422016.N().S(`
`)
//line templates/extra.qtpl:279
//line templates/extra.qtpl:290
}
//line templates/extra.qtpl:279
//line templates/extra.qtpl:290
for _, e := range d.Events {
//line templates/extra.qtpl:279
//line templates/extra.qtpl:290
qw422016.N().S(`
case cdp.`)
//line templates/extra.qtpl:280
//line templates/extra.qtpl:291
qw422016.N().S(e.EventMethodType(d))
//line templates/extra.qtpl:280
//line templates/extra.qtpl:291
qw422016.N().S(`:
v = new(`)
//line templates/extra.qtpl:281
//line templates/extra.qtpl:292
qw422016.N().S(d.PackageRefName())
//line templates/extra.qtpl:281
//line templates/extra.qtpl:292
qw422016.N().S(`.`)
//line templates/extra.qtpl:281
//line templates/extra.qtpl:292
qw422016.N().S(e.EventType())
//line templates/extra.qtpl:281
//line templates/extra.qtpl:292
qw422016.N().S(`)
`)
//line templates/extra.qtpl:282
//line templates/extra.qtpl:293
}
//line templates/extra.qtpl:282
//line templates/extra.qtpl:293
}
//line templates/extra.qtpl:282
//line templates/extra.qtpl:293
qw422016.N().S(`}
var buf easyjson.RawMessage
@ -684,69 +727,69 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
return v, nil
}
`)
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
}
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
func WriteExtraUtilTemplate(qq422016 qtio422016.Writer, domains []*internal.Domain) {
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
StreamExtraUtilTemplate(qw422016, domains)
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
}
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
func ExtraUtilTemplate(domains []*internal.Domain) string {
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
WriteExtraUtilTemplate(qb422016, domains)
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
return qs422016
//line templates/extra.qtpl:303
//line templates/extra.qtpl:314
}
//line templates/extra.qtpl:305
//line templates/extra.qtpl:316
func StreamExtraMethodTypeDomainDecoder(qw422016 *qt422016.Writer) {
//line templates/extra.qtpl:305
//line templates/extra.qtpl:316
qw422016.N().S(`
// Domain returns the Chrome Debugging Protocol domain of the event or command.
func (t MethodType) Domain() string {
return string(t[:strings.IndexByte(string(t), '.')])
}
`)
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
}
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
func WriteExtraMethodTypeDomainDecoder(qq422016 qtio422016.Writer) {
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
StreamExtraMethodTypeDomainDecoder(qw422016)
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
}
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
func ExtraMethodTypeDomainDecoder() string {
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
WriteExtraMethodTypeDomainDecoder(qb422016)
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
return qs422016
//line templates/extra.qtpl:310
//line templates/extra.qtpl:321
}

4
nav.go
View File

@ -96,7 +96,7 @@ func CaptureScreenshot(res *[]byte) Action {
}
// AddOnLoadScript adds a script to evaluate on page load.
func AddOnLoadScript(source string, id *page.ScriptIdentifier) Action {
/*func AddOnLoadScript(source string, id *page.ScriptIdentifier) Action {
if id == nil {
panic("id cannot be nil")
}
@ -111,7 +111,7 @@ func AddOnLoadScript(source string, id *page.ScriptIdentifier) Action {
// RemoveOnLoadScript removes a script to evaluate on page load.
func RemoveOnLoadScript(id page.ScriptIdentifier) Action {
return page.RemoveScriptToEvaluateOnLoad(id)
}
}*/
// Location retrieves the document location.
func Location(urlstr *string) Action {

View File

@ -328,7 +328,7 @@ func TestCaptureScreenshot(t *testing.T) {
//TODO: test image
}
func TestAddOnLoadScript(t *testing.T) {
/*func TestAddOnLoadScript(t *testing.T) {
t.Parallel()
var err error
@ -384,7 +384,7 @@ func TestRemoveOnLoadScript(t *testing.T) {
}
time.Sleep(50 * time.Millisecond)
}
}*/
func TestLocation(t *testing.T) {
t.Parallel()