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

[REG 5.10.0 -> 5.15.0] QWebEngine(Profile|Page)::set[Url]RequestInterceptor does not reliably replace existing interceptor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.15.4
    • 5.15.0
    • WebEngine
    • None
    • 0185f4114579c818fd50374ff1e7d8c054c01e24 (qt/qtwebengine/5.15)

    Description

      Description

      In 5.10.0 when you would reset the QWebEngineUrlInterceptor on a profile with QWebEngineProfile::setRequestInterceptor all new requests would immediately start being routed to the new interceptor. In 5.15.0 the behavior has changed (for both setRequestInterceptor and its replacement setUrlRequestInterceptor) - depending on what you do afterwards requests inconsistently will or will not be routed to the replacement interceptor. This is also the case for QWebEnginePage::setUrlRequestInterceptor.

      There's more information in the Repro steps but it appears that a call to QWebEnginePage::Load is necessary to recognize the new interceptor, but even then some requests may be routed to the old interceptor. I expect some of this may be due to async issues but I see no mention in the documentation of this as a concern. That you cannot replace the router without calling Load seems like strictly a bug though (or at least should be documented).

      Repro

      See attached project. When you click "Hit Demo" it will install a simple interceptor on the profile (though it also repros if installed on the page) to count requested urls and then load a simple page. Once that page initially loads it will install a second interceptor. Then, depending on your checkbox, it will either reload the page or just make a request using fetch. Both display behavior different than the 5.10 behavior. Note that this application is pretty quick and dirty - it doesn't do any clean up so best to only run it once.

      Reloading page:

      The initial request hits the first interceptor but then after installing the interceptor a request from that initial page still gets routed to the old interceptor. The actually reloaded page's requests all go to the second interceptor.

      Fetching a new url:

      All requests continue to go to the original interceptor - no requests are intercepted by the replacement.

      Workarounds

      None that I've found.

      Attachments

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

        Activity

          People

            kiburtse Kirill Burtsev
            wmartin Will Martin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes