summaryrefslogtreecommitdiffstats
path: root/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix compiler warnings in testsMoss Heim2024-03-191-1/+1
| | | | | | | Unused parameters Change-Id: I1c300daefc5461aa692f8624d6af7c5f9ce80464 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Let page interceptor process requests with extra headersSzabolcs David2023-11-071-1/+60
| | | | | | | | | | | | | | If a QWebEngineUrlRequestInterceptor has added extra headers to the request on profile level, later the request was not processed by the page interceptor. Relax this rule and only prevent the interception of blocked or redirected requests. Add auto test and extend documentation. Pick-to: 6.6 Task-number: QTBUG-117752 Change-Id: I503bfc256a5e874a678be64c597c74e04e7ce966 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Mark the module as free of Q_FOREACH, except where it isn'tMarc Mutz2023-08-181-0/+2
| | | | | | | | | | | | | | | | | | | The density of Q_FOREACH uses is non-negligible here, too high for this author, still unfamiliar with this module, to tackle in a short amount of time. But they're concentrated in just a few TUs, so pick a different strategy: Mark the whole module with QT_NO_FOREACH, to prevent new uses from creeping in, and whitelist the affected TUs by #undef'ing QT_NO_FOREACH locally, at the top of each file. For TUs that are part of a larger executable, this requires these files to be compiled separately, so add them to NO_PCH_SOURCES (which implies NO_UNITY_BUILD_SOURCES, too). Created QTBUG-115805 to keep track of this. Task-number: QTBUG-115805 Change-Id: I7a80b1820972687ccced24d9edd7a8f5b826556f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QIODevice for request body in QWebEngineUrlRequestInterceptorYigit Akcay2023-06-161-0/+122
| | | | | | | | | This patch implements a QIODevice subclass that gives access to the request body inside QWebEngineUrlRequestInterceptor::interceptRequest(). Fixes: QTBUG-61320 Change-Id: Ib6010dad908c65e070d63927b619eaed2347e317 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Recreate response head objects on multiple redirectMichael Brüning2022-12-131-0/+47
| | | | | | | | | | The previous response head gets moved when redirecting, which lead to dereferencing a null pointer on the next redirect. Pick-to: 6.4 5.15 Fixes: QTBUG-109357 Change-Id: Iaad1c46b8d4ca9720f1749980a9e06337ca0f3d8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Port from container::count() and length() to size() - V4Marc Mutz2022-10-111-31/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); a.k.a qt-port-to-std-compatible-api V4 with config Scope: 'Container'. Change-Id: I3e6fef8eca212da0c4f0b464545ba96183b4476f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add QWebEngineUrlRequestInfo::httpHeaders()Benjamin Terrier2022-08-231-0/+38
| | | | | | Fixes: QTBUG-105399 Change-Id: I6bc64d7f0b5e80b8645d7dbccb224262ff17c1a4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-221-27/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I869ffda1080e283f231eb0dc4477b260f2054d99 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Prove that the service worker works with otr profileMichal Klocek2022-06-071-3/+9
| | | | | | | | | Check registration installation and activation of service worker and add basic message ping pong test. Pick-to: 6.3 6.4 Change-Id: Ia446553ccbc62b45a5d6313cbbdf15108adcdd36 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix flakiness of jsServiceWorker testMichal Klocek2022-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This is an interesting issue as in the test sometimes first party url of intercepted request has "sw.js" instead of "sw.html". After deep debug of the issue the reason behind is that a service worker registration job checks the registration for given scope and the key, this in the turn will check storage in ServiceWorkerStorage::FindRegistrationForScope. Now if registration is found this will trigger service worker update checker, which fires the request check for newer version for sw.js and makes an intercepted request with sw.js as first party url. This of course brakes the test. Do not use the storage in that test, and let the service worker registration job do full "install" & "register" cycle instead of running "update" phase. As a side note , using off the record profile makes test run faster as opening the storage and closing it is costly. Pick-to: 6.3 6.2 Change-Id: If13a4fcf0014cc5c76cb8ed14e60f2e5e29c67ef Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Adaptations for Chrome 96Allan Sandfeld Jensen2022-03-291-1/+1
| | | | | Change-Id: I40039658762b8788a0be57bd186efab71f3e4448 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Stabilize tst_qwebengineurlrequestinterceptorAllan Sandfeld Jensen2021-12-181-11/+11
| | | | | | | | One of our macOS test machines has become remarkably slower recently. Pick-to: 6.3 Change-Id: I375c92f9c52054190a79d7793849f2783c98baa8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix some compiler warningsPeter Varga2021-06-101-1/+1
| | | | | | | | | | | | | - Remove deprecated Qt::AA_EnableHighDpiScaling and Qt::AA_UseHighDpiPixmaps from examples. High-DPI scaling is always enabled. - Reorder initialization of members of QWebEngineDownloadRequestPrivate. Also remove m_ prefix from public members' name. - Remove unused parameters from methods of DummyDelegate. - Add missing overrides in auto tests. Pick-to: 6.2 Change-Id: I18d6973b8bee574b37b73fbaaa8d57002ac8ba2d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add tests to the cmake buildMichal Klocek2021-05-221-19/+43
| | | | | | | | | | | | | | | | | | | | Use QT_TESTCASE_SOURCEDIR instead of TESTS_SOURCE_DIR. Introduce Test::HttpServer and Test::Util targets. Query shared data location from server. Clean up "shared" resources. Note QT_TESTCASE_SOURCEDIR must be turned into the canonical form since the user can call on windows: "cmake \path\to\foo" instead of "cmake c:\path\to\foo" which will break all file:// urls. Note this patch breaks qmake builds. Task-number: QTBUG-91760 Change-Id: Ibc1f904ac9acd375d1ff70ff80f0c533497e3f20 Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.15' into dev"Allan Sandfeld Jensen2021-05-131-1/+1
|\
| * Merge remote-tracking branch 'origin/5.15' into devAllan Sandfeld Jensen2021-05-121-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/webenginewidgets/printme/printhandler.cpp src/3rdparty src/core/api/qwebenginepage_p.h src/core/content_browser_client_qt.h src/core/web_contents_adapter_client.h src/core/web_contents_delegate_qt.cpp src/core/web_contents_delegate_qt.h src/webenginequick/api/qquickwebengineview_p_p.h tests/auto/quick/qmltests/data/tst_download.qml tests/auto/quick/qmltests/data/tst_viewSoure.qml tests/auto/widgets/loadsignals/tst_loadsignals.cpp tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp Change-Id: I9c1819ec15e13d4f8e244defe860e26274b5d4be
| | * Fix first party url for cookie filterTamas Zakor2021-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stop using SiteForCookies::RepresentativeUrl() if it is used to provide first party url because it returns a truncated URL and our API is expected to return the full url of the first party. Fixes: QTBUG-90231 Change-Id: I628f7f31bfbeaf3de976ae9af1a8fa6408b661c5 Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
* | | Remove ResourceTypeSubFrame check after website updateKirill Burtsev2021-05-111-12/+0
|/ / | | | | | | | | | | | | | | | | There are no more sub frame resources under test url, so nothing to check for firstPartyUrl and initiator. Pick-to: 5.15 Change-Id: I12ddf33ec2909d9a427a9819725d941960575612 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devAllan Sandfeld Jensen2021-02-171-0/+127
|\| | | | | | | Change-Id: Idee0142b0e33fdf8ca663f1ef1bcd8b932985043
| * Resolve installed interceptors right before interception pointKirill Burtsev2021-02-081-0/+127
| | | | | | | | | | | | | | | | | | | | | | | | Ammends a05bb73747. Since request processing is asynchronous, resolve interceptors right before actual interception point to accommodate cases where interceptor on profile or page was replaced or uninstalled before all instantiated InterceptedRequest's are processed. Effectively, this doesn't send url requests to uninstalled interceptors. Fixes: QTBUG-86286 Change-Id: Iaf55e5ef99d62b55f7304ee68a0c89a1469fd86f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devAllan Sandfeld Jensen2020-12-111-28/+58
|\| | | | | | | Change-Id: Id1a1f4ca84697ba18e2604090e3154295fe1858b
| * Set custom headers from QWebEngineUrlRequestInfo before triggering redirectKirill Burtsev2020-12-011-30/+59
| | | | | | | | | | | | Fixes: QTBUG-88861 Change-Id: I7091aca70aaf87edf0b1e67ec3fa705a59c8192c Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* | Move QWebEnginePage to coreMichal Klocek2020-11-241-1/+1
| | | | | | | | | | | | | | | | | | [ChangeLog] QWebEnginePage is in QtWebEngineCore Task-number: QTBUG-74585 Change-Id: Id326c89c868e9e7d53488bbd12cb321e1a0b79b7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | Remove deprecated url interoceptor setter from profileMichal Klocek2020-11-201-105/+34
| | | | | | | | | | | | Change-Id: I15c621da6da97b2ccdd57afdfad0d413302d3c24 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Move profile from widgets to coreMichal Klocek2020-11-201-1/+1
| | | | | | | | | | | | | | | | This just moves class to core. Task-nmuber: QTBUG-74585 Change-Id: Id046eee21043f086f5f45727bc3ce7c965695b7c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devAllan Sandfeld Jensen2020-09-141-46/+30
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty src/core/certificate_error_controller.cpp src/core/certificate_error_controller.h src/core/compositor/compositor.cpp src/core/compositor/compositor.h src/core/compositor/display_gl_output_surface.cpp src/core/content_browser_client_qt.cpp src/core/core_chromium.pri src/core/delegated_frame_host_client_qt.cpp src/core/ozone/gl_share_context_qt.h src/core/ozone/surface_factory_qt.cpp src/core/permission_manager_qt.cpp src/core/render_widget_host_view_qt.cpp src/core/render_widget_host_view_qt.h src/core/web_engine_context.cpp src/core/web_engine_settings.cpp src/core/web_event_factory.cpp tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp Change-Id: Ice14c3c350b139e800c7c7011b7cef1fc7010669
| * Chromium 81-based adaptationsAllan Sandfeld Jensen2020-09-091-1/+1
| | | | | | | | | | Change-Id: Ie422b327025da084bc8038c7a0aadee2db801f29 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
| * Merge remote-tracking branch 'origin/5.15.1' into 5.15Allan Sandfeld Jensen2020-09-071-10/+27
| |\ | | | | | | | | | Change-Id: Ieb546ccd35db06e8ad6358b11e3139a839c9b4cf
| | * Do not call deprecated profile interceptor on ui threadKirill Burtsev2020-09-011-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise unchanged intercepted request leads to second call in the same interceptor but on ui thread after io thread. Ammends a05bb73747. Fixes: QTBUG-86267 Change-Id: I4e7c662d24a58be5445f5c8b6d0bf3751f40cc05 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
| * | Make HttpServer to server resource from dirs for unhandled requestsKirill Burtsev2020-08-311-32/+2
| | | | | | | | | | | | | | | Change-Id: I2e15dff77c8f18af60a565cb74558f57c3527db8 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
| * | Simplify testing with HttpServerKirill Burtsev2020-08-311-5/+2
| |/ | | | | | | | | | | | | | | Since reply with 404 for unknown resources is a common pattern in tests, reply with it automatically for unhandled requests Change-Id: Ifd184cf474f1ec311c8654dfbacdd735e33d7c97 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* | Move qwebenginesettings to coreMichal Klocek2020-09-021-1/+1
| | | | | | | | | | | | | | | | | | Just moves qwebenginesettings to core. [ChangeLog] QWebEngineSettings is moved to QtWebEngieCore Change-Id: I7f623bce98213669a4b844f3377aa13e7f3dbd96 Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* | Use QList instead of QVectorJarek Kobus2020-07-151-2/+2
|/ | | | | | Task-number: QTBUG-84469 Change-Id: I666a060351f73783e15e3f96884c9393a5cd7e46 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add test for first party urls of service workerTamas Zakor2020-05-261-0/+88
| | | | | Change-Id: Ic26d982ef9695705a9f7c757b7d983824b31a070 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Move request interceptor to ui threadMichal Klocek2020-04-201-27/+96
| | | | | | | | | | | | | We use now network service avoid io-ui-io-ui hops, pipe proxying url loader factory directly to ui thread. This solves thread safty issues. Add deprecated request interceptor test cases. Task-number: QTBUG-83082 Task-number: QTBUG-82999 Change-Id: I38778cf1a70789c5e92e04c93d1c93e2cc4c765a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Allan Sandfeld Jensen2020-02-191-10/+10
|\ | | | | | | | | | | | | | | | | Blacklisted one test requiring an update of qt5.git. Conflicts: .qmake.conf Change-Id: I75e55a1c5f8840cde55ddb60d632287b2affadeb
| * Fix tst_QWebEngineUrlRequestInterceptor::initiator flakinessJüri Valdmann2020-02-181-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | The test assumes a 1-1 correspondence between request URLs and initiator origins, but really we have a 1-N correspondence since the same URL can be requested multiple times by different initiator origins. The current flakiness results from just such a conflict, namely from one URL being requested both by the main site (w3schools.com) and by AdSense (doubleclick.net). Fixes: QTBUG-82288 Change-Id: Ida121d8f23b396b72a28faab91780d6fa4d99c92 Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
* | Experimental network-service supportAllan Sandfeld Jensen2019-12-051-0/+8
|/ | | | | | | | | | | | | | | | | | | | | | Is default off, enable with --enable-network-service. Done: * Basic browsing * Basic profile settings * Custom URL schemes * UI-thread interceptors * CookieStore API * CookieStore filters * CookieStore changed events Missing: * deprecated interceptors * complete profile settings * cleanup of system network-context * proxy settings Change-Id: I6af92da40147b968a938d1263df54c4cfe7bcf6d Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* Add QWebEngineUrlRequestInfo::initiator()Tamas Zakor2019-06-051-0/+69
| | | | | | | | | | Returns the origin url of the document which initiated the navigation when a frame navigates another frame. Task-number: QTBUG-75759 Change-Id: Ia2884b5a3027cceea45f0e659652b02036faaacb Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge remote-tracking branch 'origin/5.12' into 5.13Allan Sandfeld Jensen2019-05-241-0/+43
|\ | | | | | | | | | | | | | | | | Conflicts: src/3rdparty src/core/net/network_delegate_qt.cpp tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp Change-Id: Ib715b3047213583e0441b915d3cabb801d9d4ba8
| * Referrer HTTP Header no longer ignored when set via RequestInterceptorLeander Beernaert2019-05-201-0/+43
| | | | | | | | | | | | | | | | | | | | | | Make sure the HTTP referer is properly placed on a request when it's set via the QWebEngineUrlRequestInterceptor. Added test case to catch future incidents. Fixes: QTBUG-60203 Change-Id: Ida2f713a7352c3199fc9f8e15b5d8350d50afdda Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Move QWebEngineUrlRequestInterceptor::intercept to ui threadMichal Klocek2019-02-041-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently interceptor sufferers thread safety issues, when custom profiles are deleted, interceptor is set to be nullptr, however it can be still referenced in IO thread. Since profile was split to ui and io part, where io part can outlive the ui part, this can boost thread safety issues. Since QWebEngineUrlRequestInterceptor is living on ui thread simplify the logic move intercept call to ui thread. This fixes the issue of referencing interceptor in io thread. Add new method to install interceptor setUrlRequestInterceptor, and deprecate old one. Update interceptor install method name on page to match the profile one. Task-number: QTBUG-69844 Change-Id: I5dd2b6b734fd91906cccc6c1408ffbe7b1b4250c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Adaptations for Chromium 71Allan Sandfeld Jensen2019-01-281-4/+1
| | | | | | | | | | | | | | Change-Id: Ib650113b05dfd4771240804f94e33c07aa317bf2 Reviewed-by: Michael Brüning <michael.bruning@qt.io> Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devMichael Brüning2019-01-181-13/+231
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/core/net/network_delegate_qt.cpp src/core/profile_io_data_qt.cpp src/core/web_engine_context.h tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp Change-Id: Id98e3f52f548ceb5b68abd80aedd6ae59db72cc0
| * Fix QWebEngineUrlRequestInfo::firstPartyUrl() after 69-basedTamas Zakor2019-01-031-13/+231
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The issue was introduced by this Chromium change: https://chromium-review.googlesource.com/c/chromium/src/+/1025772/ Add new auto tests for first party url. Depends on Chromium change: d2f5d6869f Add net::URLRequest::first_party_url() Task-number: QTBUG-70790 Change-Id: Ib43bde69990e7fb1d495cc32ac2f6860a613f185 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Add setRequestInterceptor to QWebEnginePageAllan Sandfeld Jensen2018-10-171-3/+28
|/ | | | | | | | | | | | Makes it possible to make page specific intercepts, and is at the same time safer by running in the UI-thread. [ChangeLog][QtWebEngineWidgets][QWebEnginePage] Added setRequestInterceptor, similar to the same call on profile except it operates on a per-page basis and on the UI-thread. Change-Id: Id5a7173156c25d0f030f00b6ef314d283c7c8cdd Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* Test adaptations for Chromium 63Allan Sandfeld Jensen2018-01-251-0/+6
| | | | | Change-Id: I19bf693fb3916a78f4a199e6e095ca58b8fdfa27 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Cleanup core API testsAllan Sandfeld Jensen2018-01-081-25/+29
| | | | | | | | Use in-memory profile and do not use qwebengineviews when all we need are qwebenginepages. Change-Id: I5798c761bccfc0b4bf2cf623e7db35f033bdfd84 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Auto test adaptations for Chromium 58Allan Sandfeld Jensen2017-06-141-5/+4
| | | | | | | | Adjustments to auto tests to pass with Chromium 58 Change-Id: I7f6905e5344c528c608734bc660cbf43c89d4a63 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port autotests from own waitForSignal() to QSignalSpy::wait()David Faure2016-11-291-8/+8
| | | | | | | | I added QSignalSpy::wait() in Qt 5.0 exactly for this purpose. Change-Id: I895a92f5f7e4e8554e00f6668e6973cc2c903adf Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>