summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_adapter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Handle empty uri-list in dropped MIME dataMoss Heim2024-04-021-1/+1
| | | | | | | | | | | Previously WebContentsAdapter assumed that drag-n-drop MIME data with hasUrls() == true would also have a nonempty url list. This is not always the case. Instead, check directly if urls() is nonempty. Pick-to: 6.7 Fixes: QTBUG-123765 Change-Id: I9e2189e3f0223f98bdd8be273adb96cf063f4be3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Propagate system light/dark mode to webpagesKaloyan Chehlarski2024-02-201-0/+11
| | | | | | | | | | | | This change makes sure that Chromium is aware of any switches between light/dark mode in the system theme. This allows webpages that use the 'prefers-color-scheme' media feature query to see the system color scheme, and adapt accordingly. An example is the following page (set theme to 'OS default' in the top right): https://developer.mozilla.org/en-US/docs/Web Change-Id: Ifee20d15bbc1681c6ea2ee016f0283a6fa09fc77 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Show guest WebContents in DevTools if possibleSzabolcs David2024-02-091-1/+4
| | | | | | | | | | | | | | | | | | | Chrome's DevTools has different behavior for PDF content: - If it was opened for the PDF viewer, it closes itself when the guest view has gone (e.g. by navigating away), but it shows the inner content of the plugin. - If it was opened for another site and then navigated to the PDF plugin it won't show the inner content, but the embedding HTML of the parent and it allows navigating away from the plugin. Make our inspector match the behavior of Chrome and allow DevTools to look into the plugin. It helps debugging PDF viewer related issues. Pick-to: 6.6 6.7 Change-Id: I218d4fcf47d6b1f0101fa1d7f36758e04a1dd7b0 Reviewed-by: Anu Aliyas <anu.aliyas@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix printing from PDF pluginSzabolcs David2023-12-201-1/+2
| | | | | | | | | | | | | Update the plugin finder logic everywhere to match with Chrome. This comes with a small cleanup: collect PDF-related helper functions scattered around WebEngine in one pdf_util_qt implementation. Add auto test to catch this recurring issue earlier. Pick-to: 6.5 6.6 6.7 Task-number: QTBUG-119878 Change-Id: I03b2bd62bebf5b38afc572e0629db106d024e89d Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* Add API to override User Agent Client HintsSzabolcs David2023-12-141-1/+1
| | | | | | | | | | | Implement QWebEngineClientHints class to provide API for each user agent client hints. Task-number: QTBUG-112826 Task-number: QTBUG-112825 Change-Id: I3091d60fb363bbafc16c8e48195c1fd82e8a81bb Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Chromium 118 adaptationsAllan Sandfeld Jensen2023-12-091-7/+0
| | | | | Change-Id: I8eea99a472cc597ff9864b570c90b28b79b3751e Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Chromium 114 adaptationsAllan Sandfeld Jensen2023-12-091-3/+0
| | | | | Change-Id: I1131b2873f82d954ca47bf90bc82200d5f4cd751 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Remove TODO and FIXME from history restoration codeSzabolcs David2023-11-241-13/+1
| | | | | | | | | Granting renderer access here doesn't seems to be necessary anymore, because similar code parts were removed from Chromium due to redundancy. https://bugs.chromium.org/p/chromium/issues/detail?id=767519 Change-Id: I03606c9c559b4d46e14383172d79b221316de851 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Set RendererPreferences::can_accept_load_dropsAllan Sandfeld Jensen2023-11-011-0/+2
| | | | | | | | | The setting is duplicated, and the webpreference version will disappear in the future. Pick-to: 6.6 6.5 Change-Id: I8281d298a95b68bc7f3b421f8388a976da90baab Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* Handle initial NavigationEntriesMartin Negyokru2023-09-281-4/+22
| | | | | | | | | | | | | | | | | Chromium introduced the Initial NavigationEntry that meant to represent the initial empty document at FrameTree creation time. It is just a placeholder entry put in the list of NavigationEntries that gets replaced on the next navigation. A side effect of this is that we have an extra entry in the list before we load any page. This change also reverts the history related tests modified by 106 Adaptations that introduced this behavior. Fixes: QTBUG-117489 Pick-to: 6.5 6.6 Change-Id: I2738591b681082792544bd884f8ecec54ce9d72d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Improve QWebEngineDownloadRequest::isSavePageDownload()Szabolcs David2023-09-281-1/+1
| | | | | | | | | | | | | | | | | | | WebContentsImpl::IsSavable() decides which file formats are saveable, but it allows this only for text-based files. All other files will go around on the code path of downloading. MHTML (multipart) and PDF files are saved like this, which means they aren't marked as isSavePageDownload. Just simply set this flag if the save was requested by the user even if it was a download. This fixes the flag for saving MHTML and PDF files from context menu, and leaves the flag false when a PDF download was initiated by the button of the web UI. Pick-to: 6.6 Task-number: QTBUG-114859 Change-Id: Id65f26a96952c5a43876338ad37f40570e544f3a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove QWebEngineUrlResponseInterceptor APIMichael Brüning2023-08-241-10/+0
| | | | | | | | | | | | | | | | | It has been found to not have any real effect, therefore, we remove it again to not release a non-functional API and create false expectations in users. This reverts commits 3f5de5fab74e6c152cdf5d04f3d893feaa31790b ab21f39c6a54be331dd8a155d3374bfe790e0274 (parts) 082eef1916a86d6d5e0c751d271c7c8a1a5e457d 5e257fb57a211f95556ec387fe6f262a60cbb6fe Pick-to: 6.6 Task-number: QTBUG-61071 Change-Id: Ifb33e32128e77dfffed863a1a7501ba21796692d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Adaptations for Chromium 112Allan Sandfeld Jensen2023-07-061-1/+2
| | | | | | Pick-to: 6.6 Change-Id: I1bb84b20a080d7f615bf0795ac2d97739e99ac1d Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Adaptations for Chromium 110Allan Sandfeld Jensen2023-07-061-4/+3
| | | | | | Pick-to: 6.6 Change-Id: I56e1695ee4fc2b0e12da6580a5673df80bba8b6d Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Add QWebEnginePage::devToolsId()Benjamin Terrier2023-05-311-0/+5
| | | | | | | | [ChangeLog][WebEngineCore] Add QWebEnginePage::devToolsId() [ChangeLog][WebEngineView] Add devToolsId property Change-Id: I16e8a27d595b010239557c2a3af2d3b39976cd46 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Test for presence of local frame in runJavaScriptAllan Sandfeld Jensen2023-05-161-0/+8
| | | | | | | | | It can be missing if we are in the process of shutting down. Pick-to: 6.5 6.2 Fixes: QTBUG-113400 Change-Id: Ib494e479db08d51825c15f54354037c265ba96b0 Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* QWebEngineUrlResponseInterceptor: Implement new URL response interceptorYigit Akcay2023-03-101-0/+10
| | | | | | | | | | | | | | | | | | | | | This patch adds the QWebEngineUrlResponseInterceptor abstract class, which, when implemented, allows a user to intercept response headers and modify them in any way they like. A response interceptor can be set via QWebEngineProfile::setUrlResponseInterceptor(), QQuickWebEngineProfile::setUrlResponseInterceptor() or QWebEnginePage::setUrlResponseInterceptor(). Also, the QWebEngineUrlResponseInfo class is implemented, which contains the request and response data to be used with the response interceptor. If a response interceptor is set in the profile and page, the one in the profile takes precedence. Fixes: QTBUG-61071 Change-Id: I484d14373ff597b1d531541c066f0102bae28c72 Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* Support LTR and RTL text directions in input fieldsSzabolcs David2023-02-151-0/+14
| | | | | | | | | | Implement WebActions to temporarily change text direction directly from context menu - like Chrome does. They only work for the selected input field. Omit the "default" option since it is always grayed out in Chrome. Task-number: QTWB-67 Change-Id: I4bacbd82c6bd7261ac465eec9da3776613f98074 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Avoid -1 render-termination codesAllan Sandfeld Jensen2023-01-171-0/+5
| | | | | | | | Cover all the possible values in the translation. Pick-to: 6.5 6.4 Change-Id: Id5db3cceddd62f9f7c77ee8a2017e9c920f8b7d5 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Clean up accessibilityPeter Varga2023-01-171-16/+17
| | | | | | | | Build less when disabled. Pick-to: 6.5 Change-Id: I196073ce859216a041b3d13ea585fca749a52700 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Adaptations for 108-basedAllan Sandfeld Jensen2023-01-061-8/+4
| | | | | | | Pick-to: 6.5 Fixes: QTBUG-105147 Change-Id: I0022964903f3443cc97843c62468ab9be8ae2ed8 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Adaptations for 106-basedAllan Sandfeld Jensen2022-11-281-20/+20
| | | | | | Change-Id: I2fe91c06ce91dfaace7825a0589b56ee375479b6 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Adaptations for 104-basedAllan Sandfeld Jensen2022-11-281-3/+3
| | | | | | Change-Id: Ieb44b5c98b3342adca38916d8b77c54e8ed8e1d7 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Fix build with disabled webengine_extensionsPeter Varga2022-11-241-1/+1
| | | | | | | | | | | | | PDF viewer depends on extensions. Guard these dependencies to make able to build with disabled webengine_extensions and enabled webengine_printing_and_pdf. The PDF Viewer is not expected to work with this configuration but the build should pass and loading a PDF should result a download. Pick-to: 6.4 Change-Id: I4d75e356951c82333ec3dbcd7b6271b9305de3df Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Support navigator.userAgentDataSzabolcs David2022-10-111-0/+3
| | | | | | | | | | | | Use embedder_support component to generate user agent metadata and support this API. ContentBrowserClientQt::GetUserAgentMetadata() has been implemented only for safe-keeping, because we always override that value in RendererPreferences. Task-number: QTBUG-107260 Task-number: QTBUG-107451 Change-Id: Ibbcd8d9c1e9c2c0ebacf97f4b9d4ed1aa55dc881 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix PDF viewerAllan Sandfeld Jensen2022-08-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | It was broken after 102-based merge Submodule src/3rdparty c57592220..8496e1340: > Revert "Jumbo build mojom files" > FIXUP: Fix building with optimize_webui=false > Revert "Add remove_v8base_debug_symbols to GN" > FIXUP: Fix crashes and asserts > Add missing node modules for PDF support > [Backport] CVE-2022-2614: Use after free in Sign-In Flow > [Backport] CVE-2022-2618: Insufficient validation of untrusted input in Internals > [Backport] CVE-2022-2612: Side-channel information leakage in Keyboard input > [Backport] CVE-2022-2613: Use after free in Input > [Backport] CVE-2022-2624: Heap buffer overflow in PDF > [Backport] CVE-2022-2610: Insufficient policy enforcement in Background Fetch > [Backport] CVE-2022-2615: Insufficient policy enforcement in Cookies > [Backport] CVE-2022-2294: Heap buffer overflow in WebRTC > [Backport] CVE-2022-2478 : Use after free in PDF > Jumbo build mojom files Pick-to: 6.4 Change-Id: I4fc608c21ab8aaa508329e708446b57cccbddf76 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Adaptations for Chromium 102Allan Sandfeld Jensen2022-08-041-12/+12
| | | | | | Pick-to: 6.4 Change-Id: I7ef0ad616f2ea0fae482253335e95998aa2d360e Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Adaptations for Chromium 100Allan Sandfeld Jensen2022-08-041-13/+7
| | | | | | Pick-to: 6.4 Change-Id: I217c87657f544a2e868de7291353ff1143e20902 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Various clean-upsPeter Varga2022-06-241-0/+1
| | | | | | Pick-to: 6.4 Change-Id: I53e04a247a25149d9f29135484c0528c706de7d8 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-221-38/+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>
* Support HTML5 <datalist> elementPeter Varga2022-06-191-0/+8
| | | | | | | | | | | | | | | | | The datalist uses Chromium's autofill component to fetch and filter predefined options in the list and autocomplete the field with the selected option. Autofill component is added to build and bound to WebEngine. All the unnecessary autofill features for datalist are supposed to be disabled: payment/credit card support, password manager, save profile data, store suggestions in database etc. Custom popups for the dropdown are implemented for Widget and Quick. Scrolling in dropdown is not implemented in this change. Fixes: QTBUG-54433 Pick-to: 6.4 Change-Id: I155d02d6dbc9d88fbca4bc5f55b76c19d0ba7a9d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Quick: Add support for replacing touch handles with delegatesBalazs Egedi2022-05-041-0/+8
| | | | | | Task-number: QTBUG-85043 Change-Id: I1c87aff352e07eb309d5ba8747b9e50a191d478e Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Fix navigation to non-local URLsAllan Sandfeld Jensen2022-04-261-1/+8
| | | | | | | | | They are passed in another part of the DropItem object. Task-number: QTBUG-102192 Pick-to: 6.3 6.2 5.15 Change-Id: If52a88ce2688c25ea0edcc0d1e8f962f2cdd29dd Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
* Adaptations for Chrome 98Allan Sandfeld Jensen2022-03-291-8/+9
| | | | | Change-Id: I607604f85a111a69da77ca949dddf3399b9721b3 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Adaptations for Chrome 96Allan Sandfeld Jensen2022-03-291-17/+14
| | | | | Change-Id: I40039658762b8788a0be57bd186efab71f3e4448 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Fix printing PDF filesSzabolcs David2022-01-121-5/+16
| | | | | | | | | | | Delegate printing task down to the guest WebContents if any is present. Also update PrintWebViewHelperDelegateQt to find the plugin element properly for printing. Task-number: QTBUG-98941 Pick-to: 6.3 6.2 6.2.3 5.15 Change-Id: I81004a2275e0870a17565af527b1450472afb24b Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* Cleanup code and clang build warningsKirill Burtsev2022-01-021-2/+0
| | | | | | | | | Fix build noise as reported by clang for issues like api deprecation, unused variables, sign/unsigned mismatch and other non critical issues. Pick-to: 6.2 Change-Id: I4fba25406eea8170e3283c42e908ae86bd512e3a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Adaptations for Chromium 94Allan Sandfeld Jensen2021-12-021-7/+8
| | | | | Change-Id: I9fb8998a3a7762b0aea70993ca231f0bbf4f7761 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Adaptations for Chromium 92Allan Sandfeld Jensen2021-12-021-13/+15
| | | | | Change-Id: I1849c130ca75615802744275f6e4212a755c39b4 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Adaptations for Chromium 91Allan Sandfeld Jensen2021-12-021-6/+8
| | | | | Change-Id: Ie0236697615fd67e4f53df3dca013ce39628cc29 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Remove QWebEngineCallbackAllan Sandfeld Jensen2021-08-101-16/+5
| | | | | | | | | Was no longer used in exposed APIs Pick-to: 6.2 Fixes: QTBUG-74588 Change-Id: Iaf4943983655fc79e67df28f5cd4c4961b360579 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Adaptations for 90-basedAllan Sandfeld Jensen2021-07-081-11/+11
| | | | | | Pick-to: 6.2 Change-Id: I8402b044d8e12d75e144a00984b856f3de10bffd Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Add QPageRanges to PDF printingAllan Sandfeld Jensen2021-06-221-7/+10
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-73497 Change-Id: I0a66c4f1767c54b0bcc9f9a3b61e29c43ec20177 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Clean up header includes and friend classes in corePeter Varga2021-06-171-24/+13
| | | | | | Pick-to: 6.2 Change-Id: I394821d57a9cf379869d3611996c8394fbc6c60e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Replace testsupport's QQuickWebEngineErrorPage with isErrorPageAllan Sandfeld Jensen2021-06-061-5/+8
| | | | | | | | | | | | | | | | Merge and unify handling of loading started/finished for quick and widgets by removing separate quick's type for monitoring error page load and replace it with an isErrorPage method in WebEngineLoadRequest to indicate, that load ended with an error page being displayed. Effectively this only slightly changes when loading finished gets emitted: now the signal is just postponed until error page is finished loading after initial failure. [ChangeLog][QWebEngineQuick][WebEngineLoadingInfo] New property 'isErrorPage' which indicates that the load resulted in an error page Change-Id: I3e59dc488429d776f7c8e083b6d0489fb30a65fc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Replace FaviconManager with Chromium's Favicon ComponentPeter Varga2021-06-041-12/+16
| | | | | | Task-number: QTBUG-51184 Change-Id: Ie050cb23f2c86841a66ec384bfbcdf0713cffa7c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devAllan Sandfeld Jensen2021-05-121-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 inconsistent number of load signals and their orderKirill Burtsev2021-05-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change tries to match how chromium treats one single load. Before the pair of loadStarted/loadFinished methods for api classes was called on delegate's DidStartNavigation/DidFinishNavigation, which might be many within one single logical load. This is true for multiple usecases (like multiple redirects on load, immediate form submit on DOM load, page's subresource load, or just an error page load on failure). Tracking these methods and deciding when to emit signals based on states are error-prone and complicates logic for no benefits. Also it somewhat lies about when real load is done, which is only started and finished on outer methods DidStartLoading/DidStopLoading, which are conveniently called only once for all mentioned usecases. So, this change uses these methods to issue signals for load start/finish, and only makes exception for error page, which is needed for quick's private test support. Fixes: QTBUG-65223 Fixes: QTBUG-76802 Fixes: QTBUG-87089 Fixes: QTBUG-90342 Fixes: QTBUG-91773 Fixes: QTBUG-92063 Change-Id: I9cc99b639030fedd8cf6a9dc04d0869d6be6357d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* | Adaptations for Chromium 88Allan Sandfeld Jensen2021-04-151-4/+4
| | | | | | | | | | Change-Id: Ie66e95dbb9fbcafe961bb98d5c277f8c32d66b96 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devAllan Sandfeld Jensen2021-04-131-0/+1
|\| | | | | | | Change-Id: Ia01415e5a44b1df9ed8b3966ff3b39a414b1563c