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

[5.15 LTS] WebEngineView's loadingChanged is incorrect for HTTP error + certain user script

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.2.0
    • 5.15.9
    • WebEngine
    • None
    • QtWebEngine 5.15.9, compiled against Qt 5.12.9, on Ubuntu 16.04 LTS
    • Linux/X11

    Description

      If I visit a URL which returns an HTTP error with no body, and there exists a user script which modifies DOM at DocumentReady, like this:
       -

      WebEngineScript {
          injectionPoint: WebEngineScript.DocumentReady,
          sourceCode: `document.body.innerHTML +=
                          '<img src="https://http.cat/503" />';`
      }
      

      Then it will cause the loadingChanged's argument to has a status of WebEngineView.LoadStoppedStatus and error code of 0, instead of WebEngineView.LoadFailedStatus and error code of HTTP error.

      This seems to happen because Chromium 87's go-to-error-page handling seems to be run after DocumentReady signal, which allows the script to prolong Chromium's DidFinishLoad by the mean of remaining blocking content.

      This doesn't seem to happen in QtWebEngine 6.2+, seemingly because Chromium 88+ changed the handling of go-to-error-page, resulting in this script not being run [1].

      A minimum reproducer is attached.

      [1] https://github.com/chromium/chromium/commit/ba3eecbf23feeea636e323dbd0e91e7a54e87263

      Attachments

        Activity

          People

            kiburtse Kirill Burtsev
            peat-psuwit Ratchanan Srirattanamet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: