From 57826bddb17f69cb467d5b2375f7eb35f3eabc3c Mon Sep 17 00:00:00 2001 From: Kenneth Shaw Date: Tue, 4 Jul 2017 08:07:34 +0700 Subject: [PATCH] Updating to latest protocol.json --- cdp/network/easyjson.go | 36 +++++++++++++++++++--------------- cdp/network/events.go | 16 +++++++-------- cmd/chromedp-gen/protocol.json | 30 +++++++++++++++------------- 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/cdp/network/easyjson.go b/cdp/network/easyjson.go index 6475483..9889c2d 100644 --- a/cdp/network/easyjson.go +++ b/cdp/network/easyjson.go @@ -3853,8 +3853,6 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork33(in *jlexer.Lexer, ou switch key { case "requestId": out.RequestID = RequestID(in.String()) - case "frameId": - (out.FrameID).UnmarshalEasyJSON(in) case "loaderId": out.LoaderID = cdp.LoaderID(in.String()) case "timestamp": @@ -3879,6 +3877,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork33(in *jlexer.Lexer, ou } (*out.Response).UnmarshalEasyJSON(in) } + case "frameId": + (out.FrameID).UnmarshalEasyJSON(in) default: in.SkipRecursive() } @@ -3903,12 +3903,6 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork33(out *jwriter.Writer, out.RawByte(',') } first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) - if !first { - out.RawByte(',') - } - first = false out.RawString("\"loaderId\":") out.String(string(in.LoaderID)) if !first { @@ -3937,6 +3931,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork33(out *jwriter.Writer, } else { (*in.Response).MarshalEasyJSON(out) } + if in.FrameID != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) + } out.RawByte('}') } @@ -4079,8 +4081,6 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork35(in *jlexer.Lexer, ou switch key { case "requestId": out.RequestID = RequestID(in.String()) - case "frameId": - (out.FrameID).UnmarshalEasyJSON(in) case "loaderId": out.LoaderID = cdp.LoaderID(in.String()) case "documentURL": @@ -4137,6 +4137,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork35(in *jlexer.Lexer, ou } case "type": (out.Type).UnmarshalEasyJSON(in) + case "frameId": + (out.FrameID).UnmarshalEasyJSON(in) default: in.SkipRecursive() } @@ -4161,12 +4163,6 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork35(out *jwriter.Writer, out.RawByte(',') } first = false - out.RawString("\"frameId\":") - out.String(string(in.FrameID)) - if !first { - out.RawByte(',') - } - first = false out.RawString("\"loaderId\":") out.String(string(in.LoaderID)) if !first { @@ -4235,6 +4231,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork35(out *jwriter.Writer, out.RawString("\"type\":") (in.Type).MarshalEasyJSON(out) } + if in.FrameID != "" { + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"frameId\":") + out.String(string(in.FrameID)) + } out.RawByte('}') } diff --git a/cdp/network/events.go b/cdp/network/events.go index 0448d6a..dd952ea 100644 --- a/cdp/network/events.go +++ b/cdp/network/events.go @@ -18,8 +18,7 @@ type EventResourceChangedPriority struct { // EventRequestWillBeSent fired when page is about to send HTTP request. type EventRequestWillBeSent struct { RequestID RequestID `json:"requestId"` // Request identifier. - FrameID cdp.FrameID `json:"frameId"` // Frame identifier. - LoaderID cdp.LoaderID `json:"loaderId"` // Loader 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. @@ -27,6 +26,7 @@ type EventRequestWillBeSent struct { 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,12 +36,12 @@ type EventRequestServedFromCache struct { // EventResponseReceived fired when HTTP response is available. type EventResponseReceived struct { - RequestID RequestID `json:"requestId"` // Request identifier. - FrameID cdp.FrameID `json:"frameId"` // Frame identifier. - LoaderID cdp.LoaderID `json:"loaderId"` // Loader identifier. - Timestamp *cdp.Timestamp `json:"timestamp"` // Timestamp. - Type page.ResourceType `json:"type"` // Resource type. - Response *Response `json:"response"` // Response data. + 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. } // EventDataReceived fired when data chunk was received over the network. diff --git a/cmd/chromedp-gen/protocol.json b/cmd/chromedp-gen/protocol.json index 380a660..afff8fb 100644 --- a/cmd/chromedp-gen/protocol.json +++ b/cmd/chromedp-gen/protocol.json @@ -3544,16 +3544,10 @@ "$ref": "RequestId", "description": "Request identifier." }, - { - "name": "frameId", - "$ref": "Page.FrameId", - "description": "Frame identifier.", - "experimental": true - }, { "name": "loaderId", "$ref": "LoaderId", - "description": "Loader identifier." + "description": "Loader identifier. Empty string if the request is fetched form worker." }, { "name": "documentURL", @@ -3593,6 +3587,13 @@ "optional": true, "experimental": true, "description": "Type of this resource." + }, + { + "name": "frameId", + "optional": true, + "$ref": "Page.FrameId", + "description": "Frame identifier.", + "experimental": true } ] }, @@ -3616,16 +3617,10 @@ "$ref": "RequestId", "description": "Request identifier." }, - { - "name": "frameId", - "$ref": "Page.FrameId", - "description": "Frame identifier.", - "experimental": true - }, { "name": "loaderId", "$ref": "LoaderId", - "description": "Loader identifier." + "description": "Loader identifier. Empty string if the request is fetched form worker." }, { "name": "timestamp", @@ -3641,6 +3636,13 @@ "name": "response", "$ref": "Response", "description": "Response data." + }, + { + "name": "frameId", + "optional": true, + "$ref": "Page.FrameId", + "description": "Frame identifier.", + "experimental": true } ] },