summaryrefslogtreecommitdiffstats
path: root/src/core/renderer/user_resource_controller.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Adaptations for Chromium 86Allan Sandfeld Jensen2021-01-131-2/+2
| | | | | Change-Id: I7e0ebecdbb68cfff0b574c966f3fa80d28680e1c Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Adaptations for Chromium 85Allan Sandfeld Jensen2021-01-131-7/+3
| | | | | Change-Id: I33c1af7c431055d95e0fb540246765cce684de15 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Remove RenderViewObserverHelper from UserResourceControllerMichal Klocek2020-12-111-64/+29
| | | | | | | | | | | After site isolation we observe render frames and we do not need render view observer any longer. Remove RenderViewObserverHelper and track user script per render frame. This approach is more intuitive since we run those scripts on frames, subframes and not on render views, which can span over few frames. Change-Id: Ife02d8a4dbecc884cfdc667b1a16dfbdd866367a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Minor. Fix namespace for user resource controllerMichal Klocek2020-12-111-0/+4
| | | | | Change-Id: If9a6b2ceca41534f28ec1d87093778f16fc31ff0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix crashes in user resource controller when single processMichal Klocek2020-12-111-22/+39
| | | | | | | | | Mojo interface when running in single process was not correctly destructed, since we used user resource controller as global static object. Move user resource controller to content render client. Change-Id: I219510c9bc382545174aa5aae99ac8282a2049e6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Migrate user script IPC to mojoMichal Klocek2020-12-111-48/+62
| | | | | | | | | | | | | | | Use mojo instead of old IPC, keep current design and use two interfaces one global and one per frame for now, also use in both cases associated interface with ipc channel otherwise script can be added during the page load, which will radomly brake tests. This change moves UserDataScript to chromium since mojo binding generation did not work correctly. Use StructTraits when serializing the class. Change-Id: I7073fb831c96849e47864382188300db3c9137d9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Style cleanup in renderer/Allan Sandfeld Jensen2020-01-211-27/+20
| | | | | | | Selective application of clang-format. Change-Id: Ied39e0bcf842219b789354bd14ff8f8f18e8fb60 Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
* Support qrc protocol in @match rules of user scriptsSzabolcs David2019-09-301-1/+1
| | | | | | | | | | | Pulls in the following Chromium changes: 7ac85fb4cc6 Fix building with pulseaudio 13 7956dfb8d20 Support qrc protocol in UrlPattern 9af3b1bf632 Fix pressure of tablet events Task-number: QTBUG-76173 Change-Id: Iffc21ed6eb0a99e2b96780ce4f11629d38f8b47e Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Merge branch '5.12' into 5.13Allan Sandfeld Jensen2019-04-091-8/+3
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty src/core/renderer/user_resource_controller.cpp src/core/web_contents_adapter.cpp src/webengine/doc/src/qtwebengine-overview.qdoc Change-Id: I46be9d33b3b65d61dfa099ee72a3509afb9bd6a4
| * Run non-MainWorld DocumentCreation scripts even if JS disabledJüri Valdmann2019-04-081-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes regression, introduced by the fix for QTBUG-66011, where setting JavascriptEnabled to false stops all scripts from running instead of only MainWorld scripts (as documented). Only the DocumentCreation injection point is affected. The original change which introduced the regression consisted of moving the DocumentCreation injection point from ContentRendererClient::RunScriptsAtDocumentStart to RenderFrameObserver::DidClearWindowObject. The problem of scripts not working on view-source URLs was fixed by this move, but it turns out that the call to DidClearWindowObject happens to be conditional on Document::CanExecuteScripts and this is, of course, false if JS is disabled. Hence the regression. This new patch moves the injection point again to a task launched from RenderFrameObserver::DidCommitProvisionalLoad. DidCommitProvisionalLoad and DidClearWindowObject are both indirectly called from DocumentLoader::InstallNewDocument, however the former is called before the Document is opened and is therefore too early for script execution. As such, the execution is delayed by posting a task which, in theory, should be scheduled very soon after the normal call to DidClearWindowObject. Fixes: QTBUG-74304 Change-Id: Iac8714bcc5651c287b73181811af26996d955af5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Adaptations for Chromium 71Allan Sandfeld Jensen2019-01-281-4/+4
|/ | | | | | | 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>
* Adaptations for Chromium 68Allan Sandfeld Jensen2018-09-221-1/+1
| | | | | | Together-with: Tamas Zakor<ztamas@inf.u-szeged.hu> Change-Id: I805246b6f01cb151fff48588744408c676d87c14 Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* Adaptations for Chromium 67Allan Sandfeld Jensen2018-06-261-4/+4
| | | | | Change-Id: I13cedba56012f74651a044d6fa8f0957487bf3eb Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Use range-based for instead of Q_FOREACHJüri Valdmann2018-06-061-3/+3
| | | | | Change-Id: Ibf016b795ff98fddfa29fb5dc63924a2d2159d71 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Don't try to run user scripts if provisional load failedJüri Valdmann2018-06-051-9/+11
| | | | | | | | | Fixes DCHECK in UserResourceController::DidFinishDocumentLoad. Task-number: QTBUG-68594 Change-Id: I67128e2144420e61f8bffe080fa16a828b8202ad Reviewed-by: Szabolcs David <davidsz@inf.u-szeged.hu> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devAllan Sandfeld Jensen2018-05-181-2/+7
|\ | | | | | | Change-Id: Id171407c17533846e8efe0e586d6793a61543438
| * Fix handling of bad @match directivesSzabolcs David2018-04-271-2/+7
| | | | | | | | | | | | | | | | | | User scripts with parse errors in their @match patterns were included on all pages. Don't allow to fallback to "@include *" in this case. Task-number: QTBUG-67726 Change-Id: I8172184e79fe3e515f391bc6cc8274a624e67a19 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Run scripts from DidClearWindowObjectJüri Valdmann2018-05-161-44/+59
|/ | | | | | | Task-number: QTBUG-66011 Task-number: QTBUG-67453 Change-Id: I5feac1cdc74132718ba7a67b4653fcc6788da9e1 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fixup after adaptionsAllan Sandfeld Jensen2018-03-221-1/+1
| | | | | | | | | The last argument was removed, we are now calling a different deprecated version of the ExecuteScriptInIsolatedWorld. Change-Id: Ie3d351bfdef7ae490cc94362facc12ae96144a34 Reviewed-by: Michal Klocek <michal.klocek@qt.io> Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* Support regex format include rules in user scriptsPaul Clark2018-01-261-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | For user scripts with `@include` and `@exclude` directives in their headers, if the value starts and ends with `/` then assume it is a regular expression to be matched against a URL. This feature has been in the original greasemonkey module since 2011 and currently in webengine regex include rules are being blindly passed to the glob matcher. An alternative to this approach of leaving the bracketing slashes on the values as a kind of in-band signalling (and making the glob escaping conditional) would be to add new members to the UserScriptData struct for holding regex patterns. This commit also applies cleanly to v5.8 and every release after it. [ChangeLog][][UserScript] User script metadata parsing now supports regular expressions in @include and @exclude rules. Task-number: QTBUG-65484 Change-Id: Ie2e483419f6784f995131ffb7d2d5e91c2c55b1d Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io> Reviewed-by: Szabolcs David <davidsz@inf.u-szeged.hu> Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Adaptations for Chromium 62Allan Sandfeld Jensen2018-01-251-3/+3
| | | | | Change-Id: I49cd3c419d4dd1180144c3c07bdd9a628ab73caa Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Merge remote-tracking branch 'origin/5.9' into 5.10Allan Sandfeld Jensen2018-01-081-8/+17
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/core/api/qwebengineurlrequestjob.cpp src/core/browser_context_adapter.cpp src/core/renderer/user_resource_controller.cpp src/core/web_engine_context.cpp src/webenginewidgets/api/qwebenginepage.cpp Change-Id: I5278e5e22e1776d42975fc94d70ff8ca4f81fb9a
| * Check for null renderViewAllan Sandfeld Jensen2017-12-111-4/+10
| | | | | | | | | | | | | | | | | | | | | | It can according to documentation potentially be null, even if it might not happen in our cases. Task-number: QTBUG-63854 Change-Id: I76029c83fe32c163c2707568fe81b7590a79b4fe Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Michael Brüning <michael.bruning@qt.io> Reviewed-by: Viktor Engelmann <viktor.engelmann@qt.io>
* | Fix memory leak of UserResourceController::RenderFrameObserverHelperAllan Sandfeld Jensen2017-09-161-8/+15
| | | | | | | | | | | | | | | | Use weak pointers to make sure pending calls don't can run after it has been deleted. Change-Id: I6e808794e1d977dd9e236cf4a3a9ab4213ed7efd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Adaptations for Chromium 60Alexandru Croitor2017-09-111-33/+77
| | | | | | | | | | | | Change-Id: I536258e22c2ec143f2fd3f1cbda229e0611b6af4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | Adaptations for Chromium 59Allan Sandfeld Jensen2017-09-111-8/+8
|/ | | | | Change-Id: I472053e316bfa782d0a6fb8903f4901be12247ae Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Standardize override declarationAllan Sandfeld Jensen2017-04-211-6/+6
| | | | | | | | Update our overrides to Qt coding standard getting rid of Q_DECL_OVERRIDE and redundant virtual declarations. Change-Id: Id8b0750eb05c51fc8f50cac4000a811eebcbf918 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Simple adaptations to Chromium 55Allan Sandfeld Jensen2017-03-011-5/+6
| | | | | | | The simplest adaptations to API and build changes in Chromium 55 Change-Id: I923fa188690a04902492317807f72f006bcab9c6 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Parse metadata block in user scriptsSzabolcs David2016-07-071-0/+41
| | | | | | | | | | This allows WebEngine to build up user script objects from the metadata section of their source code. It also implements @include, @exclude and @match rules for restricting script injection to given URL patterns. Change-Id: Ic7b3023c0143643bfbf71adbfa25a8022b223fcf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix early JavaScript injectionAllan Sandfeld Jensen2016-06-011-9/+18
| | | | | | | | | | With the latest Chromium snapshot we can no longer install any javascript before a new callback called RunScriptsAtDocumentStart has been called. So we must refactor user-scripts and web-channels to install on this call instead. Change-Id: I440a0aa4b26100c650d5c678b454ea5beb6b59d2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Basic adaptation to Chromium 49Allan Sandfeld Jensen2016-03-071-4/+4
| | | | | | | | Converts types, callbacks and headers to match Chromium 49. Task-number: QTBUG-51173 Change-Id: I544ef46e187105e250fea1b48b72d2c81a906640 Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com>
* Rename UserScriptController/Host to UserResourceController/HostSzabolcs David2016-02-101-0/+262
These classes can operate user stylesheets too. Change-Id: Ia283af92e52a822b26003ff65e0e7dc391b0904d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>