Skip to content

Local Cloak browser-run does not forward transient filechooser events #448

Description

@luissantana1

Summary

webcmd browser run cannot receive a filechooser event from the local Cloak runtime, so an in-memory upload cannot be supplied to transient input[type=file] controls such as Flutter Web file_picker.

Reproduction

Environment:

  • Webcmd 0.7.4
  • Node 26.7.0
  • Local Cloak runtime 0.4.5; reproduced again after testing 0.5.9

Create an isolated browser session and run this program:

await page.setContent(`
  <button id="pick">Attach PDF</button><output id="result"></output>
  <script>
    document.querySelector('#pick').addEventListener('click', () => {
      const input = document.createElement('input');
      input.type = 'file';
      input.accept = '.pdf';
      input.style.display = 'none';
      input.addEventListener('change', () => {
        document.querySelector('#result').textContent = input.files[0]?.name ?? '';
      });
      document.body.appendChild(input);
      input.click();
      input.remove();
    });
  </script>
`);

const pending = page.waitForEvent('filechooser', { timeout: 5000 });
await page.getByRole('button', { name: 'Attach PDF' }).click();
const chooser = await pending;
await chooser.setFiles({
  name: 'evidence.pdf',
  mimeType: 'application/pdf',
  buffer: new TextEncoder().encode('%PDF-1.4'),
});
return await page.locator('#result').textContent();

Expected

The program receives the file chooser and reports evidence.pdf. File payloads remain in memory; host filesystem paths are not needed.

Actual

The program times out waiting for filechooser (the overall browser-run limit is reached when no shorter timeout is supplied).

Control

The equivalent regression runs successfully in Webcmd's runBrowserProgram test with playwright-core; the failure occurs only through the real local Cloak runtime bridge. Updating Cloak from 0.4.5 to 0.5.9 did not change the result.

Requested behavior

Forward Page.filechooser through the local Cloak browser-run bridge so callers can use the existing FileChooser.setFiles API with in-memory payloads, including inputs that are removed immediately after click().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions