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

[REG 5.10.0 -> 5.15.0] Installing QWebEngineUrlInterceptor with QWebEngineProfile::setRequestInterceptor causes QWebEngineUrlInterceptor ::interceptRequest to be hit twice

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.15.1
    • 5.15.0
    • WebEngine
    • None
    • 99b5a45fea6c19dbf65cf5a151be01a6cd0c36e7 (qt/qtwebengine/5.15.1)

    Description

      Problem
      Based on the documentation of QWebEngineProfile::setRequestInterceptor and QWebEngineProfile::setUrlRequestInterceptor should behave essentially the same - though the latter is newer and more thread-safe. However in 5.15 they don't seem to behave the same - not sure on exactly when this behavior changed but in 5.10.0 it would hit once per call and in 5.15.0 it's hit twice per URL. This broke our existing code on upgrade until we changed it to use the newer method.

      Repro

      See attached project. It creates two webviews (with new pages/profiles) and loads google.com/robots.txt in each. The code is identical aside from how we install the interceptor. Using the older method the interceptor records twice the number of calls compared to the newer method. The project just displays counts but also logs the url hits to the debugger - you'll see three of each: two from the object installed via setRequestInterceptor and one from the other installed via setUrlRequestInterceptor.

      Workaround

      Because this method is marked as obsolete the straightforward workaround is to change uses of QWebEngineProfile::setRequestInterceptor to QWebEngineProfile::setUrlRequestInterceptor.

       

      Note - I expect this likely won't be fixed and that's okay because the workaround is straightforward. Filing this mostly in the hopes it saves someone else some trouble when upgrading WebEngine.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: