Skip to content

Commit

Permalink
all: resolve compatibility issue
Browse files Browse the repository at this point in the history
  • Loading branch information
changkun committed Aug 23, 2021
1 parent 637e60c commit 6f632c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions code2img.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/chromedp/cdproto/dom"
"github.com/chromedp/cdproto/emulation"
"github.com/chromedp/cdproto/page"
"github.com/chromedp/cdproto/runtime"
"github.com/chromedp/chromedp"
)

Expand Down Expand Up @@ -109,13 +110,13 @@ func screenshot(sel interface{}, picbuf *[]byte, opts ...chromedp.QueryOption) c
panic("picbuf cannot be nil")
}

return chromedp.QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error {
return chromedp.QueryAfter(sel, func(ctx context.Context, eci runtime.ExecutionContextID, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector %q did not return any nodes", sel)
}

// get layout metrics
_, _, contentSize, err := page.GetLayoutMetrics().Do(ctx)
_, _, contentSize, _, _, _, err := page.GetLayoutMetrics().Do(ctx)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion code2img_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

func TestRender(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

got, err := code2img.Render(ctx, code2img.LangGo, `import "golang.design/x/code2img"`)
Expand Down

0 comments on commit 6f632c2

Please sign in to comment.