Updating to latest protocol.json

This commit is contained in:
Kenneth Shaw 2017-08-03 12:37:27 +07:00
parent 10a6f7bd20
commit e5bd576a97
13 changed files with 432 additions and 712 deletions

View File

@ -265,6 +265,7 @@ func (t AXGlobalStates) String() string {
// AXGlobalStates values.
const (
AXGlobalStatesBusy AXGlobalStates = "busy"
AXGlobalStatesDisabled AXGlobalStates = "disabled"
AXGlobalStatesHidden AXGlobalStates = "hidden"
AXGlobalStatesHiddenRoot AXGlobalStates = "hiddenRoot"
@ -286,6 +287,8 @@ func (t AXGlobalStates) MarshalJSON() ([]byte, error) {
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *AXGlobalStates) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch AXGlobalStates(in.String()) {
case AXGlobalStatesBusy:
*t = AXGlobalStatesBusy
case AXGlobalStatesDisabled:
*t = AXGlobalStatesDisabled
case AXGlobalStatesHidden:
@ -322,7 +325,6 @@ const (
AXLiveRegionAttributesLive AXLiveRegionAttributes = "live"
AXLiveRegionAttributesAtomic AXLiveRegionAttributes = "atomic"
AXLiveRegionAttributesRelevant AXLiveRegionAttributes = "relevant"
AXLiveRegionAttributesBusy AXLiveRegionAttributes = "busy"
AXLiveRegionAttributesRoot AXLiveRegionAttributes = "root"
)
@ -345,8 +347,6 @@ func (t *AXLiveRegionAttributes) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = AXLiveRegionAttributesAtomic
case AXLiveRegionAttributesRelevant:
*t = AXLiveRegionAttributesRelevant
case AXLiveRegionAttributesBusy:
*t = AXLiveRegionAttributesBusy
case AXLiveRegionAttributesRoot:
*t = AXLiveRegionAttributesRoot

View File

@ -72,7 +72,6 @@ const (
EventPageScreencastVisibilityChanged MethodType = "Page.screencastVisibilityChanged"
EventPageInterstitialShown MethodType = "Page.interstitialShown"
EventPageInterstitialHidden MethodType = "Page.interstitialHidden"
EventPageNavigationRequested MethodType = "Page.navigationRequested"
CommandPageEnable MethodType = "Page.enable"
CommandPageDisable MethodType = "Page.disable"
CommandPageAddScriptToEvaluateOnNewDocument MethodType = "Page.addScriptToEvaluateOnNewDocument"
@ -96,8 +95,6 @@ const (
CommandPageHandleJavaScriptDialog MethodType = "Page.handleJavaScriptDialog"
CommandPageGetAppManifest MethodType = "Page.getAppManifest"
CommandPageRequestAppBanner MethodType = "Page.requestAppBanner"
CommandPageSetControlNavigations MethodType = "Page.setControlNavigations"
CommandPageProcessNavigation MethodType = "Page.processNavigation"
CommandPageGetLayoutMetrics MethodType = "Page.getLayoutMetrics"
CommandPageCreateIsolatedWorld MethodType = "Page.createIsolatedWorld"
CommandPageBringToFront MethodType = "Page.bringToFront"
@ -533,8 +530,6 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = EventPageInterstitialShown
case EventPageInterstitialHidden:
*t = EventPageInterstitialHidden
case EventPageNavigationRequested:
*t = EventPageNavigationRequested
case CommandPageEnable:
*t = CommandPageEnable
case CommandPageDisable:
@ -581,10 +576,6 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandPageGetAppManifest
case CommandPageRequestAppBanner:
*t = CommandPageRequestAppBanner
case CommandPageSetControlNavigations:
*t = CommandPageSetControlNavigations
case CommandPageProcessNavigation:
*t = CommandPageProcessNavigation
case CommandPageGetLayoutMetrics:
*t = CommandPageGetLayoutMetrics
case CommandPageCreateIsolatedWorld:

View File

@ -140,12 +140,6 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandPageRequestAppBanner:
return emptyVal, nil
case cdp.CommandPageSetControlNavigations:
return emptyVal, nil
case cdp.CommandPageProcessNavigation:
return emptyVal, nil
case cdp.CommandPageGetLayoutMetrics:
v = new(page.GetLayoutMetricsReturns)
@ -203,9 +197,6 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.EventPageInterstitialHidden:
v = new(page.EventInterstitialHidden)
case cdp.EventPageNavigationRequested:
v = new(page.EventNavigationRequested)
case cdp.CommandOverlayEnable:
return emptyVal, nil

View File

@ -695,6 +695,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot4(in *jlexer.Lexer,
out.BaseURL = string(in.String())
case "contentLanguage":
out.ContentLanguage = string(in.String())
case "documentEncoding":
out.DocumentEncoding = string(in.String())
case "publicId":
out.PublicID = string(in.String())
case "systemId":
@ -874,6 +876,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot4(out *jwriter.Writ
out.RawString("\"contentLanguage\":")
out.String(string(in.ContentLanguage))
}
if in.DocumentEncoding != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"documentEncoding\":")
out.String(string(in.DocumentEncoding))
}
if in.PublicID != "" {
if !first {
out.RawByte(',')

View File

@ -25,6 +25,7 @@ type DOMNode struct {
DocumentURL string `json:"documentURL,omitempty"` // Document URL that Document or FrameOwner node points to.
BaseURL string `json:"baseURL,omitempty"` // Base URL that Document or FrameOwner node uses for URL completion.
ContentLanguage string `json:"contentLanguage,omitempty"` // Only set for documents, contains the document's content language.
DocumentEncoding string `json:"documentEncoding,omitempty"` // Only set for documents, contains the document's character set encoding.
PublicID string `json:"publicId,omitempty"` // DocumentType node's publicId.
SystemID string `json:"systemId,omitempty"` // DocumentType node's systemId.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame ID for frame owner elements.

View File

@ -4432,6 +4432,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork38(in *jlexer.Lexer, ou
}
case "resourceType":
(out.ResourceType).UnmarshalEasyJSON(in)
case "isNavigationRequest":
out.IsNavigationRequest = bool(in.Bool())
case "redirectHeaders":
if in.IsNull() {
in.Skip()
@ -4508,6 +4510,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork38(out *jwriter.Writer,
first = false
out.RawString("\"resourceType\":")
(in.ResourceType).MarshalEasyJSON(out)
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"isNavigationRequest\":")
out.Bool(bool(in.IsNavigationRequest))
if len(in.RedirectHeaders) != 0 {
if !first {
out.RawByte(',')

View File

@ -136,6 +136,7 @@ type EventRequestIntercepted struct {
InterceptionID InterceptionID `json:"interceptionId"` // Each request the page makes will have a unique id, however if any redirects are encountered while processing that fetch, they will be reported with the same id as the original fetch. Likewise if HTTP authentication is needed then the same fetch id will be used.
Request *Request `json:"request"`
ResourceType page.ResourceType `json:"resourceType"` // How the requested resource will be used.
IsNavigationRequest bool `json:"isNavigationRequest"` // Whether this is a navigation request, which can abort the navigation completely.
RedirectHeaders Headers `json:"redirectHeaders,omitempty"` // HTTP response headers, only sent if a redirect was intercepted.
RedirectStatusCode int64 `json:"redirectStatusCode,omitempty"` // HTTP response code, only sent if a redirect was intercepted.
RedirectURL string `json:"redirectUrl,omitempty"` // Redirect location, only sent if a redirect was intercepted.

View File

@ -684,7 +684,7 @@ func (p *SetRequestInterceptionEnabledParams) Do(ctxt context.Context, h cdp.Han
// Network.requestIntercepted event will be sent with the same InterceptionId.
type ContinueInterceptedRequestParams struct {
InterceptionID InterceptionID `json:"interceptionId"`
ErrorReason ErrorReason `json:"errorReason,omitempty"` // If set this causes the request to fail with the given reason. Must not be set in response to an authChallenge.
ErrorReason ErrorReason `json:"errorReason,omitempty"` // If set this causes the request to fail with the given reason. Passing Aborted for requests marked with isNavigationRequest also cancels the navigation. Must not be set in response to an authChallenge.
RawResponse string `json:"rawResponse,omitempty"` // If set the requests completes using with the provided base64 encoded raw response, including HTTP status line and headers etc... Must not be set in response to an authChallenge.
URL string `json:"url,omitempty"` // If set the request url will be modified in a way that's not observable by page. Must not be set in response to an authChallenge.
Method string `json:"method,omitempty"` // If set this allows the request method to be overridden. Must not be set in response to an authChallenge.
@ -708,7 +708,8 @@ func ContinueInterceptedRequest(interceptionID InterceptionID) *ContinueIntercep
}
// WithErrorReason if set this causes the request to fail with the given
// reason. Must not be set in response to an authChallenge.
// reason. Passing Aborted for requests marked with isNavigationRequest also
// cancels the navigation. Must not be set in response to an authChallenge.
func (p ContinueInterceptedRequestParams) WithErrorReason(errorReason ErrorReason) *ContinueInterceptedRequestParams {
p.ErrorReason = errorReason
return &p

File diff suppressed because it is too large Load Diff

View File

@ -66,14 +66,17 @@ type EventFrameResized struct{}
// EventJavascriptDialogOpening fired when a JavaScript initiated dialog
// (alert, confirm, prompt, or onbeforeunload) is about to open.
type EventJavascriptDialogOpening struct {
URL string `json:"url"` // Frame url.
Message string `json:"message"` // Message that will be displayed by the dialog.
Type DialogType `json:"type"` // Dialog type.
DefaultPrompt string `json:"defaultPrompt,omitempty"` // Default dialog prompt.
}
// EventJavascriptDialogClosed fired when a JavaScript initiated dialog
// (alert, confirm, prompt, or onbeforeunload) has been closed.
type EventJavascriptDialogClosed struct {
Result bool `json:"result"` // Whether dialog was confirmed.
UserInput string `json:"userInput"` // User input in case of prompt.
}
// EventScreencastFrame compressed image data requested by the
@ -96,16 +99,6 @@ type EventInterstitialShown struct{}
// EventInterstitialHidden fired when interstitial page was hidden.
type EventInterstitialHidden struct{}
// EventNavigationRequested fired when a navigation is started if navigation
// throttles are enabled. The navigation will be deferred until
// processNavigation is called.
type EventNavigationRequested struct {
IsInMainFrame bool `json:"isInMainFrame"` // Whether the navigation is taking place in the main frame or in a subframe.
IsRedirect bool `json:"isRedirect"` // Whether the navigation has encountered a server redirect or not.
NavigationID int64 `json:"navigationId"`
URL string `json:"url"` // URL of requested navigation.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventPageDomContentEventFired,
@ -124,5 +117,4 @@ var EventTypes = []cdp.MethodType{
cdp.EventPageScreencastVisibilityChanged,
cdp.EventPageInterstitialShown,
cdp.EventPageInterstitialHidden,
cdp.EventPageNavigationRequested,
}

View File

@ -823,56 +823,6 @@ func (p *RequestAppBannerParams) Do(ctxt context.Context, h cdp.Handler) (err er
return h.Execute(ctxt, cdp.CommandPageRequestAppBanner, nil, nil)
}
// SetControlNavigationsParams toggles navigation throttling which allows
// programatic control over navigation and redirect response.
type SetControlNavigationsParams struct {
Enabled bool `json:"enabled"`
}
// SetControlNavigations toggles navigation throttling which allows
// programatic control over navigation and redirect response.
//
// parameters:
// enabled
func SetControlNavigations(enabled bool) *SetControlNavigationsParams {
return &SetControlNavigationsParams{
Enabled: enabled,
}
}
// Do executes Page.setControlNavigations against the provided context and
// target handler.
func (p *SetControlNavigationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandPageSetControlNavigations, p, nil)
}
// ProcessNavigationParams should be sent in response to a
// navigationRequested or a redirectRequested event, telling the browser how to
// handle the navigation.
type ProcessNavigationParams struct {
Response NavigationResponse `json:"response"`
NavigationID int64 `json:"navigationId"`
}
// ProcessNavigation should be sent in response to a navigationRequested or a
// redirectRequested event, telling the browser how to handle the navigation.
//
// parameters:
// response
// navigationID
func ProcessNavigation(response NavigationResponse, navigationID int64) *ProcessNavigationParams {
return &ProcessNavigationParams{
Response: response,
NavigationID: navigationID,
}
}
// Do executes Page.processNavigation against the provided context and
// target handler.
func (p *ProcessNavigationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandPageProcessNavigation, p, nil)
}
// GetLayoutMetricsParams returns metrics relating to the layouting of the
// page, such as viewport bounds/scale.
type GetLayoutMetricsParams struct{}

View File

@ -1228,32 +1228,6 @@
"name": "requestAppBanner",
"experimental": true
},
{
"name": "setControlNavigations",
"parameters": [
{
"name": "enabled",
"type": "boolean"
}
],
"description": "Toggles navigation throttling which allows programatic control over navigation and redirect response.",
"experimental": true
},
{
"name": "processNavigation",
"parameters": [
{
"name": "response",
"$ref": "NavigationResponse"
},
{
"name": "navigationId",
"type": "integer"
}
],
"description": "Should be sent in response to a navigationRequested or a redirectRequested event, telling the browser how to handle the navigation.",
"experimental": true
},
{
"name": "getLayoutMetrics",
"description": "Returns metrics relating to the layouting of the page, such as viewport bounds/scale.",
@ -1457,6 +1431,11 @@
"name": "javascriptDialogOpening",
"description": "Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to open.",
"parameters": [
{
"name": "url",
"type": "string",
"description": "Frame url."
},
{
"name": "message",
"type": "string",
@ -1466,6 +1445,12 @@
"name": "type",
"$ref": "DialogType",
"description": "Dialog type."
},
{
"name": "defaultPrompt",
"optional": true,
"type": "string",
"description": "Default dialog prompt."
}
]
},
@ -1477,6 +1462,11 @@
"name": "result",
"type": "boolean",
"description": "Whether dialog was confirmed."
},
{
"name": "userInput",
"type": "string",
"description": "User input in case of prompt."
}
]
},
@ -1521,31 +1511,6 @@
{
"name": "interstitialHidden",
"description": "Fired when interstitial page was hidden"
},
{
"name": "navigationRequested",
"description": "Fired when a navigation is started if navigation throttles are enabled. The navigation will be deferred until processNavigation is called.",
"parameters": [
{
"name": "isInMainFrame",
"type": "boolean",
"description": "Whether the navigation is taking place in the main frame or in a subframe."
},
{
"name": "isRedirect",
"type": "boolean",
"description": "Whether the navigation has encountered a server redirect or not."
},
{
"name": "navigationId",
"type": "integer"
},
{
"name": "url",
"type": "string",
"description": "URL of requested navigation."
}
]
}
]
},
@ -3567,7 +3532,7 @@
"name": "errorReason",
"$ref": "ErrorReason",
"optional": true,
"description": "If set this causes the request to fail with the given reason. Must not be set in response to an authChallenge."
"description": "If set this causes the request to fail with the given reason. Passing <code>Aborted</code> for requests marked with <code>isNavigationRequest</code> also cancels the navigation. Must not be set in response to an authChallenge."
},
{
"name": "rawResponse",
@ -4035,6 +4000,11 @@
"$ref": "Page.ResourceType",
"description": "How the requested resource will be used."
},
{
"name": "isNavigationRequest",
"type": "boolean",
"description": "Whether this is a navigation request, which can abort the navigation completely."
},
{
"name": "redirectHeaders",
"$ref": "Headers",
@ -7708,6 +7678,12 @@
"optional": true,
"description": "Only set for documents, contains the document's content language."
},
{
"name": "documentEncoding",
"type": "string",
"optional": true,
"description": "Only set for documents, contains the document's character set encoding."
},
{
"name": "publicId",
"type": "string",
@ -10553,6 +10529,7 @@
"id": "AXGlobalStates",
"type": "string",
"enum": [
"busy",
"disabled",
"hidden",
"hiddenRoot",
@ -10569,7 +10546,6 @@
"live",
"atomic",
"relevant",
"busy",
"root"
],
"description": "Attributes which apply to nodes in live regions."

View File

@ -1,5 +1,8 @@
#!/bin/bash
BROWSER_VER=${1:-"master"}
JS_VER=${2:-"master"}
# updates protocol.json to the latest from the chromium source tree
SRC=$(realpath $(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
@ -7,8 +10,8 @@ SRC=$(realpath $(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
HAR_PROTO="$SRC/har.json"
BASE_URL="https://chromium.googlesource.com"
BROWSER_PROTO="$BASE_URL/chromium/src/+/master/third_party/WebKit/Source/core/inspector/browser_protocol.json?format=TEXT"
JS_PROTO="$BASE_URL/v8/v8/+/master/src/inspector/js_protocol.json?format=TEXT"
BROWSER_PROTO="$BASE_URL/chromium/src/+/$BROWSER_VER/third_party/WebKit/Source/core/inspector/browser_protocol.json?format=TEXT"
JS_PROTO="$BASE_URL/v8/v8/+/$JS_VER/src/inspector/js_protocol.json?format=TEXT"
OUT=$SRC/protocol.json
@ -16,6 +19,9 @@ TMP=$(mktemp -d /tmp/chromedp-gen.XXXXXX)
BROWSER_TMP="$TMP/browser_protocol.json"
JS_TMP="$TMP/js_protocol.json"
echo "BROWSER_PROTO: $BROWSER_PROTO"
echo "JS_PROTO: $JS_PROTO"
set -ve
# download
curl -s $BROWSER_PROTO | base64 -d > $BROWSER_TMP