Updating to latest protocol.json definition

This commit is contained in:
Kenneth Shaw 2017-02-22 20:15:38 +07:00
parent a4cd7f9783
commit 317a2e94d3
8 changed files with 1833 additions and 562 deletions

View File

@ -89,6 +89,7 @@ const (
CommandPageSearchInResource MethodType = "Page.searchInResource"
CommandPageSetDocumentContent MethodType = "Page.setDocumentContent"
CommandPageCaptureScreenshot MethodType = "Page.captureScreenshot"
CommandPagePrintToPDF MethodType = "Page.printToPDF"
CommandPageStartScreencast MethodType = "Page.startScreencast"
CommandPageStopScreencast MethodType = "Page.stopScreencast"
CommandPageScreencastFrameAck MethodType = "Page.screencastFrameAck"
@ -399,6 +400,10 @@ const (
CommandRuntimeSetCustomObjectFormatterEnabled MethodType = "Runtime.setCustomObjectFormatterEnabled"
CommandRuntimeCompileScript MethodType = "Runtime.compileScript"
CommandRuntimeRunScript MethodType = "Runtime.runScript"
CommandRuntimeStartPreciseCoverage MethodType = "Runtime.startPreciseCoverage"
CommandRuntimeStopPreciseCoverage MethodType = "Runtime.stopPreciseCoverage"
CommandRuntimeTakePreciseCoverage MethodType = "Runtime.takePreciseCoverage"
CommandRuntimeGetBestEffortCoverage MethodType = "Runtime.getBestEffortCoverage"
EventDebuggerScriptParsed MethodType = "Debugger.scriptParsed"
EventDebuggerScriptFailedToParse MethodType = "Debugger.scriptFailedToParse"
EventDebuggerBreakpointResolved MethodType = "Debugger.breakpointResolved"
@ -546,6 +551,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandPageSetDocumentContent
case CommandPageCaptureScreenshot:
*t = CommandPageCaptureScreenshot
case CommandPagePrintToPDF:
*t = CommandPagePrintToPDF
case CommandPageStartScreencast:
*t = CommandPageStartScreencast
case CommandPageStopScreencast:
@ -1166,6 +1173,14 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandRuntimeCompileScript
case CommandRuntimeRunScript:
*t = CommandRuntimeRunScript
case CommandRuntimeStartPreciseCoverage:
*t = CommandRuntimeStartPreciseCoverage
case CommandRuntimeStopPreciseCoverage:
*t = CommandRuntimeStopPreciseCoverage
case CommandRuntimeTakePreciseCoverage:
*t = CommandRuntimeTakePreciseCoverage
case CommandRuntimeGetBestEffortCoverage:
*t = CommandRuntimeGetBestEffortCoverage
case EventDebuggerScriptParsed:
*t = EventDebuggerScriptParsed
case EventDebuggerScriptFailedToParse:

View File

@ -112,6 +112,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandPageCaptureScreenshot:
v = new(page.CaptureScreenshotReturns)
case cdp.CommandPagePrintToPDF:
v = new(page.PrintToPDFReturns)
case cdp.CommandPageStartScreencast:
return emptyVal, nil
@ -1075,6 +1078,18 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandRuntimeRunScript:
v = new(runtime.RunScriptReturns)
case cdp.CommandRuntimeStartPreciseCoverage:
return emptyVal, nil
case cdp.CommandRuntimeStopPreciseCoverage:
return emptyVal, nil
case cdp.CommandRuntimeTakePreciseCoverage:
v = new(runtime.TakePreciseCoverageReturns)
case cdp.CommandRuntimeGetBestEffortCoverage:
v = new(runtime.GetBestEffortCoverageReturns)
case cdp.EventRuntimeExecutionContextCreated:
v = new(runtime.EventExecutionContextCreated)

File diff suppressed because it is too large Load Diff

View File

@ -475,6 +475,41 @@ func (p *CaptureScreenshotParams) Do(ctxt context.Context, h cdp.Handler) (data
return dec, nil
}
// PrintToPDFParams print page as pdf.
type PrintToPDFParams struct{}
// PrintToPDF print page as pdf.
func PrintToPDF() *PrintToPDFParams {
return &PrintToPDFParams{}
}
// PrintToPDFReturns return values.
type PrintToPDFReturns struct {
Data string `json:"data,omitempty"` // Base64-encoded pdf data.
}
// Do executes Page.printToPDF against the provided context and
// target handler.
//
// returns:
// data - Base64-encoded pdf data.
func (p *PrintToPDFParams) Do(ctxt context.Context, h cdp.Handler) (data []byte, err error) {
// execute
var res PrintToPDFReturns
err = h.Execute(ctxt, cdp.CommandPagePrintToPDF, nil, &res)
if err != nil {
return nil, err
}
// decode
var dec []byte
dec, err = base64.StdEncoding.DecodeString(res.Data)
if err != nil {
return nil, err
}
return dec, nil
}
// StartScreencastParams starts sending each frame using the screencastFrame
// event.
type StartScreencastParams struct {

File diff suppressed because it is too large Load Diff

View File

@ -603,3 +603,100 @@ func (p *RunScriptParams) Do(ctxt context.Context, h cdp.Handler) (result *Remot
return res.Result, res.ExceptionDetails, nil
}
// StartPreciseCoverageParams enable precise code coverage. Coverage data for
// JavaScript executed before enabling precise code coverage may be incomplete.
// Enabling prevents running optimized code and resets execution counters.
type StartPreciseCoverageParams struct{}
// StartPreciseCoverage enable precise code coverage. Coverage data for
// JavaScript executed before enabling precise code coverage may be incomplete.
// Enabling prevents running optimized code and resets execution counters.
func StartPreciseCoverage() *StartPreciseCoverageParams {
return &StartPreciseCoverageParams{}
}
// Do executes Runtime.startPreciseCoverage against the provided context and
// target handler.
func (p *StartPreciseCoverageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandRuntimeStartPreciseCoverage, nil, nil)
}
// StopPreciseCoverageParams disable precise code coverage. Disabling
// releases unnecessary execution count records and allows executing optimized
// code.
type StopPreciseCoverageParams struct{}
// StopPreciseCoverage disable precise code coverage. Disabling releases
// unnecessary execution count records and allows executing optimized code.
func StopPreciseCoverage() *StopPreciseCoverageParams {
return &StopPreciseCoverageParams{}
}
// Do executes Runtime.stopPreciseCoverage against the provided context and
// target handler.
func (p *StopPreciseCoverageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandRuntimeStopPreciseCoverage, nil, nil)
}
// TakePreciseCoverageParams collect coverage data for the current isolate,
// and resets execution counters. Precise code coverage needs to have started.
type TakePreciseCoverageParams struct{}
// TakePreciseCoverage collect coverage data for the current isolate, and
// resets execution counters. Precise code coverage needs to have started.
func TakePreciseCoverage() *TakePreciseCoverageParams {
return &TakePreciseCoverageParams{}
}
// TakePreciseCoverageReturns return values.
type TakePreciseCoverageReturns struct {
Result []*ScriptCoverage `json:"result,omitempty"` // Coverage data for the current isolate.
}
// Do executes Runtime.takePreciseCoverage against the provided context and
// target handler.
//
// returns:
// result - Coverage data for the current isolate.
func (p *TakePreciseCoverageParams) Do(ctxt context.Context, h cdp.Handler) (result []*ScriptCoverage, err error) {
// execute
var res TakePreciseCoverageReturns
err = h.Execute(ctxt, cdp.CommandRuntimeTakePreciseCoverage, nil, &res)
if err != nil {
return nil, err
}
return res.Result, nil
}
// GetBestEffortCoverageParams collect coverage data for the current isolate.
// The coverage data may be incomplete due to garbage collection.
type GetBestEffortCoverageParams struct{}
// GetBestEffortCoverage collect coverage data for the current isolate. The
// coverage data may be incomplete due to garbage collection.
func GetBestEffortCoverage() *GetBestEffortCoverageParams {
return &GetBestEffortCoverageParams{}
}
// GetBestEffortCoverageReturns return values.
type GetBestEffortCoverageReturns struct {
Result []*ScriptCoverage `json:"result,omitempty"` // Coverage data for the current isolate.
}
// Do executes Runtime.getBestEffortCoverage against the provided context and
// target handler.
//
// returns:
// result - Coverage data for the current isolate.
func (p *GetBestEffortCoverageParams) Do(ctxt context.Context, h cdp.Handler) (result []*ScriptCoverage, err error) {
// execute
var res GetBestEffortCoverageReturns
err = h.Execute(ctxt, cdp.CommandRuntimeGetBestEffortCoverage, nil, &res)
if err != nil {
return nil, err
}
return res.Result, nil
}

View File

@ -206,6 +206,28 @@ type StackTrace struct {
PromiseCreationFrame *CallFrame `json:"promiseCreationFrame,omitempty"` // Creation frame of the Promise which produced the next synchronous trace when resolved, if available.
}
// CoverageRange coverage data for a source range.
type CoverageRange struct {
StartLineNumber int64 `json:"startLineNumber,omitempty"` // JavaScript script line number (0-based) for the range start.
StartColumnNumber int64 `json:"startColumnNumber,omitempty"` // JavaScript script column number (0-based) for the range start.
EndLineNumber int64 `json:"endLineNumber,omitempty"` // JavaScript script line number (0-based) for the range end.
EndColumnNumber int64 `json:"endColumnNumber,omitempty"` // JavaScript script column number (0-based) for the range end.
Count int64 `json:"count,omitempty"` // Collected execution count of the source range.
}
// FunctionCoverage coverage data for a JavaScript function.
type FunctionCoverage struct {
FunctionName string `json:"functionName,omitempty"` // JavaScript function name.
Ranges []*CoverageRange `json:"ranges,omitempty"` // Source ranges inside the function with coverage data.
}
// ScriptCoverage coverage data for a JavaScript script.
type ScriptCoverage struct {
ScriptID ScriptID `json:"scriptId,omitempty"` // JavaScript script id.
URL string `json:"url,omitempty"` // JavaScript script name or url.
Functions []*FunctionCoverage `json:"functions,omitempty"` // Functions contained in the script that has coverage data.
}
// Type object type.
type Type string

View File

@ -906,6 +906,18 @@
],
"experimental": true
},
{
"name": "printToPDF",
"description": "Print page as pdf.",
"returns": [
{
"name": "data",
"type": "string",
"description": "Base64-encoded pdf data."
}
],
"experimental": true
},
{
"name": "startScreencast",
"description": "Starts sending each frame using the <code>screencastFrame</code> event.",
@ -10692,6 +10704,86 @@
"description": "Creation frame of the Promise which produced the next synchronous trace when resolved, if available."
}
]
},
{
"id": "CoverageRange",
"type": "object",
"description": "Coverage data for a source range.",
"properties": [
{
"name": "startLineNumber",
"type": "integer",
"description": "JavaScript script line number (0-based) for the range start."
},
{
"name": "startColumnNumber",
"type": "integer",
"description": "JavaScript script column number (0-based) for the range start."
},
{
"name": "endLineNumber",
"type": "integer",
"description": "JavaScript script line number (0-based) for the range end."
},
{
"name": "endColumnNumber",
"type": "integer",
"description": "JavaScript script column number (0-based) for the range end."
},
{
"name": "count",
"type": "integer",
"description": "Collected execution count of the source range."
}
],
"experimental": "true"
},
{
"id": "FunctionCoverage",
"type": "object",
"description": "Coverage data for a JavaScript function.",
"properties": [
{
"name": "functionName",
"type": "string",
"description": "JavaScript function name."
},
{
"name": "ranges",
"type": "array",
"items": {
"$ref": "CoverageRange"
},
"description": "Source ranges inside the function with coverage data."
}
],
"experimental": "true"
},
{
"id": "ScriptCoverage",
"type": "object",
"description": "Coverage data for a JavaScript script.",
"properties": [
{
"name": "scriptId",
"$ref": "ScriptId",
"description": "JavaScript script id."
},
{
"name": "url",
"type": "string",
"description": "JavaScript script name or url."
},
{
"name": "functions",
"type": "array",
"items": {
"$ref": "FunctionCoverage"
},
"description": "Functions contained in the script that has coverage data."
}
],
"experimental": "true"
}
],
"commands": [
@ -11086,6 +11178,46 @@
}
],
"description": "Runs script with given id in a given context."
},
{
"name": "startPreciseCoverage",
"description": "Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters.",
"experimental": true
},
{
"name": "stopPreciseCoverage",
"description": "Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code.",
"experimental": true
},
{
"name": "takePreciseCoverage",
"returns": [
{
"name": "result",
"type": "array",
"items": {
"$ref": "ScriptCoverage"
},
"description": "Coverage data for the current isolate."
}
],
"description": "Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started.",
"experimental": true
},
{
"name": "getBestEffortCoverage",
"returns": [
{
"name": "result",
"type": "array",
"items": {
"$ref": "ScriptCoverage"
},
"description": "Coverage data for the current isolate."
}
],
"description": "Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection.",
"experimental": true
}
],
"events": [