Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the preview option stable against occasional invalid URL errors #627

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Jan 14, 2025

When opening multiple previews with --preview option, the preview window detector will sometimes fail with the parse error of empty URL for other type page.

node:internal/url:818
      href = bindingUrl.parse(input, base, true);
                        ^

TypeError: Invalid URL
    at new URL (node:internal/url:818:25)
    at idMatcher (/Users/yhatt/Programs/marp/marp-cli/lib/marp-cli-DSmb16j_.js:25490:33)
    at /Users/yhatt/Programs/marp/marp-cli/node_modules/puppeteer-core/lib/cjs/third_party/mitt/mitt.js:62:7
    at Array.map (<anonymous>)
    at Object.emit (/Users/yhatt/Programs/marp/marp-cli/node_modules/puppeteer-core/lib/cjs/third_party/mitt/mitt.js:61:20)
    at CdpBrowser.emit (/Users/yhatt/Programs/marp/marp-cli/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js:83:23)
    at #onAttachedToTarget (/Users/yhatt/Programs/marp/marp-cli/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Browser.js:158:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  code: 'ERR_INVALID_URL',
  input: ''
}

This PR fixes that to narrow check only for the target that is having page type.

yhatt added 2 commits January 14, 2025 20:55
When opening multiple previews with `--preview`, the preview window
detector will sometimes fail with the parse error of empty URL for
`other` type page.
@yhatt yhatt merged commit 19f8166 into main Jan 14, 2025
1 check passed
@yhatt yhatt deleted the stable-preview-window-detector branch January 14, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant