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

Document behaviors of QWebEnginePage::runJavaScript when used with Promise or async functions

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • 5.12.4, 5.13.1, 5.14.0 Alpha
    • 5.11.1
    • WebEngine
    • None
    • Linux/X11
    • a11bb985ab531fe570e6fb3d13c6e76a547b8178 (qt/qtwebengine/5.13)

    Description

      QWebEnginePage::runJavaScript is supposed to return the result of the latest executed statement.

      However, if you do use JS Promise's or async function it always return empty QVariantMap.

      Please document if such non global js code is possible with this api, and if yes, how are we expected to get the result ?

      If it's not, please advice how possible is it to support such script execution in QWebEnginePage.
      Our issues is to execute javascript unit tests at first where code is provided in modules.

      Among other tries, here is what I tried without success which return empty QVariantMap:
       

      (async function test() { return 42; } ()) 
      (async function test() { return await Promise.resolve(42); } ())
      async function test() { return await Promise.resolve(42); } test();

      Attachments

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

        Activity

          People

            juri.valdmann Jüri Valdmann (Inactive)
            filipe.azevedo Filipe Azevedo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes