Skip to content

Commit

Permalink
always emit Page.setDownloadBehavior for now
Browse files Browse the repository at this point in the history
For this, I needed to teach the tool to obey AlwaysEmit for commands as
well. The existing fixup functions weren't enough for this change
either, as they run after we've removed deprecated commands and types in
the cleanup stage.

Fixes chromedp/chromedp#627.
  • Loading branch information
mvdan committed Jul 9, 2020
1 parent fcda84b commit 99c9ca1
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,24 @@ func run() error {
// skip if not processing
if d.Deprecated {
var extra []string
if d.Deprecated {
extra = append(extra, "deprecated")
}
extra = append(extra, "deprecated")
util.Logf("SKIPPING(%s): %s %v", pad("domain", 7), d.Domain.String(), extra)
continue
}

// TODO: remove this pre-cleanup fixup at some point; right now,
// it's necessary as the current Chrome stable release doesn't
// yet support the new Browser.setDownloadBehavior.
switch d.Domain {
case "Page":
for _, c := range d.Commands {
switch c.Name {
case "setDownloadBehavior":
c.AlwaysEmit = true
}
}
}

// will process
pkgs = append(pkgs, genutil.PackageName(d))
processed = append(processed, d)
Expand Down Expand Up @@ -337,12 +348,12 @@ func cleanupTypes(n string, dtyp string, typs []*pdl.Type) []*pdl.Type {

for _, t := range typs {
typ := dtyp + "." + t.Name
if t.Deprecated {
if t.Deprecated && !t.AlwaysEmit {
util.Logf("SKIPPING(%s): %s [deprecated]", pad(n, 7), typ)
continue
}

if t.Redirect != nil {
if t.Redirect != nil && !t.AlwaysEmit {
util.Logf("SKIPPING(%s): %s [redirect:%s]", pad(n, 7), typ, t.Redirect)
continue
}
Expand Down

0 comments on commit 99c9ca1

Please sign in to comment.