summaryrefslogtreecommitdiffstats
path: root/src/core/renderer/web_channel_ipc_transport.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Get rid of TODOs in WebChannel GIN codeAllan Sandfeld Jensen2021-10-141-14/+9
| | | | | | | | | The nodiscard values can be Check()ed. Pick-to: 6.2 Change-Id: I9ee38ca3404c4013c6cda6d3d0833529c2b59105 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
* Fix WebChannel when JavaScript is disabledSzabolcs David2021-09-271-8/+8
| | | | | | | | | | | | | WebChannel was not working in ApplicationWorld with JavaScript disabled in MainWorld, because WebChannelIPCTransport::DidClearWindowObject() is called only when the window object was cleared in the main world. Moving the WebChannelTransport installation logic to DidCreateScriptContext() works in other worlds, so fixes the problem. Task-number: QTBUG-88875 Pick-to: 6.2 Change-Id: Ia75613b66a1e049f617f0664684b153b6875e9de Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove IPC message loggingPeter Varga2021-07-211-2/+0
| | | | | | | | | Doesn't seem to be useful, chromium community doesn't maintain it anymore. Pick-to: 6.2 Change-Id: I24071d6319c258f2d88f3bde5c38dd9fddeec9a8 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Merge branch '5.15' into devAllan Sandfeld Jensen2021-01-191-6/+14
|\ | | | | | | | | | | Last commits before 87 update. Change-Id: Id156b0199a8fd354c946cfe604ae8541ba554658
| * Cache mojo interface bindings for WebChannelIPCTransportMichal Klocek2020-12-111-6/+15
| | | | | | | | | | Change-Id: Ica6b794e16aecc60dc2c39d31750acc6b25410df Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Switch from binary JSON to JSON for QWebChannel messagesJüri Valdmann2020-07-231-20/+9
|/ | | | | | | | | | | Qt's binary JSON has been deprecated in favor of CBOR. However, since we have to convert to/from JSON anyway in order to pass messages to/from Chromium, there's not much point to use a binary intermediate format in the first place. So, let's just use JSON. Fixes: QTBUG-85688 Change-Id: I9c3e4608bee38d460eaf87843c339d5037ed9888 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Adaptations for Chromium 79Allan Sandfeld Jensen2020-02-281-5/+5
| | | | | | | | Fixes: QTBUG-80737 Fixes: QTBUG-81556 Fixes: QTBUG-81614 Change-Id: Ie6a69cdbf46d0508bff226f1b8fed28a618e1949 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Style cleanup in renderer/Allan Sandfeld Jensen2020-01-211-21/+20
| | | | | | | Selective application of clang-format. Change-Id: Ied39e0bcf842219b789354bd14ff8f8f18e8fb60 Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
* Adaptations for Chromium 77Allan Sandfeld Jensen2019-10-111-18/+21
| | | | | | Fixes: QTBUG-77267 Change-Id: I181e24cf80ebee6991b95dde6c636f0d169b40a4 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Adaptations for Chromium 76Allan Sandfeld Jensen2019-10-111-2/+2
| | | | | Change-Id: Id6d18a3854b572334dc1d65f1916b8991a740cd2 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* Implement page lifecycle APIJüri Valdmann2019-05-241-1/+3
| | | | | | | | | | | | | | | | | [ChangeLog][QtWebEngine][WebEngineView] WebEngineView now supports lifecycle states that can be used for reducing CPU and memory consumption of invisible views. [ChangeLog][QtWebEngineWidgets][QWebEnginePage] QWebEnginePage now supports lifecycle states that can be used for reducing CPU and memory consumption of invisible pages. Fixes: QTBUG-74166 Fixes: QTBUG-55079 Change-Id: I7d70c85dc995bd17c9fe91385a8e2750dbc0a627 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Adaptations for Chromium 73Allan Sandfeld Jensen2019-03-231-1/+3
| | | | | Change-Id: I565d1e327852110a5abebed3388d7cd6986bef06 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Adaptations for Chromium 71Allan Sandfeld Jensen2019-01-281-4/+6
| | | | | | | 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>
* Migrate WebChannel IPC to mojoMichal Klocek2018-07-191-24/+38
| | | | | | | | | | | | | | Mojoifies: * WebChannelIPCTransport_SetWorldId * WebChannelIPCTransport_Message * WebChannelIPCTransportHost_SendMessage This change is just the simple rewrite of IPC in web channel transport, however ultimate goal here is to use mojo directly in javascript land. Change-Id: Ifcf84659b1d48d99cc4e87849b8a258303e8fedc Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Adaptations for Chromium 67Allan Sandfeld Jensen2018-06-261-2/+2
| | | | | Change-Id: I13cedba56012f74651a044d6fa8f0957487bf3eb Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Replace invalid characters in WebChannel messagesJüri Valdmann2018-05-161-15/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | Turns out JavaScript's JSON.stringify is not guaranteed to produce valid UTF-16 strings. It is possible in JavaScript to produce string objects which contain invalid code units (unmatched surrogate pairs) and JSON.stringify will simply copy this data to it's output. However, such a string cannot be losslessly converted to UTF-8 and this leads to fun errors in WebChannelIPCTransport. This patch - Adds a test for the scenario above. - Changes WebChannelIPCTransport to replace these invalid code units with the Unicode replacement character U+FFFD. - Changes WebChannelIPCTransportHost to validate the data it gets from the renderer. Not validating the data defeats the whole point of Chromium's fancy multi-process architecture: the renderer is not to be trusted. - Changes WebChannelIPCTransport to throw JavaScript exceptions for various errors (missing argument, wrong type, invalid JSON). Seems like the polite thing to do. Task-number: QTBUG-61969 Change-Id: I83275a0eaed77109dc458b80e27217108dde9f7b Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Make WebChannelIPCTransport into a RenderFrameObserverJüri Valdmann2018-03-221-121/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of version 63, Chromium creates proxy frames also for the main frame in the frame tree during cross-process navigations. This leads to a segmentation fault in WebChannelIPCTransport because we assume that all main frames are local. See https://crrev.com/27caae83cb530daaf49f9a38793e427cdf493a65 for details. This patch refactors the renderer-side WebChannelIPCTransport from a RenderViewObserver into a RenderFrameObserver, which prevents the segmentation fault since the RenderFrameObserver is not created for proxy frames. Most likely this would have to be done eventually anyway since the RenderView and RenderViewObserver classes are deprecated and will likely be removed as part of the Site Isolation project. Installation is changed to follow Chromium's RenderFrameImpl in the sense of performing the installation from RenderFrameObserver::DidClearWindowObject instead of ContentRendererClient::RunScriptsAtDocumentStart. This has the benefit of avoiding the ScriptForbiddenScope DCHECK. Additionally there are the following minor changes: - The deprecated parameterless version of v8::Value::ToObject() method is replaced with v8::Value::IsObject() check and v8::Local::Cast. - The deprecated v8::Handle typedef is replaced with v8::Local. - The deprecated single-parameter WebContentsObserver::OnMessageReceived is replaced with the new two-parameter version. - blink::MainThreadIsolate() is used instead of v8::Isolate::GetCurrent() for Install/Uninstall since we know we are executing on the main thread. - WebChannelIPCTransportHost is changed to ignore messages from unexpected renderers in case something goes wrong with the renderers. - Logging is added to WebChannelIPCTransportHost for debugging purposes. Some new unit tests are added, all of which fail with the old version. Task-number: QTBUG-66333 Change-Id: I936d142fb042d9f936a3f9d08d4328ecba595f1f Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devAllan Sandfeld Jensen2017-11-291-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: src/core/web_event_factory.cpp src/core/web_event_factory.h src/webengine/render_widget_host_view_qt_delegate_quick.h Change-Id: Ic43787e2689c81b501ed395a990190eb67d83a2b
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-11-151-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty tests/auto/quick/qmltests/qmltests.pro tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp Change-Id: I2a1e3a83e29a1d6709f3e98fda3f7b4ab7ab297e
| | * Fix invalid Q_ASSERT in WebChannelIPCTransportJüri Valdmann2017-11-101-1/+1
| | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-64419 Change-Id: I094cfc654498c74f4d6b656ec5647a90700a4f6a Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devAllan Sandfeld Jensen2017-10-271-4/+4
|\| | | | | | | | | | | Change-Id: Ibc1c881a67bf088ba6fb044e2553c74c7e9e24ca
| * | Adaptations to 61-basedAllan Sandfeld Jensen2017-10-251-4/+4
| | | | | | | | | | | | | | | Change-Id: I5cb198445f283c6cea8187a1a2883896df0ee918 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* | | Merge branch '5.10' into devAllan Sandfeld Jensen2017-10-131-1/+1
|\| | | | | | | | | | | Change-Id: I3a411e4019a5ec2f7d1a967b62a00ad7cf92f6f4
| * | Merge remote-tracking branch 'origin/5.9' into 5.10Allan Sandfeld Jensen2017-09-291-1/+1
| |\| | | | | | | | | | Change-Id: I7094e85a7770303a2ae30baccbc484c04f33600e
| | * Add LICENSE.ChromiumKai Koehne2017-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The mentioned LICENSE file is not available; add it under the name LICENSE.Chromium. Task-number: QTBUG-60006 Change-Id: Ib2b3cb64467046c7ba1f53b0bbe14c3ec5a5291d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | | Replace Q_DECL_OVERRIDE with overrideKevin Funk2017-09-211-1/+1
|/ / | | | | | | | | Change-Id: I5fb337a83bfc98c23b2f3cd51839feb40fad010e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Adaptations for Chromium 60Alexandru Croitor2017-09-111-0/+5
| | | | | | | | | | | | 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-12/+12
| | | | | | | | | | Change-Id: I472053e316bfa782d0a6fb8903f4901be12247ae Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Do not send empty WebChannelIPCTransportHost_SendMessageStephan Reiter2017-07-191-4/+9
| | | | | | | | | | | | Task-number: QTBUG-61969 Change-Id: I3367889041614a5e7489909dd38c8af638edf17c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Adaptations for Chromium 57Allan Sandfeld Jensen2017-06-141-3/+3
|/ | | | | Change-Id: Ia2756c1e9b13839c2330bd98cf953d47cbdac0dd Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Fix compilation warning in corePeter Varga2016-11-141-3/+6
| | | | | | | | Replace deprecated v8::Object::ForceSet by v8::Object::DefineOwnProperty as it is suggested by the V8 API. Change-Id: I8c49999d391149676daf42784b796fa01918874f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix crash when trying to execute script on a detached RenderFramePeter Varga2016-11-081-2/+1
| | | | | | Task-number: QTBUG-56661 Change-Id: I546222dde64c54955c62d2c30df79d4773b9973c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge remote-tracking branch 'origin/5.7' into devAllan Sandfeld Jensen2016-06-201-6/+6
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty src/core/permission_manager_qt.cpp src/core/renderer/web_channel_ipc_transport.cpp src/core/renderer/web_channel_ipc_transport.h Change-Id: I25fd8ed7c433dadce44d8ac1e39f86e211ec25f0
| * Fix the IPC webChannelTransport not being available on reloadJocelyn Turcotte2016-06-131-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | The gin JavaScript binging gets destroyed on page reload after all references to it disappear from the previous document. Do like other gin wrapper and reinstall the transport binding on DidCreateDocumentElement, following how it's done by the MojoBindingsController. Task-number: QTBUG-53411 Change-Id: Ibcd9ef9dbedc5762d4f2210fd81f68e5b9127680 Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* | Fix early JavaScript injectionAllan Sandfeld Jensen2016-06-011-0/+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>
* 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>
* Add API to set WebChannel on isolated worldAllan Sandfeld Jensen2016-01-151-8/+44
| | | | | | | | | | | Make it possible to set a web-channel so that it can only be accessed by private scripts. Pulls in needed API extension in 3rdparty. Task-number: QTBUG-50318 Change-Id: I61bcce5c318dffe0a406ee8cddf31f58a021c22c Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* Switch WebChannel's IPC transport to ginAllan Sandfeld Jensen2016-01-071-42/+56
| | | | | | | | | Chromium has ported all their old V8 extensions to gin, this does the same for our extension. This should make it faster as it requires no parsing of JavaScript on startup. Change-Id: I1f791e71cafb9b60dd9787ae03a18e723dfef6b9 Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com>
* Add namespace to internal QtWebEngine APIAllan Sandfeld Jensen2015-03-021-0/+4
| | | | | | | | 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>
* WebChannel: don't mess with the navigator objectPierre Rossi2015-02-191-12/+12
| | | | | | | | | | | | | The navigator object is actually exposed later on from WebCore using a different mechanism, so the V8 extension approach won't work with it. Better take the chrome extensions approach and expose our own. This should "un-break" the part of the web that was broken by eee482929a. Change-Id: I991be2e12bb9ebcf60ace02721497c3fcd923c7f Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-161-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: Ieb6bac7a1be5c25eb7cb917495b58b6a870ca6d4 Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com>
* Integrate with WebChannelPierre Rossi2015-02-121-0/+175
Provide a transport mechanism for WebChannel over chromium IPC and expose WebChannel in our experimental QML API. Co-authored by Milian Wolff. Change-Id: Ia24b1d4ebc8515de677d4849ec33cb55c963918e Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>