chromedp / pdlgen

Generates templated code using Chrome DevTools PDL definitions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failure with chromium/97.0.4673.1.pdl

tmm1 opened this issue · comments

panic: could not resolve type cdp.compatibilitymode in domain cdp

goroutine 1 [running]:
github.com/chromedp/cdproto-gen/gen/gotpl.ResolveRef(0xc00419b2b8, 0xc00183fe60, {0xc0047d7c00, 0x2d, 0xc00419b258})
        github.com/chromedp/cdproto-gen/gen/gotpl/util.go:143 +0x25d
github.com/chromedp/cdproto-gen/gen/gotpl.ResolveType(0xc004542b89, 0xc00183fe60, {0xc0047d7c00, 0x14034c6, 0xc000050900})
        github.com/chromedp/cdproto-gen/gen/gotpl/util.go:160 +0x1ff

I used this hacky patch to get past the error:

diff --git a/gen/gotpl/util.go b/gen/gotpl/util.go
index e2dfce1..7f5554f 100644
--- a/gen/gotpl/util.go
+++ b/gen/gotpl/util.go
@@ -125,9 +125,10 @@ func ResolveRef(t *pdl.Type, d *pdl.Domain, domains []*pdl.Domain) (pdl.DomainTy                  
        // determine if ref points to an object
        var resolved *pdl.Type
        for _, z := range domains {
-               if dtyp == z.Domain {
+               if dtyp == z.Domain ||
+                       (dtyp == "cdp" && z.Domain == "DOM") {
                        for _, j := range z.Types {
-                               if z.Domain == "cdp" && shortRef == strings.ToLower(strings.SplitN(j.RawName, ".", 2)[1]) {
+                               if (z.Domain == "cdp" || dtyp == "cdp") && shortRef == strings.ToLower(strings.SplitN(j.RawName, ".", 2)[1]) {
                                        resolved = j
                                        break
                                } else if ref == strings.ToLower(j.RawName) {

But now I just get another error:

panic: could not resolve type cdp.frameid in domain cdp

goroutine 1 [running]:
github.com/chromedp/cdproto-gen/gen/gotpl.ResolveRef(0xc007de1262, 0xc007d36090, {0xc0000f4c00, 0x2d, 0xc007293248})
        github.com/chromedp/cdproto-gen/gen/gotpl/util.go:144 +0x2b4
github.com/chromedp/cdproto-gen/gen/gotpl.ResolveType(0x90, 0xc007d36090, {0xc0000f4c00, 0x14748e0, 0xc000080480})
        github.com/chromedp/cdproto-gen/gen/gotpl/util.go:161 +0x1f7
github.com/chromedp/cdproto-gen/gen/gotpl.GoType(...)

I guess its required to use the old branch?

Yes, the old branch is the latest branch.