fix build breakage with newer cdproto versions
This isn't strictly necessary, as one can always build with the earlier cdproto version specified in go.mod. However, many people still install chromedp in GOPATH via 'go get -u', so this workaround makes life easier for a lot of developers. Fixes #285.
This commit is contained in:
parent
39bd95c850
commit
e9aa66f87e
4
go.mod
4
go.mod
|
@ -1,9 +1,9 @@
|
||||||
module github.com/chromedp/chromedp
|
module github.com/chromedp/chromedp
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/chromedp/cdproto v0.0.0-20190217000753-2d8e8962ceb2
|
github.com/chromedp/cdproto v0.0.0-20190327003620-8d5e1d04ce19
|
||||||
github.com/disintegration/imaging v1.6.0
|
github.com/disintegration/imaging v1.6.0
|
||||||
github.com/gorilla/websocket v1.4.0
|
github.com/gorilla/websocket v1.4.0
|
||||||
github.com/mailru/easyjson v0.0.0-20190221075403-6243d8e04c3f
|
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe
|
||||||
golang.org/x/image v0.0.0-20190220214146-31aff87c08e9 // indirect
|
golang.org/x/image v0.0.0-20190220214146-31aff87c08e9 // indirect
|
||||||
)
|
)
|
||||||
|
|
8
go.sum
8
go.sum
|
@ -1,5 +1,5 @@
|
||||||
github.com/chromedp/cdproto v0.0.0-20190217000753-2d8e8962ceb2 h1:4Ck8YOuS0G3+0xMb80cDSff7QpUolhSc0PGyfagbcdA=
|
github.com/chromedp/cdproto v0.0.0-20190327003620-8d5e1d04ce19 h1:KOdZXVcB8L3zR4ZsMAnviYJFIgfRP/iYSEzXl7rYXhc=
|
||||||
github.com/chromedp/cdproto v0.0.0-20190217000753-2d8e8962ceb2/go.mod h1:xquOK9dIGFlLaIGI4c6IyfLI/Gz0LiYYuJtzhsUODgI=
|
github.com/chromedp/cdproto v0.0.0-20190327003620-8d5e1d04ce19/go.mod h1:xquOK9dIGFlLaIGI4c6IyfLI/Gz0LiYYuJtzhsUODgI=
|
||||||
github.com/disintegration/imaging v1.6.0 h1:nVPXRUUQ36Z7MNf0O77UzgnOb1mkMMor7lmJMJXc/mA=
|
github.com/disintegration/imaging v1.6.0 h1:nVPXRUUQ36Z7MNf0O77UzgnOb1mkMMor7lmJMJXc/mA=
|
||||||
github.com/disintegration/imaging v1.6.0/go.mod h1:xuIt+sRxDFrHS0drzXUlCJthkJ8k7lkkUojDSR247MQ=
|
github.com/disintegration/imaging v1.6.0/go.mod h1:xuIt+sRxDFrHS0drzXUlCJthkJ8k7lkkUojDSR247MQ=
|
||||||
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
||||||
|
@ -7,8 +7,8 @@ github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoA
|
||||||
github.com/knq/sysutil v0.0.0-20181215143952-f05b59f0f307 h1:vl4eIlySbjertFaNwiMjXsGrFVK25aOWLq7n+3gh2ls=
|
github.com/knq/sysutil v0.0.0-20181215143952-f05b59f0f307 h1:vl4eIlySbjertFaNwiMjXsGrFVK25aOWLq7n+3gh2ls=
|
||||||
github.com/knq/sysutil v0.0.0-20181215143952-f05b59f0f307/go.mod h1:BjPj+aVjl9FW/cCGiF3nGh5v+9Gd3VCgBQbod/GlMaQ=
|
github.com/knq/sysutil v0.0.0-20181215143952-f05b59f0f307/go.mod h1:BjPj+aVjl9FW/cCGiF3nGh5v+9Gd3VCgBQbod/GlMaQ=
|
||||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||||
github.com/mailru/easyjson v0.0.0-20190221075403-6243d8e04c3f h1:B6PQkurxGG1rqEX96oE14gbj8bqvYC5dtks9r5uGmlE=
|
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe h1:W/GaMY0y69G4cFlmsC6B9sbuo2fP8OFP1ABjt4kPz+w=
|
||||||
github.com/mailru/easyjson v0.0.0-20190221075403-6243d8e04c3f/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||||
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81 h1:00VmoueYNlNz/aHIilyyQz/MHSqGoWJzpFv/HW8xpzI=
|
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81 h1:00VmoueYNlNz/aHIilyyQz/MHSqGoWJzpFv/HW8xpzI=
|
||||||
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
|
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
|
||||||
golang.org/x/image v0.0.0-20190220214146-31aff87c08e9 h1:+vH8qNweCrORN49012OX3h0oWEXO3p+rRnpAGQinddk=
|
golang.org/x/image v0.0.0-20190220214146-31aff87c08e9 h1:+vH8qNweCrORN49012OX3h0oWEXO3p+rRnpAGQinddk=
|
||||||
|
|
17
handler.go
17
handler.go
|
@ -226,6 +226,15 @@ func (h *TargetHandler) processEvent(ctxt context.Context, msg *cdproto.Message)
|
||||||
if msg == nil {
|
if msg == nil {
|
||||||
return ErrChannelClosed
|
return ErrChannelClosed
|
||||||
}
|
}
|
||||||
|
switch msg.Method {
|
||||||
|
case "Page.frameClearedScheduledNavigation",
|
||||||
|
"Page.frameScheduledNavigation":
|
||||||
|
// These events are now deprecated, and UnmarshalMessage panics
|
||||||
|
// when they are received from Chrome. For now, to avoid panics
|
||||||
|
// and compile errors, and to fix chromedp v0 when installed via
|
||||||
|
// 'go get -u', skip the events here.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// unmarshal
|
// unmarshal
|
||||||
ev, err := cdproto.UnmarshalMessage(msg)
|
ev, err := cdproto.UnmarshalMessage(msg)
|
||||||
|
@ -530,13 +539,9 @@ func (h *TargetHandler) pageEvent(ctxt context.Context, ev interface{}) {
|
||||||
case *page.EventFrameStoppedLoading:
|
case *page.EventFrameStoppedLoading:
|
||||||
id, op = e.FrameID, frameStoppedLoading
|
id, op = e.FrameID, frameStoppedLoading
|
||||||
|
|
||||||
case *page.EventFrameScheduledNavigation:
|
|
||||||
id, op = e.FrameID, frameScheduledNavigation
|
|
||||||
|
|
||||||
case *page.EventFrameClearedScheduledNavigation:
|
|
||||||
id, op = e.FrameID, frameClearedScheduledNavigation
|
|
||||||
|
|
||||||
// ignored events
|
// ignored events
|
||||||
|
case *page.EventFrameRequestedNavigation:
|
||||||
|
return
|
||||||
case *page.EventDomContentEventFired:
|
case *page.EventDomContentEventFired:
|
||||||
return
|
return
|
||||||
case *page.EventLoadEventFired:
|
case *page.EventLoadEventFired:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user