Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. QWebEnginePage runJavaScript hangs when execution time is longer

QWebEnginePage runJavaScript hangs when execution time is longer

Scheduled Pinned Locked Moved Solved QtWebEngine
qwebenginepageqwebengineviewrunjavascript
8 Posts 2 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Asif QtAddict
    wrote on 5 Aug 2021, 19:29 last edited by
    #1

    Hello,
    I am trying to execute JavaScript command by runJavascript function in QWebEnginePage.

    If the execution time is smaller it runs fine but if execution time exceed limit it hangs doesn't run even next command after that. After sometime renderProcessTerminate event fires.

    webEngine.page().runJavaScript ("console.log('started'); Za(); console.log('finished');", [](const QVariant &v){qDebug() << v;});

    JavaScript function Za() sometime take longer to execute when it takes longer "finished" doesn't show up. Even callback doesn't work.

    Please can you help me set JavaScript unlimited execution time.

    J 1 Reply Last reply 5 Aug 2021, 19:35
    0
    • A Asif QtAddict
      5 Aug 2021, 19:29

      Hello,
      I am trying to execute JavaScript command by runJavascript function in QWebEnginePage.

      If the execution time is smaller it runs fine but if execution time exceed limit it hangs doesn't run even next command after that. After sometime renderProcessTerminate event fires.

      webEngine.page().runJavaScript ("console.log('started'); Za(); console.log('finished');", [](const QVariant &v){qDebug() << v;});

      JavaScript function Za() sometime take longer to execute when it takes longer "finished" doesn't show up. Even callback doesn't work.

      Please can you help me set JavaScript unlimited execution time.

      J Offline
      J Offline
      JonB
      wrote on 5 Aug 2021, 19:35 last edited by
      #2

      @Asif-QtAddict
      You're not intended to run a script which needs to take that long or blocks!

      Depending on what it does, what about moving it into the "document ready" event?

      A 3 Replies Last reply 5 Aug 2021, 19:56
      0
      • J JonB
        5 Aug 2021, 19:35

        @Asif-QtAddict
        You're not intended to run a script which needs to take that long or blocks!

        Depending on what it does, what about moving it into the "document ready" event?

        A Offline
        A Offline
        Asif QtAddict
        wrote on 5 Aug 2021, 19:56 last edited by
        #3

        @JonB youean document ready event of html?

        1 Reply Last reply
        0
        • J JonB
          5 Aug 2021, 19:35

          @Asif-QtAddict
          You're not intended to run a script which needs to take that long or blocks!

          Depending on what it does, what about moving it into the "document ready" event?

          A Offline
          A Offline
          Asif QtAddict
          wrote on 5 Aug 2021, 20:18 last edited by
          #4

          @JonB Thanks for the reply. I don't think it will do any good to what I wanted to do. I just need this command to run(execute) it's full time. That all I want.

          1 Reply Last reply
          0
          • J JonB
            5 Aug 2021, 19:35

            @Asif-QtAddict
            You're not intended to run a script which needs to take that long or blocks!

            Depending on what it does, what about moving it into the "document ready" event?

            A Offline
            A Offline
            Asif QtAddict
            wrote on 6 Aug 2021, 15:18 last edited by
            #5

            @JonB I figured it out. QWebEngineView is based on chromium 32 bit version 77.0.38 which does not support 64 bit.
            I am using Qt 5.14.1 MSVS 2017.

            Can you guide me to 64 bit version please.

            J 1 Reply Last reply 6 Aug 2021, 15:40
            0
            • A Asif QtAddict
              6 Aug 2021, 15:18

              @JonB I figured it out. QWebEngineView is based on chromium 32 bit version 77.0.38 which does not support 64 bit.
              I am using Qt 5.14.1 MSVS 2017.

              Can you guide me to 64 bit version please.

              J Offline
              J Offline
              JonB
              wrote on 6 Aug 2021, 15:40 last edited by
              #6

              @Asif-QtAddict
              I don't know what relevance 32- vs 64-bit has. If QWebEngineView uses 32-bit Chromium, than that's what it uses.

              A 1 Reply Last reply 7 Aug 2021, 09:44
              0
              • J JonB
                6 Aug 2021, 15:40

                @Asif-QtAddict
                I don't know what relevance 32- vs 64-bit has. If QWebEngineView uses 32-bit Chromium, than that's what it uses.

                A Offline
                A Offline
                Asif QtAddict
                wrote on 7 Aug 2021, 09:44 last edited by
                #7

                @JonB I have installed the Qt 5.15.2 and it has new QWebEnginePage with chromium 64 bit version: 83. So now the problem is resolved. Thanks for your help

                J 1 Reply Last reply 7 Aug 2021, 09:58
                0
                • A Asif QtAddict
                  7 Aug 2021, 09:44

                  @JonB I have installed the Qt 5.15.2 and it has new QWebEnginePage with chromium 64 bit version: 83. So now the problem is resolved. Thanks for your help

                  J Offline
                  J Offline
                  JonB
                  wrote on 7 Aug 2021, 09:58 last edited by
                  #8

                  @Asif-QtAddict
                  Oh! Well I have no idea why a 64-bit Chromium should behave any differently from a 32-bit one. If all it is is that it happens to be faster, presumably the problem will re-arise when the operation takes longer. Who knows!

                  1 Reply Last reply
                  0

                  7/8

                  7 Aug 2021, 09:44

                  • Login

                  • Login or register to search.
                  7 out of 8
                  • First post
                    7/8
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved