Skip to content

[Bug]: Issue: page.OnDOMContentLoaded callback causes process blocking when executing JavaScript code in chromium-1169 #574

@ZingYao

Description

@ZingYao

Environment Information

  • Playwright Go version: github.com/playwright-community/playwright-go (latest)
  • Chromium version: chromium-1169
  • Operating System: macOS (based on path structure in issue)
  • Go Version: go1.24.4

Issue Description

When using page.OnDOMContentLoaded callback in Playwright Go with chromium-1169, executing any JavaScript code within the callback causes the process to block indefinitely. The callback is triggered but the execution hangs and never completes.

Reproduction Code

page.OnDOMContentLoaded(func(p playwright.Page) {
    logger.Info("loaded")
    rsp, err := p.EvaluateHandle("(()=>{console.log('hook code loaded');return 1;})();")
    fmt.Println(rsp, err)
})

Expected Behavior

The JavaScript code should execute successfully within the OnDOMContentLoaded callback, return the result, and continue normal program execution.

Actual Behavior

The process blocks indefinitely when executing any JavaScript code (including simple console.log or EvaluateHandle calls) within the OnDOMContentLoaded callback.

Additional Context

This issue occurs with chromium-1169 version where JavaScript execution within the OnDOMContentLoaded event callback does not complete properly. The callback itself is properly triggered as evidenced by the "loaded" log message, but subsequent JavaScript execution within that context results in blocking behavior.

Workaround

Currently, there is no known workaround other than avoiding JavaScript execution within the OnDOMContentLoaded callback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2-bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions