diff options
author | Michal Klocek <michal.klocek@qt.io> | 2020-09-12 17:21:10 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2020-12-11 20:50:24 +0100 |
commit | f6c4b79a31056aa83175b9ea073088063277ff6d (patch) | |
tree | 0dd3938cc8f0f4003f50f0407448840ca5345c04 /src/core/common | |
parent | 136b3b67eedd5b0a555a0fdba21b2c3598d6cf66 (diff) |
Migrate user script IPC to mojo
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>
Diffstat (limited to 'src/core/common')
-rw-r--r-- | src/core/common/qt_messages.h | 25 | ||||
-rw-r--r-- | src/core/common/user_script_data.cpp | 49 | ||||
-rw-r--r-- | src/core/common/user_script_data.h | 74 |
3 files changed, 0 insertions, 148 deletions
diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h index 43f07c9a6..211c3c3de 100644 --- a/src/core/common/qt_messages.h +++ b/src/core/common/qt_messages.h @@ -9,20 +9,6 @@ #include "content/public/common/webplugininfo.h" #include "ipc/ipc_message_macros.h" #include "ppapi/buildflags/buildflags.h" -#include "user_script_data.h" - -IPC_STRUCT_TRAITS_BEGIN(UserScriptData) - IPC_STRUCT_TRAITS_MEMBER(source) - IPC_STRUCT_TRAITS_MEMBER(url) - IPC_STRUCT_TRAITS_MEMBER(injectionPoint) - IPC_STRUCT_TRAITS_MEMBER(injectForSubframes) - IPC_STRUCT_TRAITS_MEMBER(worldId) - IPC_STRUCT_TRAITS_MEMBER(scriptId) - IPC_STRUCT_TRAITS_MEMBER(globs) - IPC_STRUCT_TRAITS_MEMBER(excludeGlobs) - IPC_STRUCT_TRAITS_MEMBER(urlPatterns) -IPC_STRUCT_TRAITS_END() - #define IPC_MESSAGE_START QtMsgStart @@ -39,17 +25,6 @@ IPC_MESSAGE_ROUTED1(RenderViewObserverQt_FetchDocumentInnerText, IPC_MESSAGE_ROUTED1(RenderViewObserverQt_SetBackgroundColor, uint32_t /* color */) -// User scripts messages -IPC_MESSAGE_ROUTED1(RenderFrameObserverHelper_AddScript, - UserScriptData /* script */) -IPC_MESSAGE_ROUTED1(RenderFrameObserverHelper_RemoveScript, - UserScriptData /* script */) -IPC_MESSAGE_ROUTED0(RenderFrameObserverHelper_ClearScripts) - -IPC_MESSAGE_CONTROL1(UserResourceController_AddScript, UserScriptData /* scriptContents */) -IPC_MESSAGE_CONTROL1(UserResourceController_RemoveScript, UserScriptData /* scriptContents */) -IPC_MESSAGE_CONTROL0(UserResourceController_ClearScripts) - // Tells the renderer whether or not a file system access has been allowed. IPC_MESSAGE_ROUTED2(QtWebEngineMsg_RequestFileSystemAccessAsyncResponse, int /* request_id */, diff --git a/src/core/common/user_script_data.cpp b/src/core/common/user_script_data.cpp deleted file mode 100644 index 6f4b8cb05..000000000 --- a/src/core/common/user_script_data.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "user_script_data.h" -#include "base/pickle.h" - -UserScriptData::UserScriptData() : injectionPoint(AfterLoad) - , injectForSubframes(false) - , worldId(1) -{ - static uint64_t idCount = 0; - scriptId = idCount++; -} diff --git a/src/core/common/user_script_data.h b/src/core/common/user_script_data.h deleted file mode 100644 index 8d98890e3..000000000 --- a/src/core/common/user_script_data.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef USER_SCRIPT_DATA_H -#define USER_SCRIPT_DATA_H - -#include <QtCore/QHash> -#include <string> -#include "ipc/ipc_message_utils.h" -#include "url/gurl.h" - -struct UserScriptData { - enum InjectionPoint { - AfterLoad, - DocumentLoadFinished, - DocumentElementCreation - }; - - UserScriptData(); - - std::string source; - GURL url; - /*InjectionPoint*/uint8_t injectionPoint; - bool injectForSubframes; - uint worldId; - uint64_t scriptId; - std::vector<std::string> globs; - std::vector<std::string> excludeGlobs; - std::vector<std::string> urlPatterns; -}; - -QT_BEGIN_NAMESPACE - -Q_DECLARE_TYPEINFO(UserScriptData, Q_MOVABLE_TYPE); - -QT_END_NAMESPACE - -#endif // USER_SCRIPT_DATA_H |