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.
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.
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.
|For Gerrit Dashboard: QTBUG-86267|
|311814,4||Do not call deprecated profile interceptor on ui thread||5.15.1||qt/qtwebengine||Status: MERGED||+2||0|