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

QWebEngineUrlRequestInterceptor not called on page, if the one set on the profile changed the info

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3: Somewhat important P3: Somewhat important
    • 6.6
    • 6.5.3
    • WebEngine
    • None
    • eda737865 (dev), 609fe240e (6.6)

      When using at the same time an interceptor on both a page and its profile, the interceptor on the page isn't called if the one on the profilemade any change to the QWebEngineUrlRequestInfo.

      Looking at the code, it seems it was an explicit decision

      if (profileInterceptor) {
          profileInterceptor->interceptRequest(requestInfo);
          pageInterceptor = getPageInterceptor(web_contents);
      }
      if (pageInterceptor && !requestInfo.changed())
          pageInterceptor->interceptRequest(requestInfo);
      

      However, this behaviour is not documented. The documentation only mention that the profile interceptor is called before, not that the page interceptor might not be called.

      This interceptor is called after any interceptors on the profile

      I would argue that page interceptors should be called regardless of what the profile interceptor does.

      This can be useful for instance, in situation when the profile interceptor is used to changed headers and the page interceptor is used to block/redirect requests.
      With the current behaviour, changing the headers in the profile interceptor will implicitely "not block" the request.

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

            davidsz Szabolcs David
            bterrier Benjamin Terrier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes