Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-137840

QFileDialog::getOpenFileContent crashes after selecting a file in Qt WebAssembly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P1: Critical
    • None
    • 6.9
    • None
    • WebAssembly
    • WebAssembly

    Description

      Hi,

      I am using QFileDialog::getOpenFileContent() to load a file from file system in WebAssembly. The function successfully opens the file picker dialog in Qt WebAssembly, but throws a JavaScript error after the user selects a file and clicks "OK". The error occurs on macOS in both Safari and Firefox:

      TypeError: undefined is not an object (evaluating 'handle[key]')

      The dialog itself opens correctly and the error only occurs after the user selects a file and confirms. The same code works as expected on native desktop Qt.This is the minimal example on how I can reproduce it:

      QFileDialog::getOpenFileContent(QLatin1String("*"),
                         [](const QString &fileName, const QByteArray &data) {
           qDebug() << "File selected: " << fileName;
      });

       
      Here are the screenshots where:
      1. I load the app on my browser
      2. open the file dialog
      3. select a file and see the error
      4. expand the error





       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.webassembly qt.webassembly
            masoud.jami Masoud Jami
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes