summaryrefslogtreecommitdiffstats
path: root/src/core/user_script.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '5.15' into devAllan Sandfeld Jensen2021-01-191-3/+3
|\ | | | | | | | | | | Last commits before 87 update. Change-Id: Id156b0199a8fd354c946cfe604ae8541ba554658
| * Migrate user script IPC to mojoMichal Klocek2020-12-111-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Cleanup qwebenginescript and qwebenginescriptcollection apiMichal Klocek2020-09-281-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch cleans up script and collection apis: * do not allocate user_script on heap, there is no need for that. * remove isNull(), which was used by collection.findScript(name) * remove collection.size(), there is already collection.count() * remove collection.findScript(name), user can use findScripts(name) which returns list of scripts or empty list if not found * collection.findScripts(name) is simply collection.find(name) [ChangeLog] Removed QWebEngineScriptCollection::findScript(name), use QWebEngineScriptCollection::find(name) instead. Change-Id: Iecf8f1d7c26275b9ce3a1ea97cf4bd74b17f681e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Introduce qml script collection and make webscript as basic typeMichal Klocek2020-09-221-0/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In widget apis webenginescripts are value types and are managed by webenginescriptcollection. Introduce same concept in qml and make qquickwebenginescript a value type and reuse core userscript as private implementation. Rewrite webenginscript list handling. This patch is half baked since it does not include docs and tests for new api, however aim is to move script classes to core and reuse those in qml land. Therefore, new class introduced here is going to be removed in follow up patches, so all the missing parts will be added later. A new way of managing scripts in qml is as follows: * using collection with javascript dictionaries var script = { name: "FOO" sourceUrl: Qt.resolvedUrl("foo.js"), injectionPoint: WebEngineScript.DocumentReady } webEngineView.userScripts.collection = [ script1, script2 ]; * using collection with webscript basic type var script = WebEngine.script() script.name = "FOO" webEngineView.userScripts.collection = [ script ]; * using fine grain user script collection api with basic type var script = WebEngine.script() script.name = "FOO" webEngineView.userScripts.insert(script) Of course new api can be extended and we can provide more convince overloads. Note the main motivation here is to enable reuse webenginescript object created in c++ land, which is now passed as value in follow up patches. This changes reuses private apis of qml and will most likely require further changes when QTBUG-82443 is completed. [ChangeLog] WebEngineScript is a basic value type in qml, it is no longer declarative way of creating it, instead use WebEngine.script() Change-Id: I6a0ac3607e4522ccaefcec0a7d2986577d7e7024 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Switch export macros to standard formAllan Sandfeld Jensen2019-04-011-1/+1
| | | | | | | | | | Qt expects the export macros to have Q_ prefixes, otherwise the symbol versioning script won't find them and mark them. Task-number: QTBUG-74752 Change-Id: I1e057802f6715d170bdd9074f281e73fb96c9e52 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Clean-up of forward declarations and includes in core headersTamas Zakor2018-08-231-1/+0
| | | | | | Change-Id: Icf0508baf0884afe7591b35e13733b17c9fdfe90 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Update export symbols for webenginecore moduleMichal Klocek2018-06-151-2/+13
| | | | | | | | | | | Use own WEBENGINECORE_EXPORT define, mark most headers private and use WEBENGINECORE_PRIVATE_EXPORT for it. For sanity, add "WARNING" as for private headers even though they are never installed. Change-Id: I523d28c1d00217f48bc63dabf138dd3a7eb482d4 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Fix handling of bad @match directivesSzabolcs David2018-04-271-2/+0
| | | | | | | | | 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>
* Parse metadata block in user scriptsSzabolcs David2016-07-071-0/+3
| | | | | | | | | | 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>
* Rename UserScriptController/Host to UserResourceController/HostSzabolcs David2016-02-101-2/+2
| | | | | | | These classes can operate user stylesheets too. Change-Id: Ia283af92e52a822b26003ff65e0e7dc391b0904d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
* Unify license header usage.Jani Heikkinen2016-02-011-11/+14
| | | | | | | | | Update files using old header.LGPL3 to use header.LGPL Update files using old header.FLD to use new header.FDL Update files using old header.BSD to use new header.BSD Change-Id: I36a67aaa8c3ca6c7946308defc9c03c3571a7d23 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Keep order of scripts added to QWebEngineScriptCollectionKai Koehne2015-10-081-4/+0
| | | | | | | | | Use a QList instead of a QSet to store the scripts in the collection. This avoids situations where two scripts injected depend on each other, and fail or succeed depending on the semi-random order that QSet imposes. Change-Id: I44d5d89866ff2431544cc91afb1c102d93daa5da Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
* UserScript: Rename source property to sourceCode.Robin Burchell2015-03-121-2/+2
| | | | | | | | | The name 'source' is unclear, and doesn't match current conventions in QtQuick (e.g. Image::source). Furthermore, such a property inhibits adding convenience API to fetch a user script from an external URI. Change-Id: I518b3963f64f0986f9e2d08fe7c5f69122372e0c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
* Add namespace to internal QtWebEngine APIAllan Sandfeld Jensen2015-03-021-2/+9
| | | | | | | | Adds the QtWebEngineCore namespace to all internal core API. This ensures we don't export any internal symbols in the global namespace. Change-Id: I26af888ea7c6c4c4d0f04c24a377c1a9d3c92751 Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
* Introduce a user scripts mechanismPierre Rossi2015-02-211-0/+93
Allowing programmatic injection of JavaScript to accomplish all sorts of tasks on the render process side. This API gives control over the point during the loading phase at which the script is run, whether it is run on sub-frames or not, as well as the JavaScript world it is run in (either the page's main world, or an arbitrary isolated world). This only has the Widgets API. The Quick API, tests and docs are coming in separate patches Change-Id: Ia1c79f68f8dfd4d964281d9723d09062ed7abe46 Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>