diff --git a/config.tests/winversion/winversion.cpp b/config.tests/winversion/winversion.cpp index 3a7b6721258560e8cba49d1564e7f717dce352a0..32748e02cbc4da274a060d0ad6d9734b6949cb39 100644 --- a/config.tests/winversion/winversion.cpp +++ b/config.tests/winversion/winversion.cpp @@ -26,8 +26,8 @@ ** ****************************************************************************/ -#if !defined(_MSC_FULL_VER) || _MSC_FULL_VER < 190024213 -#error VS 2015 Update 3 with Cumulative Servicing Release or higher is required +#if !defined(__clang__) && _MSC_FULL_VER < 191125507 +#error VS 2017 Update 3.2 or higher is required #endif int main(int, char **) diff --git a/mkspecs/features/platform.prf b/mkspecs/features/platform.prf index bb171f75315d9b3d11a802922e6be00218487975..7f6cc2e3eed8cb0d161e262090589a667c17d762 100644 --- a/mkspecs/features/platform.prf +++ b/mkspecs/features/platform.prf @@ -34,7 +34,7 @@ defineTest(isPlatformSupported) { return(false) } !qtConfig(webengine-winversion) { - skipBuild("Needs VS 2015 Update 3 with Cumulative Servicing Release or higher") + skipBuild("Needs VS 2017 Update 3.2 with Cumulative Servicing Release or higher") return(false) } } else:osx { @@ -88,11 +88,9 @@ defineTest(isArchSupported) { } defineTest(isGCCVersionSupported) { - # The below will work for gcc 4.7 and up and also match gcc 5 - greaterThan(QT_GCC_MINOR_VERSION, 6):return(true) greaterThan(QT_GCC_MAJOR_VERSION, 4):return(true) - skipBuild("Using gcc version "$$QT_GCC_MAJOR_VERSION"."$$QT_GCC_MINOR_VERSION", but at least gcc version 4.7 is required to build Qt WebEngine.") + skipBuild("Using gcc version "$$QT_GCC_MAJOR_VERSION"."$$QT_GCC_MINOR_VERSION", but at least gcc version 5 is required to build Qt WebEngine.") return(false) } diff --git a/src/3rdparty b/src/3rdparty index f0775ea93ab66f0676993db1633c9098dfb3a3ad..3fa04d22883e42bd987e4f83d394a1040b410024 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit f0775ea93ab66f0676993db1633c9098dfb3a3ad +Subproject commit 3fa04d22883e42bd987e4f83d394a1040b410024 diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro index 0fea312f4aab1f6781cfd9150daeff867d59b359..3763fb391262ec22ba8d56e92433068cea342ba3 100644 --- a/src/core/api/core_api.pro +++ b/src/core/api/core_api.pro @@ -3,7 +3,7 @@ DESTDIR = $$OUT_PWD/$$getConfigDir() TEMPLATE = lib -CONFIG += staticlib c++11 +CONFIG += staticlib c++14 QT += network core-private QT_PRIVATE += webenginecoreheaders-private diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index e31951307250c3cafc5b1f989bbefad7d4ffb450..8441fdad514f1738c3092ba3dc9c4d3442d77600 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -214,8 +214,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Section; case ui::AX_ROLE_BLOCKQUOTE: return QAccessible::Section; - case ui::AX_ROLE_BUSY_INDICATOR: - return QAccessible::NoRole; // This is unused and planned to be removed. case ui::AX_ROLE_BUTTON: return QAccessible::Button; case ui::AX_ROLE_BUTTON_DROP_DOWN: @@ -297,8 +295,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Graphic; case ui::AX_ROLE_IMAGE_MAP: return QAccessible::Graphic; - case ui::AX_ROLE_IMAGE_MAP_LINK: - return QAccessible::Link; case ui::AX_ROLE_INLINE_TEXT_BOX: return QAccessible::EditableText; case ui::AX_ROLE_INPUT_TIME: @@ -355,8 +351,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Section; case ui::AX_ROLE_NOTE: return QAccessible::Note; - case ui::AX_ROLE_OUTLINE: - return QAccessible::Tree; case ui::AX_ROLE_PANE: return QAccessible::Pane; case ui::AX_ROLE_PARAGRAPH: @@ -381,14 +375,8 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::RowHeader; case ui::AX_ROLE_RUBY: return QAccessible::StaticText; - case ui::AX_ROLE_RULER: - return QAccessible::NoRole; // FIXME - case ui::AX_ROLE_SCROLL_AREA: - return QAccessible::Client; // FIXME case ui::AX_ROLE_SCROLL_BAR: return QAccessible::ScrollBar; - case ui::AX_ROLE_SEAMLESS_WEB_AREA: - return QAccessible::NoRole; // FIXME case ui::AX_ROLE_SEARCH: return QAccessible::Section; case ui::AX_ROLE_SEARCH_BOX: @@ -417,8 +405,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Section; case ui::AX_ROLE_TAB: return QAccessible::PageTab; - case ui::AX_ROLE_TAB_GROUP: // blink doesn't use (uses ROLE_TAB_LIST) - return QAccessible::NoRole; // FIXME case ui::AX_ROLE_TAB_LIST: return QAccessible::PageTabList; case ui::AX_ROLE_TAB_PANEL: @@ -456,8 +442,6 @@ QAccessible::State BrowserAccessibilityQt::state() const { QAccessible::State state = QAccessible::State(); int32_t s = GetState(); - if (s & (1 << ui::AX_STATE_BUSY)) - state.busy = true; if (s & (1 << ui::AX_STATE_COLLAPSED)) state.collapsed = true; if (s & (1 << ui::AX_STATE_DEFAULT)) @@ -478,8 +462,6 @@ QAccessible::State BrowserAccessibilityQt::state() const state.linked = true; if (s & (1 << ui::AX_STATE_MULTISELECTABLE)) state.multiSelectable = true; - if (s & (1 << ui::AX_STATE_OFFSCREEN)) - state.offscreen = true; if (s & (1 << ui::AX_STATE_PROTECTED)) {} // FIXME if (s & (1 << ui::AX_STATE_REQUIRED)) @@ -495,8 +477,12 @@ QAccessible::State BrowserAccessibilityQt::state() const if (s & (1 << ui::AX_STATE_VISITED)) {} // FIXME + if (IsOffscreen()) + state.offscreen = true; if (manager()->GetFocus() == this) state.focused = true; + if (GetBoolAttribute(ui::AX_ATTR_BUSY)) + state.busy = true; if (HasIntAttribute(ui::AX_ATTR_CHECKED_STATE)) { ui::AXCheckedState checkedState = (ui::AXCheckedState)GetIntAttribute(ui::AX_ATTR_CHECKED_STATE); switch (checkedState) { diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp index 8b8fbf69e63d03eaf3e49389e048139303b0bd08..af8655b839cfe5606e5de0a5324810107b70f1b7 100644 --- a/src/core/browser_context_qt.cpp +++ b/src/core/browser_context_qt.cpp @@ -177,6 +177,11 @@ std::unique_ptr<content::ZoomLevelDelegate> BrowserContextQt::CreateZoomLevelDel return nullptr; } +content::BackgroundFetchDelegate* BrowserContextQt::GetBackgroundFetchDelegate() +{ + return nullptr; +} + content::BackgroundSyncController* BrowserContextQt::GetBackgroundSyncController() { return nullptr; diff --git a/src/core/browser_context_qt.h b/src/core/browser_context_qt.h index e7002c0123ec63304d799f29654c3f8056410630..58bc75d5b8be1c2cc9ab5b83440199eb07daa9cb 100644 --- a/src/core/browser_context_qt.h +++ b/src/core/browser_context_qt.h @@ -90,6 +90,7 @@ public: content::URLRequestInterceptorScopedVector request_interceptors) override; std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(const base::FilePath& partition_path) override; content::PermissionManager *GetPermissionManager() override; + content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override; content::BackgroundSyncController* GetBackgroundSyncController() override; content::BrowsingDataRemoverDelegate *GetBrowsingDataRemoverDelegate() override; diff --git a/src/core/browser_message_filter_qt.cpp b/src/core/browser_message_filter_qt.cpp index 13d74df72115d8da54a53eb727f414fd4f7f9095..5248c2a736dc185fdd094dd72b36db824b47539f 100644 --- a/src/core/browser_message_filter_qt.cpp +++ b/src/core/browser_message_filter_qt.cpp @@ -58,7 +58,7 @@ BrowserMessageFilterQt::BrowserMessageFilterQt(int /*render_process_id*/) bool BrowserMessageFilterQt::OnMessageReceived(const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(BrowserMessageFilterQt, message) -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) IPC_MESSAGE_HANDLER( QtWebEngineHostMsg_IsInternalPluginAvailableForMimeType, OnIsInternalPluginAvailableForMimeType) @@ -68,7 +68,7 @@ bool BrowserMessageFilterQt::OnMessageReceived(const IPC::Message& message) return true; } -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) void BrowserMessageFilterQt::OnIsInternalPluginAvailableForMimeType( const std::string& mime_type, bool* is_available, std::vector<base::string16>* additional_param_names, @@ -93,6 +93,6 @@ void BrowserMessageFilterQt::OnIsInternalPluginAvailableForMimeType( *is_available = false; } -#endif // BUILDFLAG(ENABLE_PEPPER_CDMS) +#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) } // namespace QtWebEngineCore diff --git a/src/core/browser_message_filter_qt.h b/src/core/browser_message_filter_qt.h index 054625c96293ec7d5ca333c0c77a6bc3e729be4b..175319805ca2fcf7a18be962d6976505bc693335 100644 --- a/src/core/browser_message_filter_qt.h +++ b/src/core/browser_message_filter_qt.h @@ -41,7 +41,7 @@ #define BROWSER_MESSAGE_FILTER_QT_H #include "content/public/browser/browser_message_filter.h" -#include "ppapi/features/features.h" +#include "media/media_features.h" namespace QtWebEngineCore { @@ -52,7 +52,7 @@ public: private: bool OnMessageReceived(const IPC::Message& message) override; -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) // Returns whether any internal plugin supporting |mime_type| is registered // and enabled. Does not determine whether the plugin can actually be // instantiated (e.g. whether it has all its dependencies). diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 152c4db634b311bcade8a2b988ad776c37f01039..cff975e61a7e1a65bf8147b94105da1451be073b 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -223,7 +223,7 @@ void ClipboardQt::WriteObjects(ui::ClipboardType type, const ObjectMap& objects) if (text_iter != objects.end()) { // Copy text and SourceTag to the selection clipboard. ObjectMap::const_iterator next_iter = text_iter; - WriteObjects(ui::CLIPBOARD_TYPE_SELECTION, ObjectMap(text_iter, ++next_iter)); + WriteObjects(ui::CLIPBOARD_TYPE_SELECTION, ObjectMap(text_iter, ++next_iter, base::KEEP_FIRST_OF_DUPES)); } } } diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h index fae80186ba6e4d5065e3d1d1b95757aa2141cfac..3bedb10d217f667e84d7791770fc17fd6b4eef3b 100644 --- a/src/core/common/qt_messages.h +++ b/src/core/common/qt_messages.h @@ -4,6 +4,7 @@ // Multiply-included file, no traditional include guard. +#include "media/media_features.h" #include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #include "ppapi/features/features.h" @@ -73,7 +74,7 @@ IPC_MESSAGE_ROUTED1(WebChannelIPCTransportHost_SendMessage, std::vector<char> /* // Misc messages // These are messages sent from the renderer to the browser process. -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) // Returns whether any internal plugin supporting |mime_type| is registered and // enabled. Does not determine whether the plugin can actually be instantiated // (e.g. whether it has all its dependencies). diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index 6f7b27f103a7614f4c83515a321383dc8b1a860b..cdb723b7962f7bad62a834f9587f366d29714760 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -8,9 +8,7 @@ gn_args += \ use_gio=false \ use_gnome_keyring=false \ use_kerberos=false \ - linux_use_bundled_binutils=false \ - use_nss_certs=true \ - use_openssl_certs=false + linux_use_bundled_binutils=false gcc:!clang: greaterThan(QT_GCC_MAJOR_VERSION, 5): gn_args += no_delete_null_pointer_checks=true @@ -95,7 +93,6 @@ host_build { gn_args += host_cpu=\"$$GN_HOST_CPU\" # Don't bother trying to use system libraries in this case gn_args += use_glib=false - gn_args += use_system_libffi=false } else { gn_args += custom_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:target\" gn_args += host_toolchain=\"$$QTWEBENGINE_OUT_ROOT/src/toolchain:host\" @@ -136,8 +133,6 @@ host_build { } else { gn_args += use_alsa=false } - packagesExist(libffi): gn_args += use_system_libffi=true - else: gn_args += use_system_libffi=false !packagesExist(libpci): gn_args += use_libpci=false !packagesExist(xscrnsaver): gn_args += use_xscrnsaver=false diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 5689a4fb8d360ccee344b5539ffd32c596ea3e9b..446764f19ae027e136b876fc397eb59635e7d83f 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -50,6 +50,7 @@ #endif #endif #include "content/browser/renderer_host/render_view_host_delegate.h" +#include "content/common/url_schemes.h" #include "content/public/browser/browser_main_parts.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/client_certificate_delegate.h" @@ -72,7 +73,7 @@ #include "net/ssl/client_cert_identity.h" #include "services/service_manager/public/cpp/bind_source_info.h" #include "services/service_manager/public/cpp/binder_registry.h" -#include "third_party/WebKit/public/platform/modules/sensitive_input_visibility/sensitive_input_visibility_service.mojom.h" +#include "third_party/WebKit/public/platform/modules/insecure_input/insecure_input_service.mojom.h" #include "ui/base/ui_base_switches.h" #include "ui/display/screen.h" #include "ui/gl/gl_context.h" @@ -358,6 +359,14 @@ public: { return nullptr; } + const gl::ExtensionSet& GetExtensions() override + { + static const gl::ExtensionSet s_emptySet; + return s_emptySet; + } + void ResetExtensions() override + { + } private: void *m_handle; @@ -380,7 +389,7 @@ void ShareGroupQtQuick::AboutToAddFirstContext() if (!shareContext) { qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function."); } - m_shareContextQtQuick = make_scoped_refptr(new QtShareGLContext(shareContext)); + m_shareContextQtQuick = new QtShareGLContext(shareContext); #endif } @@ -413,7 +422,7 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost* const int id = host->GetID(); content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme(id, url::kFileScheme); static_cast<BrowserContextQt*>(host->GetBrowserContext())->m_adapter->userResourceController()->renderProcessStartedWithHost(host); -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) host->AddFilter(new BrowserMessageFilterQt(id)); #endif #if defined(Q_OS_MACOS) && BUILDFLAG(ENABLE_SPELLCHECK) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) @@ -464,18 +473,17 @@ void ContentBrowserClientQt::GetQuotaSettings(content::BrowserContext* context, } void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webContents, - int cert_error, - const net::SSLInfo& ssl_info, - const GURL& request_url, - content::ResourceType resource_type, - bool overridable, - bool strict_enforcement, - bool expired_previous_decision, - const base::Callback<void(content::CertificateRequestResultType)>& callback) + int cert_error, + const net::SSLInfo &ssl_info, + const GURL &request_url, + content::ResourceType resource_type, + bool strict_enforcement, + bool expired_previous_decision, + const base::Callback<void(content::CertificateRequestResultType)> &callback) { WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate()); - QSharedPointer<CertificateErrorController> errorController(new CertificateErrorController(new CertificateErrorControllerPrivate(cert_error, ssl_info, request_url, resource_type, overridable, strict_enforcement, callback))); + QSharedPointer<CertificateErrorController> errorController(new CertificateErrorController(new CertificateErrorControllerPrivate(cert_error, ssl_info, request_url, resource_type, strict_enforcement, strict_enforcement, callback))); contentsDelegate->allowCertificateError(errorController); } @@ -506,13 +514,19 @@ void ContentBrowserClientQt::AppendExtraCommandLineSwitches(base::CommandLine* c command_line->AppendSwitchASCII(switches::kLang, GetApplicationLocale()); } +void ContentBrowserClientQt::GetAdditionalWebUISchemes(std::vector<std::string>* additional_schemes) +{ + additional_schemes->push_back(content::kChromeDevToolsScheme); +} + void ContentBrowserClientQt::GetAdditionalViewSourceSchemes(std::vector<std::string>* additional_schemes) { + GetAdditionalWebUISchemes(additional_schemes); additional_schemes->push_back(kQrcSchemeQt); } #if defined(Q_OS_LINUX) -void ContentBrowserClientQt::GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::FileDescriptorInfo* mappings) +void ContentBrowserClientQt::GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::PosixFileDescriptorInfo* mappings) { const std::string &locale = GetApplicationLocale(); const base::FilePath &locale_file_path = ui::ResourceBundle::GetSharedInstance().GetLocaleFilePath(locale, true); @@ -542,7 +556,7 @@ content::DevToolsManagerDelegate* ContentBrowserClientQt::GetDevToolsManagerDele // This is a really complicated way of doing absolutely nothing, but Mojo demands it: class ServiceDriver - : public blink::mojom::SensitiveInputVisibilityService + : public blink::mojom::InsecureInputService , public content::WebContentsUserData<ServiceDriver> { public: @@ -561,38 +575,38 @@ public: return nullptr; return FromWebContents(web_contents); } - static void BindSensitiveInputVisibilityService(blink::mojom::SensitiveInputVisibilityServiceRequest request, - content::RenderFrameHost* render_frame_host) + static void BindInsecureInputService(blink::mojom::InsecureInputServiceRequest request, content::RenderFrameHost *render_frame_host) { CreateForRenderFrameHost(render_frame_host); ServiceDriver *driver = FromRenderFrameHost(render_frame_host); if (driver) - driver->BindSensitiveInputVisibilityServiceRequest(std::move(request)); + driver->BindInsecureInputServiceRequest(std::move(request)); } - void BindSensitiveInputVisibilityServiceRequest(blink::mojom::SensitiveInputVisibilityServiceRequest request) + void BindInsecureInputServiceRequest(blink::mojom::InsecureInputServiceRequest request) { - m_sensitiveInputVisibilityBindings.AddBinding(this, std::move(request)); + m_insecureInputServiceBindings.AddBinding(this, std::move(request)); } - // blink::mojom::SensitiveInputVisibility: + // blink::mojom::InsecureInputService: void PasswordFieldVisibleInInsecureContext() override { } void AllPasswordFieldsInInsecureContextInvisible() override { } + void DidEditFieldInInsecureContext() override + { } private: explicit ServiceDriver(content::WebContents* /*web_contents*/) { } friend class content::WebContentsUserData<ServiceDriver>; - mojo::BindingSet<blink::mojom::SensitiveInputVisibilityService> m_sensitiveInputVisibilityBindings; - + mojo::BindingSet<blink::mojom::InsecureInputService> m_insecureInputServiceBindings; }; void ContentBrowserClientQt::InitFrameInterfaces() { m_frameInterfaces = base::MakeUnique<service_manager::BinderRegistry>(); m_frameInterfacesParameterized = base::MakeUnique<service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>>(); - m_frameInterfacesParameterized->AddInterface(base::Bind(&ServiceDriver::BindSensitiveInputVisibilityService)); + m_frameInterfacesParameterized->AddInterface(base::Bind(&ServiceDriver::BindInsecureInputService)); } void ContentBrowserClientQt::BindInterfaceRequestFromFrame(content::RenderFrameHost* render_frame_host, diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index db5cbd1913c794a30904ec5cb8ee9fcff4095657..094ad65490937afb25e3d7cacc3de82176950adf 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -95,15 +95,14 @@ public: content::StoragePartition *partition, storage::OptionalQuotaSettingsCallback callback) override; void OverrideWebkitPrefs(content::RenderViewHost *, content::WebPreferences *) override; - void AllowCertificateError(content::WebContents* web_contents, - int cert_error, - const net::SSLInfo& ssl_info, - const GURL& request_url, - content::ResourceType resource_type, - bool overridable, - bool strict_enforcement, - bool expired_previous_decision, - const base::Callback<void(content::CertificateRequestResultType)>& callback) override; + void AllowCertificateError(content::WebContents *web_contents, + int cert_error, + const net::SSLInfo &ssl_info, + const GURL &request_url, + content::ResourceType resource_type, + bool strict_enforcement, + bool expired_previous_decision, + const base::Callback<void(content::CertificateRequestResultType)> &callback) override; void SelectClientCertificate(content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, net::ClientCertIdentityList client_certs, @@ -114,6 +113,7 @@ public: std::string GetAcceptLangs(content::BrowserContext* context) override; void AppendExtraCommandLineSwitches(base::CommandLine* command_line, int child_process_id) override; void GetAdditionalViewSourceSchemes(std::vector<std::string>* additional_schemes) override; + void GetAdditionalWebUISchemes(std::vector<std::string>* additional_schemes) override; void BindInterfaceRequestFromFrame(content::RenderFrameHost* render_frame_host, const std::string& interface_name, @@ -153,7 +153,7 @@ public: const net::CookieOptions& options) override; #if defined(Q_OS_LINUX) - void GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::FileDescriptorInfo* mappings) override; + void GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::PosixFileDescriptorInfo* mappings) override; #endif #if BUILDFLAG(ENABLE_PLUGINS) diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index a3a460cb4b6759458e42e232457109849f13b31b..66c63b1b8942f6472fd63c563e56380fdc432713 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -202,7 +202,7 @@ void AddPepperFlashFromCommandLine(std::vector<content::PepperPluginInfo>* plugi void AddPepperWidevine(std::vector<content::PepperPluginInfo>* plugins) { -#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS) && !defined(WIDEVINE_CDM_IS_COMPONENT) +#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) && !defined(WIDEVINE_CDM_IS_COMPONENT) QStringList pluginPaths; const base::CommandLine::StringType widevine_argument = base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(switches::kPpapiWidevinePath); if (!widevine_argument.empty()) diff --git a/src/core/cookie_monster_delegate_qt.cpp b/src/core/cookie_monster_delegate_qt.cpp index 58cd481dcfcdaf337285d4364deb17004387c4d2..abc386204fa5d7a2a03b0a0ecb7ca02e6cfdf51c 100644 --- a/src/core/cookie_monster_delegate_qt.cpp +++ b/src/core/cookie_monster_delegate_qt.cpp @@ -86,6 +86,17 @@ CookieMonsterDelegateQt::~CookieMonsterDelegateQt() } +void CookieMonsterDelegateQt::AddStore(net::CookieStore *store) +{ + std::unique_ptr<net::CookieStore::CookieChangedSubscription> sub = + store->AddCallbackForAllChanges( + base::Bind(&CookieMonsterDelegateQt::OnCookieChanged, + // this object's destruction will deregister the subscription. + base::Unretained(this))); + + m_subscriptions.push_back(std::move(sub)); +} + bool CookieMonsterDelegateQt::hasCookieMonster() { return m_cookieMonster; @@ -184,9 +195,13 @@ void CookieMonsterDelegateQt::DeleteAllOnIOThread(net::CookieMonster::DeleteCall void CookieMonsterDelegateQt::setCookieMonster(net::CookieMonster* monster) { - if (!monster && !m_cookieMonster) + if (monster == m_cookieMonster) return; + m_subscriptions.clear(); + if (monster) + AddStore(monster); + m_cookieMonster = monster; if (!m_client) @@ -227,11 +242,11 @@ bool CookieMonsterDelegateQt::canGetCookies(const QUrl &firstPartyUrl, const QUr return m_client->d_func()->canAccessCookies(firstPartyUrl, url); } -void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie& cookie, bool removed, net::CookieStore::ChangeCause cause) +void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie& cookie, net::CookieStore::ChangeCause cause) { if (!m_client) return; - m_client->d_func()->onCookieChanged(toQt(cookie), removed); + m_client->d_func()->onCookieChanged(toQt(cookie), cause != net::CookieStore::ChangeCause::INSERTED); } } diff --git a/src/core/cookie_monster_delegate_qt.h b/src/core/cookie_monster_delegate_qt.h index 941992a7b79f642a16cc30f411fc125596124235..8aceca9c995b17330ff8ae7562011ab6797146b8 100644 --- a/src/core/cookie_monster_delegate_qt.h +++ b/src/core/cookie_monster_delegate_qt.h @@ -64,9 +64,10 @@ namespace QtWebEngineCore { static const char* const kCookieableSchemes[] = { "http", "https", "qrc", "ws", "wss" }; -class QWEBENGINE_EXPORT CookieMonsterDelegateQt: public net::CookieMonsterDelegate { +class QWEBENGINE_EXPORT CookieMonsterDelegateQt : public base::RefCountedThreadSafe<CookieMonsterDelegateQt> { QPointer<QWebEngineCookieStore> m_client; net::CookieMonster *m_cookieMonster; + std::vector<std::unique_ptr<net::CookieStore::CookieChangedSubscription>> m_subscriptions; public: CookieMonsterDelegateQt(); ~CookieMonsterDelegateQt(); @@ -84,7 +85,9 @@ public: bool canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url); bool canGetCookies(const QUrl &firstPartyUrl, const QUrl &url); - void OnCookieChanged(const net::CanonicalCookie& cookie, bool removed, net::CookieStore::ChangeCause cause) override; + + void AddStore(net::CookieStore *store); + void OnCookieChanged(const net::CanonicalCookie &cookie, net::CookieStore::ChangeCause cause); private: void GetAllCookiesOnIOThread(net::CookieMonster::GetCookieListCallback callback); diff --git a/src/core/core_project.pro b/src/core/core_project.pro index c046ce1ff5886893e25be39dffbc8bb83fb53fdd..2d2bef60df991a84c06b30a9772c4fb8c882d702 100644 --- a/src/core/core_project.pro +++ b/src/core/core_project.pro @@ -11,6 +11,7 @@ linking_pri = $$OUT_PWD/$$getConfigDir()/$${TARGET}.pri CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir() INCLUDEPATH += $$CHROMIUM_SRC_DIR \ + $$CHROMIUM_SRC_DIR/third_party/WebKit/Source \ $$OUT_PWD/$$getConfigDir()/gen SOURCES += $$NINJA_SOURCES diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp index de39300c9d26be57da3fc1aac3f67a355fbd35c6..149bd3b5edb621bf87d371ceb15422786b81ad95 100644 --- a/src/core/delegated_frame_node.cpp +++ b/src/core/delegated_frame_node.cpp @@ -58,19 +58,19 @@ #include "base/message_loop/message_loop.h" #include "base/threading/thread_task_runner_handle.h" #include "cc/base/math_util.h" -#include "cc/output/bsp_tree.h" -#include "cc/output/compositor_frame.h" -#include "cc/output/compositor_frame_metadata.h" -#include "cc/quads/debug_border_draw_quad.h" -#include "cc/quads/draw_quad.h" -#include "cc/quads/render_pass_draw_quad.h" -#include "cc/quads/solid_color_draw_quad.h" -#include "cc/quads/stream_video_draw_quad.h" -#include "cc/quads/texture_draw_quad.h" -#include "cc/quads/tile_draw_quad.h" -#include "cc/quads/yuv_video_draw_quad.h" -#include "cc/resources/returned_resource.h" -#include "cc/resources/transferable_resource.h" +#include "components/viz/common/quads/compositor_frame.h" +#include "components/viz/common/quads/compositor_frame_metadata.h" +#include "components/viz/common/quads/debug_border_draw_quad.h" +#include "components/viz/common/quads/draw_quad.h" +#include "components/viz/common/quads/render_pass_draw_quad.h" +#include "components/viz/common/quads/solid_color_draw_quad.h" +#include "components/viz/common/quads/stream_video_draw_quad.h" +#include "components/viz/common/quads/texture_draw_quad.h" +#include "components/viz/common/quads/tile_draw_quad.h" +#include "components/viz/common/quads/yuv_video_draw_quad.h" +#include "components/viz/common/resources/returned_resource.h" +#include "components/viz/common/resources/transferable_resource.h" +#include "components/viz/service/display/bsp_tree.h" #include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" #include "gpu/command_buffer/service/mailbox_manager.h" #include "ui/gl/gl_context.h" @@ -151,17 +151,17 @@ private: #endif // QT_NO_OPENGL class ResourceHolder { public: - ResourceHolder(const cc::TransferableResource &resource); + ResourceHolder(const viz::TransferableResource &resource); QSharedPointer<QSGTexture> initTexture(bool quadIsAllOpaque, RenderWidgetHostViewQtDelegate *apiDelegate = 0); QSGTexture *texture() const { return m_texture.data(); } - cc::TransferableResource &transferableResource() { return m_resource; } - cc::ReturnedResource returnResource(); + viz::TransferableResource &transferableResource() { return m_resource; } + viz::ReturnedResource returnResource(); void incImportCount() { ++m_importCount; } bool needsToFetch() const { return !m_resource.is_software && m_texture && !m_texture.data()->textureId(); } private: QWeakPointer<QSGTexture> m_texture; - cc::TransferableResource m_resource; + viz::TransferableResource m_resource; int m_importCount; }; @@ -449,7 +449,7 @@ static QSGNode *buildRenderPassChain(QSGNode *chainParent) return zCompressNode; } -static QSGNode *buildLayerChain(QSGNode *chainParent, const cc::SharedQuadState *layerState) +static QSGNode *buildLayerChain(QSGNode *chainParent, const viz::SharedQuadState *layerState) { QSGNode *layerChain = chainParent; if (layerState->is_clipped) { @@ -634,7 +634,7 @@ void MailboxTexture::fetchTexture(gpu::gles2::MailboxManager *mailboxManager) } #endif //QT_NO_OPENGL -ResourceHolder::ResourceHolder(const cc::TransferableResource &resource) +ResourceHolder::ResourceHolder(const viz::TransferableResource &resource) : m_resource(resource) , m_importCount(1) { @@ -671,9 +671,9 @@ QSharedPointer<QSGTexture> ResourceHolder::initTexture(bool quadNeedsBlending, R return texture; } -cc::ReturnedResource ResourceHolder::returnResource() +viz::ReturnedResource ResourceHolder::returnResource() { - cc::ReturnedResource returned; + viz::ReturnedResource returned; // The ResourceProvider ensures that the resource isn't used by the parent compositor's GL // context in the GPU process by inserting a sync point to be waited for by the child // compositor's GL context. We don't need this since we are triggering the delegated frame @@ -751,22 +751,22 @@ void DelegatedFrameNode::preprocess() } } -static YUVVideoMaterial::ColorSpace toQt(cc::YUVVideoDrawQuad::ColorSpace color_space) +static YUVVideoMaterial::ColorSpace toQt(viz::YUVVideoDrawQuad::ColorSpace color_space) { switch (color_space) { - case cc::YUVVideoDrawQuad::REC_601: + case viz::YUVVideoDrawQuad::REC_601: return YUVVideoMaterial::REC_601; - case cc::YUVVideoDrawQuad::REC_709: + case viz::YUVVideoDrawQuad::REC_709: return YUVVideoMaterial::REC_709; - case cc::YUVVideoDrawQuad::JPEG: + case viz::YUVVideoDrawQuad::JPEG: return YUVVideoMaterial::JPEG; } Q_UNREACHABLE(); return YUVVideoMaterial::REC_601; } -static bool areSharedQuadStatesEqual(const cc::SharedQuadState *layerState, - const cc::SharedQuadState *prevLayerState) +static bool areSharedQuadStatesEqual(const viz::SharedQuadState *layerState, + const viz::SharedQuadState *prevLayerState) { if (layerState->is_clipped != prevLayerState->is_clipped || layerState->clip_rect != prevLayerState->clip_rect) @@ -779,8 +779,8 @@ static bool areSharedQuadStatesEqual(const cc::SharedQuadState *layerState, // Compares if the frame data that we got from the Chromium Compositor is // *structurally* equivalent to the one of the previous frame. // If it is, we will just reuse and update the old nodes where necessary. -static bool areRenderPassStructuresEqual(cc::CompositorFrame *frameData, - cc::CompositorFrame *previousFrameData) +static bool areRenderPassStructuresEqual(viz::CompositorFrame *frameData, + viz::CompositorFrame *previousFrameData) { if (!previousFrameData) return false; @@ -789,8 +789,8 @@ static bool areRenderPassStructuresEqual(cc::CompositorFrame *frameData, return false; for (unsigned i = 0; i < frameData->render_pass_list.size(); ++i) { - cc::RenderPass *newPass = frameData->render_pass_list.at(i).get(); - cc::RenderPass *prevPass = previousFrameData->render_pass_list.at(i).get(); + viz::RenderPass *newPass = frameData->render_pass_list.at(i).get(); + viz::RenderPass *prevPass = previousFrameData->render_pass_list.at(i).get(); if (newPass->id != prevPass->id) return false; @@ -798,22 +798,22 @@ static bool areRenderPassStructuresEqual(cc::CompositorFrame *frameData, if (newPass->quad_list.size() != prevPass->quad_list.size()) return false; - cc::QuadList::ConstBackToFrontIterator it = newPass->quad_list.BackToFrontBegin(); - cc::QuadList::ConstBackToFrontIterator end = newPass->quad_list.BackToFrontEnd(); - cc::QuadList::ConstBackToFrontIterator prevIt = prevPass->quad_list.BackToFrontBegin(); - cc::QuadList::ConstBackToFrontIterator prevEnd = prevPass->quad_list.BackToFrontEnd(); + viz::QuadList::ConstBackToFrontIterator it = newPass->quad_list.BackToFrontBegin(); + viz::QuadList::ConstBackToFrontIterator end = newPass->quad_list.BackToFrontEnd(); + viz::QuadList::ConstBackToFrontIterator prevIt = prevPass->quad_list.BackToFrontBegin(); + viz::QuadList::ConstBackToFrontIterator prevEnd = prevPass->quad_list.BackToFrontEnd(); for (; it != end && prevIt != prevEnd; ++it, ++prevIt) { - const cc::DrawQuad *quad = *it; - const cc::DrawQuad *prevQuad = *prevIt; + const viz::DrawQuad *quad = *it; + const viz::DrawQuad *prevQuad = *prevIt; if (!areSharedQuadStatesEqual(quad->shared_quad_state, prevQuad->shared_quad_state)) return false; if (quad->material != prevQuad->material) return false; #ifndef QT_NO_OPENGL - if (quad->material == cc::DrawQuad::YUV_VIDEO_CONTENT) + if (quad->material == viz::DrawQuad::YUV_VIDEO_CONTENT) return false; #ifdef GL_OES_EGL_image_external - if (quad->material == cc::DrawQuad::STREAM_VIDEO_CONTENT) + if (quad->material == viz::DrawQuad::STREAM_VIDEO_CONTENT) return false; #endif // GL_OES_EGL_image_external #endif // QT_NO_OPENGL @@ -824,11 +824,11 @@ static bool areRenderPassStructuresEqual(cc::CompositorFrame *frameData, } void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, - std::vector<cc::ReturnedResource> *resourcesToRelease, + std::vector<viz::ReturnedResource> *resourcesToRelease, RenderWidgetHostViewQtDelegate *apiDelegate) { m_chromiumCompositorData = chromiumCompositorData; - cc::CompositorFrame* frameData = &m_chromiumCompositorData->frameData; + viz::CompositorFrame* frameData = &m_chromiumCompositorData->frameData; if (frameData->render_pass_list.empty()) return; @@ -849,7 +849,7 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, // candidates to be picked up by quads, it's then our responsibility to return unused resources // to the producing child compositor. for (unsigned i = 0; i < frameData->resource_list.size(); ++i) { - const cc::TransferableResource &res = frameData->resource_list.at(i); + const viz::TransferableResource &res = frameData->resource_list.at(i); if (QSharedPointer<ResourceHolder> resource = resourceCandidates.value(res.id)) resource->incImportCount(); else @@ -873,7 +873,7 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, m_sceneGraphNodes.empty() || viewportSize != m_previousViewportSize; - m_chromiumCompositorData->previousFrameData = cc::CompositorFrame(); + m_chromiumCompositorData->previousFrameData = viz::CompositorFrame(); SGObjects previousSGObjects; QVector<QSharedPointer<QSGTexture> > textureStrongRefs; if (buildNewTree) { @@ -897,11 +897,11 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, // parent, with the last one in the list being the root RenderPass, the one // that we displayed to the user. // All RenderPasses except the last one are rendered to an FBO. - cc::RenderPass *rootRenderPass = frameData->render_pass_list.back().get(); + viz::RenderPass *rootRenderPass = frameData->render_pass_list.back().get(); gfx::Rect viewportRect(toGfx(viewportSize)); for (unsigned i = 0; i < frameData->render_pass_list.size(); ++i) { - cc::RenderPass *pass = frameData->render_pass_list.at(i).get(); + viz::RenderPass *pass = frameData->render_pass_list.at(i).get(); QSGNode *renderPassParent = 0; gfx::Rect scissorRect; @@ -944,16 +944,16 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, if (buildNewTree) renderPassChain = buildRenderPassChain(renderPassParent); - std::deque<std::unique_ptr<cc::DrawPolygon>> polygonQueue; + base::circular_deque<std::unique_ptr<viz::DrawPolygon>> polygonQueue; int nextPolygonId = 0; int currentSortingContextId = 0; - const cc::SharedQuadState *currentLayerState = nullptr; + const viz::SharedQuadState *currentLayerState = nullptr; QSGNode *currentLayerChain = nullptr; const auto quadListBegin = pass->quad_list.BackToFrontBegin(); const auto quadListEnd = pass->quad_list.BackToFrontEnd(); for (auto it = quadListBegin; it != quadListEnd; ++it) { - const cc::DrawQuad *quad = *it; - const cc::SharedQuadState *quadState = quad->shared_quad_state; + const viz::DrawQuad *quad = *it; + const viz::SharedQuadState *quadState = quad->shared_quad_state; gfx::Rect targetRect = cc::MathUtil::MapEnclosingClippedRect(quadState->quad_to_target_transform, @@ -973,8 +973,8 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, } if (currentSortingContextId != 0) { - std::unique_ptr<cc::DrawPolygon> polygon( - new cc::DrawPolygon( + std::unique_ptr<viz::DrawPolygon> polygon( + new viz::DrawPolygon( quad, gfx::RectF(quad->visible_rect), quadState->quad_to_target_transform, @@ -1008,7 +1008,7 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, } void DelegatedFrameNode::flushPolygons( - std::deque<std::unique_ptr<cc::DrawPolygon>> *polygonQueue, + base::circular_deque<std::unique_ptr<viz::DrawPolygon>> *polygonQueue, QSGNode *renderPassChain, DelegatedNodeTreeHandler *nodeHandler, QHash<unsigned, QSharedPointer<ResourceHolder> > &resourceCandidates, @@ -1017,9 +1017,9 @@ void DelegatedFrameNode::flushPolygons( if (polygonQueue->empty()) return; - const auto actionHandler = [&](cc::DrawPolygon *polygon) { - const cc::DrawQuad *quad = polygon->original_ref(); - const cc::SharedQuadState *quadState = quad->shared_quad_state; + const auto actionHandler = [&](viz::DrawPolygon *polygon) { + const viz::DrawQuad *quad = polygon->original_ref(); + const viz::SharedQuadState *quadState = quad->shared_quad_state; QSGNode *currentLayerChain = nullptr; if (renderPassChain) @@ -1034,17 +1034,17 @@ void DelegatedFrameNode::flushPolygons( nodeHandler, resourceCandidates, apiDelegate); }; - cc::BspTree(polygonQueue).TraverseWithActionHandler(&actionHandler); + viz::BspTree(polygonQueue).TraverseWithActionHandler(&actionHandler); } void DelegatedFrameNode::handlePolygon( - const cc::DrawPolygon *polygon, + const viz::DrawPolygon *polygon, QSGNode *currentLayerChain, DelegatedNodeTreeHandler *nodeHandler, QHash<unsigned, QSharedPointer<ResourceHolder> > &resourceCandidates, RenderWidgetHostViewQtDelegate *apiDelegate) { - const cc::DrawQuad *quad = polygon->original_ref(); + const viz::DrawQuad *quad = polygon->original_ref(); if (!polygon->is_split()) { handleQuad(quad, currentLayerChain, @@ -1059,7 +1059,7 @@ void DelegatedFrameNode::handlePolygon( } void DelegatedFrameNode::handleClippedQuad( - const cc::DrawQuad *quad, + const viz::DrawQuad *quad, const gfx::QuadF &clipRegion, QSGNode *currentLayerChain, DelegatedNodeTreeHandler *nodeHandler, @@ -1085,15 +1085,15 @@ void DelegatedFrameNode::handleClippedQuad( } void DelegatedFrameNode::handleQuad( - const cc::DrawQuad *quad, + const viz::DrawQuad *quad, QSGNode *currentLayerChain, DelegatedNodeTreeHandler *nodeHandler, QHash<unsigned, QSharedPointer<ResourceHolder> > &resourceCandidates, RenderWidgetHostViewQtDelegate *apiDelegate) { switch (quad->material) { - case cc::DrawQuad::RENDER_PASS: { - const cc::RenderPassDrawQuad *renderPassQuad = cc::RenderPassDrawQuad::MaterialCast(quad); + case viz::DrawQuad::RENDER_PASS: { + const viz::RenderPassDrawQuad *renderPassQuad = viz::RenderPassDrawQuad::MaterialCast(quad); QSGTexture *layer = findRenderPassLayer(renderPassQuad->render_pass_id, m_sgObjects.renderPassLayers).data(); @@ -1101,8 +1101,8 @@ void DelegatedFrameNode::handleQuad( nodeHandler->setupRenderPassNode(layer, toQt(quad->rect), currentLayerChain); break; } - case cc::DrawQuad::TEXTURE_CONTENT: { - const cc::TextureDrawQuad *tquad = cc::TextureDrawQuad::MaterialCast(quad); + case viz::DrawQuad::TEXTURE_CONTENT: { + const viz::TextureDrawQuad *tquad = viz::TextureDrawQuad::MaterialCast(quad); ResourceHolder *resource = findAndHoldResource(tquad->resource_id(), resourceCandidates); QSGTexture *texture = initAndHoldTexture(resource, quad->ShouldDrawWithBlending(), apiDelegate); @@ -1121,8 +1121,8 @@ void DelegatedFrameNode::handleQuad( currentLayerChain); break; } - case cc::DrawQuad::SOLID_COLOR: { - const cc::SolidColorDrawQuad *scquad = cc::SolidColorDrawQuad::MaterialCast(quad); + case viz::DrawQuad::SOLID_COLOR: { + const viz::SolidColorDrawQuad *scquad = viz::SolidColorDrawQuad::MaterialCast(quad); // Qt only supports MSAA and this flag shouldn't be needed. // If we ever want to use QSGRectangleNode::setAntialiasing for this we should // try to see if we can do something similar for tile quads first. @@ -1131,8 +1131,8 @@ void DelegatedFrameNode::handleQuad( break; #ifndef QT_NO_OPENGL } - case cc::DrawQuad::DEBUG_BORDER: { - const cc::DebugBorderDrawQuad *dbquad = cc::DebugBorderDrawQuad::MaterialCast(quad); + case viz::DrawQuad::DEBUG_BORDER: { + const viz::DebugBorderDrawQuad *dbquad = viz::DebugBorderDrawQuad::MaterialCast(quad); QSGGeometry *geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 4); geometry->setDrawingMode(GL_LINE_LOOP); @@ -1154,8 +1154,8 @@ void DelegatedFrameNode::handleQuad( break; #endif } - case cc::DrawQuad::TILED_CONTENT: { - const cc::TileDrawQuad *tquad = cc::TileDrawQuad::MaterialCast(quad); + case viz::DrawQuad::TILED_CONTENT: { + const viz::TileDrawQuad *tquad = viz::TileDrawQuad::MaterialCast(quad); ResourceHolder *resource = findAndHoldResource(tquad->resource_id(), resourceCandidates); nodeHandler->setupTiledContentNode( initAndHoldTexture(resource, quad->ShouldDrawWithBlending(), apiDelegate), @@ -1166,8 +1166,8 @@ void DelegatedFrameNode::handleQuad( break; #ifndef QT_NO_OPENGL } - case cc::DrawQuad::YUV_VIDEO_CONTENT: { - const cc::YUVVideoDrawQuad *vquad = cc::YUVVideoDrawQuad::MaterialCast(quad); + case viz::DrawQuad::YUV_VIDEO_CONTENT: { + const viz::YUVVideoDrawQuad *vquad = viz::YUVVideoDrawQuad::MaterialCast(quad); ResourceHolder *yResource = findAndHoldResource(vquad->y_plane_resource_id(), resourceCandidates); ResourceHolder *uResource = @@ -1192,8 +1192,8 @@ void DelegatedFrameNode::handleQuad( break; #ifdef GL_OES_EGL_image_external } - case cc::DrawQuad::STREAM_VIDEO_CONTENT: { - const cc::StreamVideoDrawQuad *squad = cc::StreamVideoDrawQuad::MaterialCast(quad); + case viz::DrawQuad::STREAM_VIDEO_CONTENT: { + const viz::StreamVideoDrawQuad *squad = viz::StreamVideoDrawQuad::MaterialCast(quad); ResourceHolder *resource = findAndHoldResource(squad->resource_id(), resourceCandidates); MailboxTexture *texture = static_cast<MailboxTexture *>( initAndHoldTexture(resource, quad->ShouldDrawWithBlending())); @@ -1206,7 +1206,7 @@ void DelegatedFrameNode::handleQuad( #endif // GL_OES_EGL_image_external #endif // QT_NO_OPENGL } - case cc::DrawQuad::SURFACE_CONTENT: + case viz::DrawQuad::SURFACE_CONTENT: Q_UNREACHABLE(); default: qWarning("Unimplemented quad material: %d", quad->material); @@ -1223,13 +1223,13 @@ ResourceHolder *DelegatedFrameNode::findAndHoldResource(unsigned resourceId, QHa return resource.data(); } -void DelegatedFrameNode::holdResources(const cc::DrawQuad *quad, QHash<unsigned, QSharedPointer<ResourceHolder> > &candidates) +void DelegatedFrameNode::holdResources(const viz::DrawQuad *quad, QHash<unsigned, QSharedPointer<ResourceHolder> > &candidates) { for (auto resource : quad->resources) findAndHoldResource(resource, candidates); } -void DelegatedFrameNode::holdResources(const cc::RenderPass *pass, QHash<unsigned, QSharedPointer<ResourceHolder> > &candidates) +void DelegatedFrameNode::holdResources(const viz::RenderPass *pass, QHash<unsigned, QSharedPointer<ResourceHolder> > &candidates) { for (const auto &quad : pass->quad_list) holdResources(quad, candidates); diff --git a/src/core/delegated_frame_node.h b/src/core/delegated_frame_node.h index 4bddf4a6244c8d9709e2b5b07892995cdb81cefa..5d967841de57c67de41421fedcdeec1864527630 100644 --- a/src/core/delegated_frame_node.h +++ b/src/core/delegated_frame_node.h @@ -40,9 +40,10 @@ #ifndef DELEGATED_FRAME_NODE_H #define DELEGATED_FRAME_NODE_H -#include "cc/output/compositor_frame.h" -#include "cc/quads/render_pass.h" -#include "cc/resources/transferable_resource.h" +#include "base/containers/circular_deque.h" +#include "components/viz/common/quads/compositor_frame.h" +#include "components/viz/common/quads/render_pass.h" +#include "components/viz/common/resources/transferable_resource.h" #include "gpu/command_buffer/service/sync_point_manager.h" #include "ui/gl/gl_fence.h" #include <QMutex> @@ -59,16 +60,16 @@ QT_BEGIN_NAMESPACE class QSGLayer; QT_END_NAMESPACE -namespace cc { +namespace gfx { +class QuadF; +} + +namespace viz { class DelegatedFrameData; class DrawQuad; class DrawPolygon; } -namespace gfx { -class QuadF; -} - namespace QtWebEngineCore { class DelegatedNodeTreeHandler; @@ -81,8 +82,8 @@ class ChromiumCompositorData : public QSharedData { public: ChromiumCompositorData() : frameDevicePixelRatio(1) { } QHash<unsigned, QSharedPointer<ResourceHolder> > resourceHolders; - cc::CompositorFrame frameData; - cc::CompositorFrame previousFrameData; + viz::CompositorFrame frameData; + viz::CompositorFrame previousFrameData; qreal frameDevicePixelRatio; }; @@ -91,30 +92,29 @@ public: DelegatedFrameNode(); ~DelegatedFrameNode(); void preprocess(); - void commit(ChromiumCompositorData *chromiumCompositorData, std::vector<cc::ReturnedResource> *resourcesToRelease, RenderWidgetHostViewQtDelegate *apiDelegate); + void commit(ChromiumCompositorData *chromiumCompositorData, std::vector<viz::ReturnedResource> *resourcesToRelease, RenderWidgetHostViewQtDelegate *apiDelegate); private: - void flushPolygons( - std::deque<std::unique_ptr<cc::DrawPolygon>> *polygonQueue, + void flushPolygons(base::circular_deque<std::unique_ptr<viz::DrawPolygon> > *polygonQueue, QSGNode *renderPassChain, DelegatedNodeTreeHandler *nodeHandler, QHash<unsigned, QSharedPointer<ResourceHolder> > &resourceCandidates, RenderWidgetHostViewQtDelegate *apiDelegate); void handlePolygon( - const cc::DrawPolygon *polygon, + const viz::DrawPolygon *polygon, QSGNode *currentLayerChain, DelegatedNodeTreeHandler *nodeHandler, QHash<unsigned, QSharedPointer<ResourceHolder> > &resourceCandidates, RenderWidgetHostViewQtDelegate *apiDelegate); void handleClippedQuad( - const cc::DrawQuad *quad, + const viz::DrawQuad *quad, const gfx::QuadF &clipRegion, QSGNode *currentLayerChain, DelegatedNodeTreeHandler *nodeHandler, QHash<unsigned, QSharedPointer<ResourceHolder> > &resourceCandidates, RenderWidgetHostViewQtDelegate *apiDelegate); void handleQuad( - const cc::DrawQuad *quad, + const viz::DrawQuad *quad, QSGNode *currentLayerChain, DelegatedNodeTreeHandler *nodeHandler, QHash<unsigned, QSharedPointer<ResourceHolder> > &resourceCandidates, @@ -128,8 +128,8 @@ private: static void unlockQt(DelegatedFrameNode *frameNode); ResourceHolder *findAndHoldResource(unsigned resourceId, QHash<unsigned, QSharedPointer<ResourceHolder> > &candidates); - void holdResources(const cc::DrawQuad *quad, QHash<unsigned, QSharedPointer<ResourceHolder> > &candidates); - void holdResources(const cc::RenderPass *pass, QHash<unsigned, QSharedPointer<ResourceHolder> > &candidates); + void holdResources(const viz::DrawQuad *quad, QHash<unsigned, QSharedPointer<ResourceHolder> > &candidates); + void holdResources(const viz::RenderPass *pass, QHash<unsigned, QSharedPointer<ResourceHolder> > &candidates); QSGTexture *initAndHoldTexture(ResourceHolder *resource, bool quadIsAllOpaque, RenderWidgetHostViewQtDelegate *apiDelegate = 0); QExplicitlySharedDataPointer<ChromiumCompositorData> m_chromiumCompositorData; diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp index 7330090e722a273d53460737bc36902e089f3cbb..f715eefbf309480a50566cdea033450ec8611376 100644 --- a/src/core/devtools_frontend_qt.cpp +++ b/src/core/devtools_frontend_qt.cpp @@ -123,9 +123,9 @@ int ResponseWriter::Write(net::IOBuffer *buffer, int num_bytes, const net::Compl content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, - base::Bind(&DevToolsFrontendQt::CallClientFunction, shell_devtools_, - "DevToolsAPI.streamWrite", base::Owned(id), - base::Owned(chunkValue), nullptr)); + base::BindOnce(&DevToolsFrontendQt::CallClientFunction, + shell_devtools_, "DevToolsAPI.streamWrite", + base::Owned(id), base::Owned(chunkValue), nullptr)); return num_bytes; } @@ -259,6 +259,8 @@ void DevToolsFrontendQt::DocumentAvailableInMainFrame() scoped_refptr<content::DevToolsAgentHost> agent_host = content::DevToolsAgentHost::GetOrCreateFor(m_inspectedContents); if (agent_host != m_agentHost) { + if (m_agentHost) + m_agentHost->DetachClient(this); m_agentHost = agent_host; m_agentHost->AttachClient(this); if (m_inspect_element_at_x != -1) { @@ -274,8 +276,10 @@ void DevToolsFrontendQt::WebContentsDestroyed() if (m_inspectedContents) static_cast<WebContentsDelegateQt *>(m_inspectedContents->GetDelegate())->webContentsAdapter()->devToolsFrontendDestroyed(this); - if (m_agentHost) + if (m_agentHost) { m_agentHost->DetachClient(this); + m_agentHost = nullptr; + } delete this; } @@ -327,8 +331,6 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(const std::string &me dict->GetList("params", ¶ms); if (method == "dispatchProtocolMessage" && params && params->GetSize() == 1) { - if (!m_agentHost || !m_agentHost->IsAttached()) - return; std::string protocol_message; if (!params->GetString(0, &protocol_message)) return; @@ -386,7 +388,7 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(const std::string &me fetcher->Start(); return; } else if (method == "getPreferences") { - m_preferences = *m_prefStore->GetValues(); + m_preferences = std::move(*m_prefStore->GetValues()); SendMessageAck(request_id, &m_preferences); return; } else if (method == "setPreference") { diff --git a/src/core/devtools_manager_delegate_qt.cpp b/src/core/devtools_manager_delegate_qt.cpp index 8ea3c2fb7dcf9d17e3bd764ba2262d4009eee398..305e322786dad9ff34abb22565ccc2bfb560ed7c 100644 --- a/src/core/devtools_manager_delegate_qt.cpp +++ b/src/core/devtools_manager_delegate_qt.cpp @@ -159,8 +159,7 @@ void DevToolsServerQt::start() m_isStarted = true; DevToolsAgentHost::StartRemoteDebuggingServer( std::move(socketFactory), std::string(), - base::FilePath(), base::FilePath(), - std::string(), std::string()); + base::FilePath(), base::FilePath()); } void DevToolsServerQt::stop() diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp index f731b02317bb57cdcb03effdd59a8902ad1ccf9a..e9491eabab704b3f20eb019a22702001625f1ed2 100644 --- a/src/core/gl_surface_qt.cpp +++ b/src/core/gl_surface_qt.cpp @@ -102,20 +102,24 @@ public: explicit GLSurfaceQtEGL(const gfx::Size& size); static bool InitializeOneOff(); + static bool InitializeExtensionSettingsOneOff(); bool Initialize(GLSurfaceFormat format) override; void Destroy() override; void* GetHandle() override; - bool Resize(const gfx::Size& size, float scale_factor, bool has_alpha) override; + bool Resize(const gfx::Size& size, float scale_factor, ColorSpace color_space, bool has_alpha) override; protected: ~GLSurfaceQtEGL(); private: EGLSurface m_surfaceBuffer; + static bool s_initialized; DISALLOW_COPY_AND_ASSIGN(GLSurfaceQtEGL); }; +bool GLSurfaceQtEGL::s_initialized = false; + // The following comment is cited from chromium/ui/gl/gl_surface_egl.cc: // SurfacelessEGL is used as Offscreen surface when platform supports // KHR_surfaceless_context and GL_OES_surfaceless_context. This would avoid the @@ -128,7 +132,7 @@ public: bool Initialize(GLSurfaceFormat format) override; void Destroy() override; bool IsSurfaceless() const override; - bool Resize(const gfx::Size& size, float scale_factor, bool has_alpha) override; + bool Resize(const gfx::Size& size, float scale_factor, ColorSpace color_space, bool has_alpha) override; EGLSurface GetHandle() override; void* GetShareHandle() override; @@ -136,7 +140,6 @@ private: DISALLOW_COPY_AND_ASSIGN(GLSurfacelessQtEGL); }; - GLSurfaceQt::~GLSurfaceQt() { } @@ -152,6 +155,7 @@ public: explicit GLSurfaceQtGLX(const gfx::Size& size); static bool InitializeOneOff(); + static bool InitializeExtensionSettingsOneOff(); bool Initialize(GLSurfaceFormat format) override; void Destroy() override; @@ -161,6 +165,7 @@ protected: ~GLSurfaceQtGLX(); private: + static bool s_initialized; XID m_surfaceBuffer; DISALLOW_COPY_AND_ASSIGN(GLSurfaceQtGLX); }; @@ -170,6 +175,9 @@ GLSurfaceQtGLX::~GLSurfaceQtGLX() Destroy(); } + +bool GLSurfaceQtGLX::s_initialized = false; + bool GLSurfaceGLX::IsCreateContextSupported() { return ExtensionsContain(g_extensions, "GLX_ARB_create_context"); @@ -205,6 +213,23 @@ bool GLSurfaceGLX::IsOMLSyncControlSupported() return false; // ExtensionsContain(g_extensions, "GLX_OML_sync_control"); } +bool GLSurfaceQtGLX::InitializeExtensionSettingsOneOff() +{ + if (!s_initialized) + return false; + + Display* display = static_cast<Display*>(g_display); + g_extensions = glXQueryExtensionsString(display, 0); + g_driver_glx.InitializeExtensionBindings(); + + return true; +} + +bool GLSurfaceGLX::InitializeExtensionSettingsOneOff() +{ + return GLSurfaceQtGLX::InitializeExtensionSettingsOneOff(); +} + bool GLSurfaceGLX::HasGLXExtension(const char *name) { return ExtensionsContain(g_extensions, name); @@ -222,8 +247,7 @@ const char* GLSurfaceGLX::GetGLXExtensions() bool GLSurfaceQtGLX::InitializeOneOff() { - static bool initialized = false; - if (initialized) + if (s_initialized) return true; XInitThreads(); @@ -252,8 +276,7 @@ bool GLSurfaceQtGLX::InitializeOneOff() return false; } - g_extensions = glXQueryExtensionsString(display, 0); - initialized = true; + s_initialized = true; return true; } @@ -374,8 +397,7 @@ GLSurfaceQt::GLSurfaceQt() bool GLSurfaceQtEGL::InitializeOneOff() { - static bool initialized = false; - if (initialized) + if (s_initialized) return true; g_display = GLContextHelper::getEGLDisplay(); @@ -390,31 +412,12 @@ bool GLSurfaceQtEGL::InitializeOneOff() return false; } - g_extensions = eglQueryString(g_display, EGL_EXTENSIONS); if (!eglInitialize(g_display, NULL, NULL)) { LOG(ERROR) << "eglInitialize failed with error " << GetLastEGLErrorString(); return false; } - g_egl_surfaceless_context_supported = ExtensionsContain(g_extensions, "EGL_KHR_surfaceless_context"); - if (g_egl_surfaceless_context_supported) { - scoped_refptr<GLSurface> surface = new GLSurfacelessQtEGL(gfx::Size(1, 1)); - gl::GLContextAttribs attribs; - scoped_refptr<GLContext> context = init::CreateGLContext( - NULL, surface.get(), attribs); - - if (!context->MakeCurrent(surface.get())) - g_egl_surfaceless_context_supported = false; - - // Ensure context supports GL_OES_surfaceless_context. - if (g_egl_surfaceless_context_supported) { - g_egl_surfaceless_context_supported = context->HasExtension( - "GL_OES_surfaceless_context"); - context->ReleaseCurrent(surface.get()); - } - } - - initialized = true; + s_initialized = true; return true; } @@ -443,10 +446,57 @@ bool GLSurfaceEGL::IsEGLContextPrioritySupported() return false; } +bool GLSurfaceEGL::IsRobustResourceInitSupported() +{ + return false; +} + +bool GLSurfaceEGL::IsDisplayTextureShareGroupSupported() +{ + return false; +} + +bool GLSurfaceEGL::IsCreateContextClientArraysSupported() +{ + return false; +} + void GLSurfaceEGL::ShutdownOneOff() { } +bool GLSurfaceQtEGL::InitializeExtensionSettingsOneOff() +{ + if (!s_initialized) + return false; + + g_extensions = eglQueryString(g_display, EGL_EXTENSIONS); + g_egl_surfaceless_context_supported = ExtensionsContain(g_extensions, "EGL_KHR_surfaceless_context"); + if (g_egl_surfaceless_context_supported) { + scoped_refptr<GLSurface> surface = new GLSurfacelessQtEGL(gfx::Size(1, 1)); + gl::GLContextAttribs attribs; + scoped_refptr<GLContext> context = init::CreateGLContext( + NULL, surface.get(), attribs); + + if (!context->MakeCurrent(surface.get())) + g_egl_surfaceless_context_supported = false; + + // Ensure context supports GL_OES_surfaceless_context. + if (g_egl_surfaceless_context_supported) { + g_egl_surfaceless_context_supported = context->HasExtension( + "GL_OES_surfaceless_context"); + context->ReleaseCurrent(surface.get()); + } + } + + return true; +} + +bool GLSurfaceEGL::InitializeExtensionSettingsOneOff() +{ + return GLSurfaceQtEGL::InitializeExtensionSettingsOneOff(); +} + const char* GLSurfaceEGL::GetEGLExtensions() { return g_extensions; @@ -546,7 +596,7 @@ GLSurfaceFormat GLSurfaceQt::GetFormat() } -bool GLSurfaceQtEGL::Resize(const gfx::Size& size, float scale_factor, bool has_alpha) +bool GLSurfaceQtEGL::Resize(const gfx::Size& size, float scale_factor, ColorSpace /*color_space*/, bool has_alpha) { if (size == m_size) return true; @@ -606,7 +656,7 @@ bool GLSurfacelessQtEGL::IsSurfaceless() const return true; } -bool GLSurfacelessQtEGL::Resize(const gfx::Size& size, float scale_factor, bool has_alpha) +bool GLSurfacelessQtEGL::Resize(const gfx::Size& size, float scale_factor, ColorSpace color_space, bool has_alpha) { m_size = size; return true; @@ -676,7 +726,7 @@ CreateOffscreenGLSurfaceWithFormat(const gfx::Size& size, GLSurfaceFormat format if (surface->Initialize(format)) return surface; } - // no break + Q_FALLTHROUGH(); #endif } case kGLImplementationEGLGLES2: { diff --git a/src/core/javascript_dialog_controller.cpp b/src/core/javascript_dialog_controller.cpp index 5b695b6cf9f53e18d90c58036535d5b1efa708c6..86f5b9795a85ce7a71a9bf60464e2917fef01179 100644 --- a/src/core/javascript_dialog_controller.cpp +++ b/src/core/javascript_dialog_controller.cpp @@ -40,7 +40,7 @@ #include "javascript_dialog_controller.h" #include "javascript_dialog_controller_p.h" -#include"javascript_dialog_manager_qt.h" +#include "javascript_dialog_manager_qt.h" #include "type_conversion.h" namespace QtWebEngineCore { @@ -51,18 +51,18 @@ void JavaScriptDialogControllerPrivate::dialogFinished(bool accepted, const base // but hold a shared pointer so the dialog does not get deleted prematurely when running in-process. QSharedPointer<JavaScriptDialogController> dialog = JavaScriptDialogManagerQt::GetInstance()->takeDialogForContents(contents); - callback.Run(accepted, promptValue); + std::move(callback).Run(accepted, promptValue); } JavaScriptDialogControllerPrivate::JavaScriptDialogControllerPrivate(WebContentsAdapterClient::JavascriptDialogType t, const QString &msg, const QString &prompt , const QString &title, const QUrl &securityOrigin - , const content::JavaScriptDialogManager::DialogClosedCallback &cb, content::WebContents *c) + , content::JavaScriptDialogManager::DialogClosedCallback &&cb, content::WebContents *c) : type(t) , message(msg) , defaultPrompt(prompt) , securityOrigin(securityOrigin) , title(title) - , callback(cb) + , callback(std::move(cb)) , contents(c) { } diff --git a/src/core/javascript_dialog_controller_p.h b/src/core/javascript_dialog_controller_p.h index 45c5a9fdd28a8bd09b50eccced8c88c7b35b891a..ab7b09268aab3a91e1e8a6e54015c9d0836a338c 100644 --- a/src/core/javascript_dialog_controller_p.h +++ b/src/core/javascript_dialog_controller_p.h @@ -51,8 +51,11 @@ // We mean it. // +#include "base/callback.h" #include "content/public/browser/javascript_dialog_manager.h" + #include "web_contents_adapter_client.h" + #include <QString> namespace content { @@ -67,7 +70,7 @@ public: void dialogFinished(bool accepted, const base::string16 &promptValue); JavaScriptDialogControllerPrivate(WebContentsAdapterClient::JavascriptDialogType, const QString &message, const QString &prompt , const QString& title, const QUrl &securityOrigin - , const content::JavaScriptDialogManager::DialogClosedCallback &, content::WebContents *); + , content::JavaScriptDialogManager::DialogClosedCallback &&, content::WebContents *); WebContentsAdapterClient::JavascriptDialogType type; QString message; diff --git a/src/core/javascript_dialog_manager_qt.cpp b/src/core/javascript_dialog_manager_qt.cpp index a1a8604a47c60d553c742f7eb3700ccc28af9125..1e632754501741fbe4c7e684c4e8bf9e26c1d5f7 100644 --- a/src/core/javascript_dialog_manager_qt.cpp +++ b/src/core/javascript_dialog_manager_qt.cpp @@ -58,7 +58,7 @@ JavaScriptDialogManagerQt *JavaScriptDialogManagerQt::GetInstance() return base::Singleton<JavaScriptDialogManagerQt>::get(); } -void JavaScriptDialogManagerQt::RunJavaScriptDialog(content::WebContents *webContents, const GURL &originUrl, content::JavaScriptDialogType dialog_type, const base::string16 &messageText, const base::string16 &defaultPromptText, const content::JavaScriptDialogManager::DialogClosedCallback &callback, bool *didSuppressMessage) +void JavaScriptDialogManagerQt::RunJavaScriptDialog(content::WebContents *webContents, const GURL &originUrl, content::JavaScriptDialogType dialog_type, const base::string16 &messageText, const base::string16 &defaultPromptText, content::JavaScriptDialogManager::DialogClosedCallback callback, bool *didSuppressMessage) { WebContentsAdapterClient *client = WebContentsViewQt::from(static_cast<content::WebContentsImpl*>(webContents)->GetView())->client(); if (!client) { @@ -68,13 +68,13 @@ void JavaScriptDialogManagerQt::RunJavaScriptDialog(content::WebContents *webCon } WebContentsAdapterClient::JavascriptDialogType dialogType = static_cast<WebContentsAdapterClient::JavascriptDialogType>(dialog_type); - runDialogForContents(webContents, dialogType, toQt(messageText).toHtmlEscaped(), toQt(defaultPromptText).toHtmlEscaped(), toQt(originUrl.GetOrigin()), callback); + runDialogForContents(webContents, dialogType, toQt(messageText).toHtmlEscaped(), toQt(defaultPromptText).toHtmlEscaped(), toQt(originUrl.GetOrigin()), std::move(callback)); } void JavaScriptDialogManagerQt::RunBeforeUnloadDialog(content::WebContents *webContents, bool isReload, - const content::JavaScriptDialogManager::DialogClosedCallback &callback) { + content::JavaScriptDialogManager::DialogClosedCallback callback) { Q_UNUSED(isReload); - runDialogForContents(webContents, WebContentsAdapterClient::UnloadDialog, QString(), QString(), QUrl(), callback); + runDialogForContents(webContents, WebContentsAdapterClient::UnloadDialog, QString(), QString(), QUrl(), std::move(callback)); } bool JavaScriptDialogManagerQt::HandleJavaScriptDialog(content::WebContents *contents, bool accept, const base::string16 *promptOverride) @@ -89,13 +89,13 @@ bool JavaScriptDialogManagerQt::HandleJavaScriptDialog(content::WebContents *con void JavaScriptDialogManagerQt::runDialogForContents(content::WebContents *webContents, WebContentsAdapterClient::JavascriptDialogType type , const QString &messageText, const QString &defaultPrompt, const QUrl &origin - , const content::JavaScriptDialogManager::DialogClosedCallback &callback, const QString &title) + , content::JavaScriptDialogManager::DialogClosedCallback &&callback, const QString &title) { WebContentsAdapterClient *client = WebContentsViewQt::from(static_cast<content::WebContentsImpl*>(webContents)->GetView())->client(); if (!client) return; - JavaScriptDialogControllerPrivate *dialogData = new JavaScriptDialogControllerPrivate(type, messageText, defaultPrompt, title, origin, callback, webContents); + JavaScriptDialogControllerPrivate *dialogData = new JavaScriptDialogControllerPrivate(type, messageText, defaultPrompt, title, origin, std::move(callback), webContents); QSharedPointer<JavaScriptDialogController> dialog(new JavaScriptDialogController(dialogData)); // We shouldn't get new dialogs for a given WebContents until we gave back a result. diff --git a/src/core/javascript_dialog_manager_qt.h b/src/core/javascript_dialog_manager_qt.h index 291f027a9016aea266d99489ad98a5e88430df14..2856b30f0b3016b555f94eb23585afd7b1f0e1f7 100644 --- a/src/core/javascript_dialog_manager_qt.h +++ b/src/core/javascript_dialog_manager_qt.h @@ -39,6 +39,7 @@ #ifndef JAVASCRIPT_DIALOG_MANAGER_QT_H #define JAVASCRIPT_DIALOG_MANAGER_QT_H +#include "base/callback.h" #include "content/public/browser/javascript_dialog_manager.h" #include "web_contents_adapter_client.h" @@ -61,11 +62,10 @@ public: void RunJavaScriptDialog(content::WebContents *, const GURL &, content::JavaScriptDialogType dialog_type, const base::string16 &messageText, const base::string16 &defaultPromptText, - const content::JavaScriptDialogManager::DialogClosedCallback &callback, + DialogClosedCallback callback, bool *didSuppressMessage) override; - void RunBeforeUnloadDialog(content::WebContents *, bool isReload, - const content::JavaScriptDialogManager::DialogClosedCallback &callback) override; + content::JavaScriptDialogManager::DialogClosedCallback callback) override; bool HandleJavaScriptDialog(content::WebContents *, bool accept, const base::string16 *promptOverride) override; void CancelDialogs(content::WebContents *contents, bool /*reset_state*/) override { @@ -73,7 +73,7 @@ public: } void runDialogForContents(content::WebContents *, WebContentsAdapterClient::JavascriptDialogType, const QString &messageText, const QString &defaultPrompt - , const QUrl &,const content::JavaScriptDialogManager::DialogClosedCallback &callback, const QString &title = QString()); + , const QUrl &, DialogClosedCallback &&callback, const QString &title = QString()); QSharedPointer<JavaScriptDialogController> takeDialogForContents(content::WebContents *); private: diff --git a/src/core/native_web_keyboard_event_qt.cpp b/src/core/native_web_keyboard_event_qt.cpp index 9eb613e2553766b7dabaebc1e14fb27afec1b7e3..b2e857aaf72586e1c3b2911b29d71cca1fca56a6 100644 --- a/src/core/native_web_keyboard_event_qt.cpp +++ b/src/core/native_web_keyboard_event_qt.cpp @@ -66,6 +66,12 @@ using blink::WebKeyboardEvent; namespace content { +NativeWebKeyboardEvent::NativeWebKeyboardEvent(blink::WebKeyboardEvent const&, gfx::NativeView) + : os_event(0) + , skip_in_browser(false) +{ +} + NativeWebKeyboardEvent::NativeWebKeyboardEvent(blink::WebInputEvent::Type, int, base::TimeTicks) : os_event(0) , skip_in_browser(false) diff --git a/src/core/network_delegate_qt.cpp b/src/core/network_delegate_qt.cpp index f82d47fa1ccf8ba9f086469a9b2af536cc0ba8ca..0a7d1f2b4c77ef5f5da731c6a0e416da7c0ecb95 100644 --- a/src/core/network_delegate_qt.cpp +++ b/src/core/network_delegate_qt.cpp @@ -120,7 +120,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, const net::C QWebEngineUrlRequestInfoPrivate *infoPrivate = new QWebEngineUrlRequestInfoPrivate(toQt(resourceType), toQt(navigationType), qUrl, - toQt(request->first_party_for_cookies()), + toQt(request->site_for_cookies()), QByteArray::fromStdString(request->method())); QWebEngineUrlRequestInfo requestInfo(infoPrivate); interceptor->interceptRequest(requestInfo); @@ -144,10 +144,9 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, const net::C if (!resourceInfo) return net::OK; - int renderProcessId; - int renderFrameId; + int frameTreeNodeId = resourceInfo->GetFrameTreeNodeId(); // Only intercept MAIN_FRAME and SUB_FRAME with an associated render frame. - if (!content::IsResourceTypeFrame(resourceType) || !resourceInfo->GetRenderFrameForRequest(request, &renderProcessId, &renderFrameId)) + if (!content::IsResourceTypeFrame(resourceType) || frameTreeNodeId == -1) return net::OK; // Track active requests since |callback| and |new_url| are valid @@ -157,9 +156,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, const net::C RequestParams params = { qUrl, resourceInfo->IsMainFrame(), - navigationType, - renderProcessId, - renderFrameId + navigationType }; content::BrowserThread::PostTask( @@ -169,6 +166,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, const net::C base::Unretained(this), request, params, + frameTreeNodeId, callback) ); @@ -181,6 +179,10 @@ void NetworkDelegateQt::OnURLRequestDestroyed(net::URLRequest* request) m_activeRequests.remove(request); } +void NetworkDelegateQt::OnCompleted(net::URLRequest */*request*/, bool /*started*/, int /*net_error*/) +{ +} + void NetworkDelegateQt::CompleteURLRequestOnIOThread(net::URLRequest *request, int navigationRequestAction, const net::CompletionCallback &callback) @@ -209,15 +211,14 @@ void NetworkDelegateQt::CompleteURLRequestOnIOThread(net::URLRequest *request, void NetworkDelegateQt::NotifyNavigationRequestedOnUIThread(net::URLRequest *request, RequestParams params, + int frameTreeNodeId, const net::CompletionCallback &callback) { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); int navigationRequestAction = WebContentsAdapterClient::AcceptRequest; - content::RenderFrameHost *rfh = content::RenderFrameHost::FromID(params.renderProcessId, params.renderFrameId); - - if (rfh) { - content::WebContents *webContents = content::WebContents::FromRenderViewHost(rfh->GetRenderViewHost()); + content::WebContents *webContents = content::WebContents::FromFrameTreeNodeId(frameTreeNodeId); + if (webContents) { WebContentsAdapterClient *client = WebContentsViewQt::from(static_cast<content::WebContentsImpl*>(webContents)->GetView())->client(); client->navigationRequested(params.navigationType, params.url, navigationRequestAction, params.isMainFrameRequest); } @@ -238,12 +239,17 @@ bool NetworkDelegateQt::OnCanSetCookie(const net::URLRequest& request, const std::string& cookie_line, net::CookieOptions*) { - return canSetCookies(request.first_party_for_cookies(), request.url(), cookie_line); + return canSetCookies(request.site_for_cookies(), request.url(), cookie_line); } bool NetworkDelegateQt::OnCanGetCookies(const net::URLRequest& request, const net::CookieList&) { - return canGetCookies(request.first_party_for_cookies(), request.url()); + return canGetCookies(request.site_for_cookies(), request.url()); +} + +bool NetworkDelegateQt::OnCanEnablePrivacyMode(const GURL &url, const GURL &site_for_cookies) const +{ + return !canGetCookies(site_for_cookies, url); } bool NetworkDelegateQt::canSetCookies(const GURL &first_party, const GURL &url, const std::string &cookie_line) const @@ -293,10 +299,6 @@ void NetworkDelegateQt::OnNetworkBytesSent(net::URLRequest*, int64_t) { } -void NetworkDelegateQt::OnCompleted(net::URLRequest*, bool) -{ -} - void NetworkDelegateQt::OnPACScriptError(int, const base::string16&) { } @@ -311,11 +313,6 @@ bool NetworkDelegateQt::OnCanAccessFile(const net::URLRequest&, const base::File return true; } -bool NetworkDelegateQt::OnCanEnablePrivacyMode(const GURL&, const GURL&) const -{ - return false; -} - bool NetworkDelegateQt::OnAreExperimentalCookieFeaturesEnabled() const { return false; diff --git a/src/core/network_delegate_qt.h b/src/core/network_delegate_qt.h index 452d1dd77ffc3d6dfb84096a0f1d27a66976420e..44cf96d5b5a494fd272a25a8ba9b092d13282ef4 100644 --- a/src/core/network_delegate_qt.h +++ b/src/core/network_delegate_qt.h @@ -46,6 +46,10 @@ #include <QUrl> #include <QSet> +namespace content { +class WebContents; +} + namespace QtWebEngineCore { class URLRequestContextGetterQt; @@ -60,12 +64,11 @@ public: QUrl url; bool isMainFrameRequest; int navigationType; - int renderProcessId; - int renderFrameId; }; void NotifyNavigationRequestedOnUIThread(net::URLRequest *request, RequestParams params, + int frameTreeNodeId, const net::CompletionCallback &callback); void CompleteURLRequestOnIOThread(net::URLRequest *request, @@ -77,15 +80,15 @@ public: void OnURLRequestDestroyed(net::URLRequest* request) override; bool OnCanSetCookie(const net::URLRequest&, const std::string&, net::CookieOptions*) override; int OnBeforeStartTransaction(net::URLRequest *request, const net::CompletionCallback &callback, net::HttpRequestHeaders *headers) override; - virtual void OnBeforeSendHeaders(net::URLRequest* request, const net::ProxyInfo& proxy_info, - const net::ProxyRetryInfoMap& proxy_retry_info, net::HttpRequestHeaders* headers) override; + void OnBeforeSendHeaders(net::URLRequest* request, const net::ProxyInfo& proxy_info, + const net::ProxyRetryInfoMap& proxy_retry_info, net::HttpRequestHeaders* headers) override; void OnStartTransaction(net::URLRequest *request, const net::HttpRequestHeaders &headers) override; int OnHeadersReceived(net::URLRequest*, const net::CompletionCallback&, const net::HttpResponseHeaders*, scoped_refptr<net::HttpResponseHeaders>*, GURL*) override; void OnBeforeRedirect(net::URLRequest*, const GURL&) override; void OnResponseStarted(net::URLRequest*) override; void OnNetworkBytesReceived(net::URLRequest*, int64_t) override; void OnNetworkBytesSent(net::URLRequest *, int64_t) override; - void OnCompleted(net::URLRequest*, bool) override; + void OnCompleted(net::URLRequest *request, bool started, int net_error) override; void OnPACScriptError(int, const base::string16&) override; net::NetworkDelegate::AuthRequiredResponse OnAuthRequired(net::URLRequest*, const net::AuthChallengeInfo&, const AuthCallback&, net::AuthCredentials*) override; bool OnCanGetCookies(const net::URLRequest&, const net::CookieList&) override; @@ -96,10 +99,8 @@ public: bool OnCanQueueReportingReport(const url::Origin& origin) const override; bool OnCanSendReportingReport(const url::Origin& origin) const override; - virtual bool OnCanSetReportingClient(const url::Origin& origin, - const GURL& endpoint) const override; - virtual bool OnCanUseReportingClient(const url::Origin& origin, - const GURL& endpoint) const override; + bool OnCanSetReportingClient(const url::Origin& origin, const GURL& endpoint) const override; + bool OnCanUseReportingClient(const url::Origin& origin, const GURL& endpoint) const override; bool canSetCookies(const GURL &first_party, const GURL &url, const std::string &cookie_line) const; bool canGetCookies(const GURL &first_party, const GURL &url) const; diff --git a/src/core/ozone_platform_qt.cpp b/src/core/ozone_platform_qt.cpp index e165239bd18305fc1ec3a262032b0a5494a4e0f4..cf44fa45695d4fc00a267716eedf1b92263890ba 100644 --- a/src/core/ozone_platform_qt.cpp +++ b/src/core/ozone_platform_qt.cpp @@ -53,7 +53,6 @@ #include "ui/ozone/public/cursor_factory_ozone.h" #include "ui/ozone/public/gpu_platform_support_host.h" #include "ui/ozone/public/input_controller.h" -#include "ui/ozone/public/system_input_injector.h" #include "ui/platform_window/platform_window.h" #include "ui/platform_window/platform_window_delegate.h" diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index 5328166d1bc69701dd4b69e31aa158e4c85bd305..95d01dd070978e6a55a9b8332288e9189783d917 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -67,6 +67,8 @@ BrowserContextAdapter::PermissionType toQt(content::PermissionType type) case content::PermissionType::MIDI: case content::PermissionType::DURABLE_STORAGE: case content::PermissionType::BACKGROUND_SYNC: + case content::PermissionType::SENSORS: + case content::PermissionType::ACCESSIBILITY_EVENTS: case content::PermissionType::NUM: break; } diff --git a/src/core/print_view_manager_base_qt.cpp b/src/core/print_view_manager_base_qt.cpp index cbd8ea03afc7628bd52e52b21295ff592f2dacb2..abae381600f29855a18a45538361b15ef9a05b84 100644 --- a/src/core/print_view_manager_base_qt.cpp +++ b/src/core/print_view_manager_base_qt.cpp @@ -105,24 +105,6 @@ void PrintViewManagerBaseQt::NavigationStopped() TerminatePrintJob(true); } - // Terminates or cancels the print job if one was pending. -void PrintViewManagerBaseQt::RenderProcessGone(base::TerminationStatus status) -{ - PrintManager::RenderProcessGone(status); - ReleasePrinterQuery(); - - if (!m_printJob.get()) - return; - - scoped_refptr<printing::PrintedDocument> document(m_printJob->document()); - if (document.get()) { - // If IsComplete() returns false, the document isn't completely rendered. - // Since our renderer is gone, there's nothing to do, cancel it. Otherwise, - // the print job may finish without problem. - TerminatePrintJob(!document->IsComplete()); - } -} - base::string16 PrintViewManagerBaseQt::RenderSourceName() { return toString16(QLatin1String("")); @@ -171,7 +153,7 @@ void PrintViewManagerBaseQt::OnDidPrintPage( } } - std::unique_ptr<printing::PdfMetafileSkia> metafile(new printing::PdfMetafileSkia(printing::PDF_SKIA_DOCUMENT_TYPE)); + std::unique_ptr<printing::PdfMetafileSkia> metafile(new printing::PdfMetafileSkia(printing::SkiaDocumentType::PDF)); if (metafile_must_be_valid) { if (!metafile->InitFromData(shared_buf->memory(), params.data_size)) { NOTREACHED() << "Invalid metafile header"; @@ -210,6 +192,28 @@ void PrintViewManagerBaseQt::OnShowInvalidPrinterSettingsError() void PrintViewManagerBaseQt::DidStartLoading() { + UpdatePrintingEnabled(); +} + +void PrintViewManagerBaseQt::RenderFrameDeleted(content::RenderFrameHost *render_frame_host) +{ + // Terminates or cancels the print job if one was pending. + if (render_frame_host != web_contents()->GetMainFrame()) + return; + + PrintManager::PrintingRenderFrameDeleted(); + ReleasePrinterQuery(); + + if (!m_printJob.get()) + return; + + scoped_refptr<printing::PrintedDocument> document(m_printJob->document()); + if (document.get()) { + // If IsComplete() returns false, the document isn't completely rendered. + // Since our renderer is gone, there's nothing to do, cancel it. Otherwise, + // the print job may finish without problem. + TerminatePrintJob(!document->IsComplete()); + } } bool PrintViewManagerBaseQt::OnMessageReceived(const IPC::Message& message, content::RenderFrameHost* render_frame_host) @@ -217,8 +221,7 @@ bool PrintViewManagerBaseQt::OnMessageReceived(const IPC::Message& message, cont bool handled = true; IPC_BEGIN_MESSAGE_MAP(PrintViewManagerBaseQt, message) IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage) - IPC_MESSAGE_HANDLER(PrintHostMsg_ShowInvalidPrinterSettingsError, - OnShowInvalidPrinterSettingsError); + IPC_MESSAGE_HANDLER(PrintHostMsg_ShowInvalidPrinterSettingsError, OnShowInvalidPrinterSettingsError); IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled || PrintManager::OnMessageReceived(message, render_frame_host); @@ -328,7 +331,7 @@ void PrintViewManagerBaseQt::ShouldQuitFromInnerMessageLoop() m_isInsideInnerMessageLoop) { // We are in a message loop created by RenderAllMissingPagesNow. Quit from // it. - base::MessageLoop::current()->QuitWhenIdle(); + base::MessageLoop::current()->QuitWhenIdleClosure(); m_isInsideInnerMessageLoop = false; } } @@ -337,7 +340,7 @@ bool PrintViewManagerBaseQt::CreateNewPrintJob(printing::PrintJobWorkerOwner* jo { DCHECK(!m_isInsideInnerMessageLoop); - // Disconnect the current print_job_. + // Disconnect the current |m_printJob|. DisconnectFromCurrentPrintJob(); // We can't print if there is no renderer. @@ -354,7 +357,7 @@ bool PrintViewManagerBaseQt::CreateNewPrintJob(printing::PrintJobWorkerOwner* jo return false; m_printJob = new printing::PrintJob(); - m_printJob->Initialize(job, this, number_pages_); + m_printJob->Initialize(job, RenderSourceName(), number_pages_); m_registrar.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, content::Source<printing::PrintJob>(m_printJob.get())); m_didPrintingSucceed = false; @@ -383,13 +386,6 @@ void PrintViewManagerBaseQt::DisconnectFromCurrentPrintJob() #endif } -void PrintViewManagerBaseQt::PrintingDone(bool success) -{ - if (!m_printJob.get()) - return; - Send(new PrintMsg_PrintingDone(routing_id(), success)); -} - void PrintViewManagerBaseQt::TerminatePrintJob(bool cancel) { if (!m_printJob.get()) @@ -413,16 +409,18 @@ void PrintViewManagerBaseQt::TerminatePrintJob(bool cancel) void PrintViewManagerBaseQt::ReleasePrintJob() { + content::RenderFrameHost *rfh = web_contents() ? web_contents()->GetMainFrame() : nullptr; + if (!m_printJob.get()) return; - PrintingDone(m_didPrintingSucceed); + if (rfh) + rfh->Send(new PrintMsg_PrintingDone(rfh->GetRoutingID(), m_didPrintingSucceed)); m_registrar.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, content::Source<printing::PrintJob>(m_printJob.get())); - m_printJob->DisconnectSource(); // Don't close the worker thread. - m_printJob = NULL; + m_printJob = nullptr; } @@ -440,15 +438,15 @@ bool PrintViewManagerBaseQt::RunInnerMessageLoop() { // memory-bound. static const int kPrinterSettingsTimeout = 60000; base::OneShotTimer quit_timer; + base::RunLoop runLoop; quit_timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), - base::MessageLoop::current(), &base::MessageLoop::QuitWhenIdle); + runLoop.QuitWhenIdleClosure()); m_isInsideInnerMessageLoop = true; // Need to enable recursive task. { - base::RunLoop runLoop; m_quitClosure = runLoop.QuitClosure(); base::MessageLoop* loop = base::MessageLoop::current(); base::MessageLoop::ScopedNestableTaskAllower allowNested(loop); @@ -514,7 +512,7 @@ void PrintViewManagerBaseQt::ReleasePrinterQuery() return; content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, - base::Bind(&printing::PrinterQuery::StopWorker, printerQuery.get())); + base::BindOnce(&printing::PrinterQuery::StopWorker, printerQuery.get())); } // Originally from print_preview_message_handler.cc: @@ -525,8 +523,7 @@ void PrintViewManagerBaseQt::StopWorker(int documentCookie) { m_printerQueriesQueue->PopPrinterQuery(documentCookie); if (printer_query.get()) { content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, - base::Bind(&printing::PrinterQuery::StopWorker, - printer_query)); + base::BindOnce(&printing::PrinterQuery::StopWorker, printer_query)); } } diff --git a/src/core/print_view_manager_base_qt.h b/src/core/print_view_manager_base_qt.h index 4e4c8bde2075a217ffe108a76edb8b32b0915333..c55e970e5aca61f1e9060135aa38a912e812c129 100644 --- a/src/core/print_view_manager_base_qt.h +++ b/src/core/print_view_manager_base_qt.h @@ -50,11 +50,11 @@ #include "components/printing/browser/print_manager.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" -#include "printing/printed_pages_source.h" struct PrintHostMsg_DidPrintPage_Params; namespace content { +class RenderFrameHost; class RenderViewHost; } @@ -70,7 +70,6 @@ namespace QtWebEngineCore { class PrintViewManagerBaseQt : public content::NotificationObserver , public printing::PrintManager - , public printing::PrintedPagesSource { public: ~PrintViewManagerBaseQt() override; @@ -78,8 +77,7 @@ public: // Whether printing is enabled or not. void UpdatePrintingEnabled(); - // PrintedPagesSource implementation. - base::string16 RenderSourceName() override; + virtual base::string16 RenderSourceName(); protected: explicit PrintViewManagerBaseQt(content::WebContents*); @@ -88,10 +86,8 @@ protected: // Cancels the print job. void NavigationStopped() override; - // Terminates or cancels the print job if one was pending. - void RenderProcessGone(base::TerminationStatus status) override; - // content::WebContentsObserver implementation. + void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; bool OnMessageReceived(const IPC::Message& message, content::RenderFrameHost* render_frame_host) override; @@ -132,7 +128,6 @@ protected: bool RunInnerMessageLoop(); void TerminatePrintJob(bool cancel); - void PrintingDone(bool success); void DisconnectFromCurrentPrintJob(); bool CreateNewPrintJob(printing::PrintJobWorkerOwner* job); diff --git a/src/core/print_view_manager_qt.cpp b/src/core/print_view_manager_qt.cpp index b8df5a1313480d9dbcafa8a1b0990555754db943..5198985d7ae5148d9af48da1bbfccd03b443f650 100644 --- a/src/core/print_view_manager_qt.cpp +++ b/src/core/print_view_manager_qt.cpp @@ -105,7 +105,7 @@ static void SavePdfFile(scoped_refptr<base::RefCountedBytes> data, DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); DCHECK_GT(data->size(), 0U); - printing::PdfMetafileSkia metafile(printing::PDF_SKIA_DOCUMENT_TYPE); + printing::PdfMetafileSkia metafile(printing::SkiaDocumentType::PDF); metafile.InitFromData(static_cast<const void*>(data->front()), data->size()); base::File file(path, @@ -249,8 +249,8 @@ bool PrintViewManagerQt::PrintToPDFInternal(const QPageLayout &pageLayout, bool , web_contents()->GetRenderViewHost()->GetWebkitPreferences().should_print_backgrounds); m_printSettings->SetInteger(printing::kSettingColor, printInColor ? printing::COLOR : printing::GRAYSCALE); - return Send(new PrintMsg_InitiatePrintPreview( - web_contents()->GetMainFrame()->GetRoutingID(), false)); + return web_contents()->GetMainFrame()->Send( + new PrintMsg_InitiatePrintPreview(web_contents()->GetMainFrame()->GetRoutingID(), false)); } #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -273,10 +273,8 @@ bool PrintViewManagerQt::OnMessageReceived(const IPC::Message& message, content: bool handled = true; IPC_BEGIN_MESSAGE_MAP(PrintViewManagerQt, message) IPC_MESSAGE_HANDLER(PrintHostMsg_DidShowPrintDialog, OnDidShowPrintDialog) - IPC_MESSAGE_HANDLER(PrintHostMsg_RequestPrintPreview, - OnRequestPrintPreview) - IPC_MESSAGE_HANDLER(PrintHostMsg_MetafileReadyForPrinting, - OnMetafileReadyForPrinting); + IPC_MESSAGE_HANDLER(PrintHostMsg_RequestPrintPreview, OnRequestPrintPreview) + IPC_MESSAGE_HANDLER(PrintHostMsg_MetafileReadyForPrinting, OnMetafileReadyForPrinting); IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled || PrintManager::OnMessageReceived(message, render_frame_host); @@ -293,10 +291,11 @@ void PrintViewManagerQt::resetPdfState() // IPC handlers void PrintViewManagerQt::OnRequestPrintPreview( - const PrintHostMsg_RequestPrintPreview_Params& params) + const PrintHostMsg_RequestPrintPreview_Params &/*params*/) { - Send(new PrintMsg_PrintPreview( - web_contents()->GetMainFrame()->GetRoutingID(), *m_printSettings)); + auto *rfh = web_contents()->GetMainFrame(); + rfh->Send(new PrintMsg_PrintPreview(rfh->GetRoutingID(), *m_printSettings)); + rfh->Send(new PrintMsg_ClosePrintPreviewDialog(rfh->GetRoutingID())); } void PrintViewManagerQt::OnMetafileReadyForPrinting( diff --git a/src/core/print_view_manager_qt.h b/src/core/print_view_manager_qt.h index 994fc112194a229e9df3d81c4128c8f8dd1358a7..2eceaa588900bc0f75a5770e98422e52f6140ca4 100644 --- a/src/core/print_view_manager_qt.h +++ b/src/core/print_view_manager_qt.h @@ -55,7 +55,6 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_user_data.h" #include "printing/features/features.h" -#include "printing/printed_pages_source.h" struct PrintHostMsg_RequestPrintPreview_Params; struct PrintHostMsg_DidPreviewDocument_Params; @@ -97,7 +96,6 @@ public: const PrintToPDFCallback &callback); #endif // ENABLE_BASIC_PRINTING - // PrintedPagesSource implementation. base::string16 RenderSourceName() override; protected: diff --git a/src/core/qtwebengine.gni b/src/core/qtwebengine.gni index a86e93f5b566c94fbc9e9434d563f84fcb24de76..eeaf6c15fa85cac9b4e8d79389af11f74a7e959e 100644 --- a/src/core/qtwebengine.gni +++ b/src/core/qtwebengine.gni @@ -7,6 +7,7 @@ chromium_version = exec_script("//build/util/version.py", [ "-f", rebase_path("/ include_dirs = [ "//skia/config", + "//third_party", "//third_party/skia/include/core" ] @@ -41,7 +42,7 @@ if (enable_widevine) { } if (enable_webrtc) { - deps += [ "//third_party/webrtc/base:base" ] + deps += [ "//third_party/webrtc_overrides" ] } if (is_linux && !is_desktop_linux) { diff --git a/src/core/qtwebengine_resources.gni b/src/core/qtwebengine_resources.gni index 6bff6a9a408f1a8ccbc798afa6c947abaabad266..bc86eee7bc329de568a693cbb39ce79ad1201b4c 100644 --- a/src/core/qtwebengine_resources.gni +++ b/src/core/qtwebengine_resources.gni @@ -44,11 +44,11 @@ repack("qtwebengine_repack_resources_100") { "$root_gen_dir/components/components_resources_100_percent.pak", "$root_gen_dir/content/app/resources/content_resources_100_percent.pak", "$root_gen_dir/chrome/renderer_resources_100_percent.pak", - "$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak", + "$root_gen_dir/blink/public/resources/blink_scaled_resources_100_percent.pak", ] output = "$root_out_dir/qtwebengine_resources_100p.pak" deps = [ - "//third_party/WebKit/public:image_resources_grit", + "//third_party/WebKit/public:scaled_resources_100_percent", "//chrome/renderer:resources_grit", "//components/resources:components_scaled_resources_grit", "//content/app/resources:resources_grit", @@ -62,11 +62,11 @@ repack("qtwebengine_repack_resources_200") { "$root_gen_dir/components/components_resources_200_percent.pak", "$root_gen_dir/content/app/resources/content_resources_200_percent.pak", "$root_gen_dir/chrome/renderer_resources_200_percent.pak", - "$root_gen_dir/blink/public/resources/blink_image_resources_200_percent.pak", + "$root_gen_dir/blink/public/resources/blink_scaled_resources_200_percent.pak", ] output = "$root_out_dir/qtwebengine_resources_200p.pak" deps = [ - "//third_party/WebKit/public:image_resources_grit", + "//third_party/WebKit/public:scaled_resources_200_percent", "//chrome/renderer:resources_grit", "//components/resources:components_scaled_resources_grit", "//content/app/resources:resources_grit", diff --git a/src/core/qtwebengine_sources.gni b/src/core/qtwebengine_sources.gni index a21193ecd12b958b681dea787288c556218c54b8..6d17838a64af16080988e1584addbc59ba5f243b 100644 --- a/src/core/qtwebengine_sources.gni +++ b/src/core/qtwebengine_sources.gni @@ -35,15 +35,19 @@ source_set("qtwebengine_spellcheck_sources") { source_set("qtwebengine_sources") { include_dirs = [ "//skia/config", + "//third_party/boringssl/src/include", "//third_party/skia/include/core" ] deps = [ + "//components/nacl/common:features", "//extensions/features:features", ] sources = [ "//chrome/browser/media/webrtc/desktop_media_list.h", "//chrome/browser/media/webrtc/desktop_streams_registry.cc", "//chrome/browser/media/webrtc/desktop_streams_registry.h", + "//chrome/browser/net/chrome_mojo_proxy_resolver_factory.cc", + "//chrome/browser/net/chrome_mojo_proxy_resolver_factory.h", "//chrome/browser/profiles/profile.cc", "//chrome/browser/profiles/profile.h", "//chrome/browser/ui/webui/devtools_ui.cc", @@ -64,8 +68,6 @@ source_set("qtwebengine_sources") { "//chrome/common/pref_names.h", "//chrome/common/url_constants.cc", "//chrome/common/url_constants.h", - "//components/prefs/in_memory_pref_store.cc", - "//components/prefs/in_memory_pref_store.h", "//extensions/common/constants.cc", "//extensions/common/constants.h", "//extensions/common/url_pattern.cc", diff --git a/src/core/render_view_observer_host_qt.cpp b/src/core/render_view_observer_host_qt.cpp index 643eba007086f948323886c5b2c8547f3e09b44a..c097e102dffbb88829352c994234c494145f241c 100644 --- a/src/core/render_view_observer_host_qt.cpp +++ b/src/core/render_view_observer_host_qt.cpp @@ -40,7 +40,9 @@ #include "render_view_observer_host_qt.h" #include "common/qt_messages.h" +#include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" + #include "render_widget_host_view_qt.h" #include "type_conversion.h" #include "web_contents_adapter_client.h" @@ -55,12 +57,16 @@ RenderViewObserverHostQt::RenderViewObserverHostQt(content::WebContents *webCont void RenderViewObserverHostQt::fetchDocumentMarkup(quint64 requestId) { - Send(new RenderViewObserverQt_FetchDocumentMarkup(routing_id(), requestId)); + web_contents()->GetRenderViewHost()->Send( + new RenderViewObserverQt_FetchDocumentMarkup( + web_contents()->GetRenderViewHost()->GetRoutingID(), requestId)); } void RenderViewObserverHostQt::fetchDocumentInnerText(quint64 requestId) { - Send(new RenderViewObserverQt_FetchDocumentInnerText(routing_id(), requestId)); + web_contents()->GetRenderViewHost()->Send( + new RenderViewObserverQt_FetchDocumentInnerText( + web_contents()->GetRenderViewHost()->GetRoutingID(), requestId)); } bool RenderViewObserverHostQt::OnMessageReceived(const IPC::Message& message) diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index f0cd9c0882366fb3dc35d15658430fcfe5cd468b..8986a34953905b09b1e77d0fe42d2494b4193b2f 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -52,7 +52,7 @@ #include "web_event_factory.h" #include "base/command_line.h" -#include "cc/output/direct_renderer.h" +#include "components/viz/service/display/direct_renderer.h" #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" #include "content/browser/accessibility/browser_accessibility_state_impl.h" #include "content/browser/browser_main_loop.h" @@ -67,7 +67,6 @@ #include "third_party/skia/include/core/SkColor.h" #include "third_party/WebKit/public/platform/WebColor.h" #include "third_party/WebKit/public/platform/WebCursorInfo.h" -#include "third_party/WebKit/public/web/WebCompositionUnderline.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" #include "ui/events/blink/blink_event_util.h" #include "ui/events/event.h" @@ -342,8 +341,8 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget , m_wheelAckPending(false) { auto* task_runner = base::ThreadTaskRunnerHandle::Get().get(); - m_beginFrameSource.reset(new cc::DelayBasedBeginFrameSource( - base::MakeUnique<cc::DelayBasedTimeSource>(task_runner))); + m_beginFrameSource.reset(new viz::DelayBasedBeginFrameSource( + base::MakeUnique<viz::DelayBasedTimeSource>(task_runner))); m_host->SetView(this); #ifndef QT_NO_ACCESSIBILITY @@ -353,6 +352,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget content::BrowserAccessibilityStateImpl::GetInstance()->EnableAccessibility(); } #endif // QT_NO_ACCESSIBILITY + if (GetTextInputManager()) GetTextInputManager()->AddObserver(this); @@ -724,7 +724,7 @@ bool RenderWidgetHostViewQt::HasAcceleratedSurface(const gfx::Size&) return false; } -void RenderWidgetHostViewQt::DidCreateNewRendererCompositorFrameSink(cc::mojom::CompositorFrameSinkClient *frameSink) +void RenderWidgetHostViewQt::DidCreateNewRendererCompositorFrameSink(viz::mojom::CompositorFrameSinkClient *frameSink) { // Accumulated resources belong to the old RendererCompositorFrameSink and // should not be returned. @@ -732,7 +732,7 @@ void RenderWidgetHostViewQt::DidCreateNewRendererCompositorFrameSink(cc::mojom:: m_rendererCompositorFrameSink = frameSink; } -void RenderWidgetHostViewQt::SubmitCompositorFrame(const viz::LocalSurfaceId &local_surface_id, cc::CompositorFrame frame) +void RenderWidgetHostViewQt::SubmitCompositorFrame(const viz::LocalSurfaceId &local_surface_id, viz::CompositorFrame frame) { bool scrollOffsetChanged = (m_lastScrollOffset != frame.metadata.root_scroll_offset); bool contentsSizeChanged = (m_lastContentsSize != frame.metadata.root_layer_size); @@ -1138,7 +1138,7 @@ void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWit void RenderWidgetHostViewQt::sendDelegatedFrameAck() { m_beginFrameSource->DidFinishFrame(this); - std::vector<cc::ReturnedResource> resources; + std::vector<viz::ReturnedResource> resources; m_resourcesToRelease.swap(resources); if (m_rendererCompositorFrameSink) m_rendererCompositorFrameSink->DidReceiveCompositorFrameAck(resources); @@ -1211,7 +1211,7 @@ void RenderWidgetHostViewQt::handleKeyEvent(QKeyEvent *ev) if (ev->type() == QEvent::KeyRelease) { m_receivedEmptyImeText = false; m_host->ImeSetComposition(toString16(ev->text()), - std::vector<ui::CompositionUnderline>(), + std::vector<ui::ImeTextSpan>(), gfx::Range::InvalidRange(), gfx::Range::InvalidRange().start(), gfx::Range::InvalidRange().end()); @@ -1262,7 +1262,7 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev) gfx::Range selectionRange = gfx::Range::InvalidRange(); const QList<QInputMethodEvent::Attribute> &attributes = ev->attributes(); - std::vector<ui::CompositionUnderline> underlines; + std::vector<ui::ImeTextSpan> underlines; bool hasSelection = false; for (const auto &attribute : attributes) { @@ -1287,7 +1287,7 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev) if (format.underlineStyle() != QTextCharFormat::NoUnderline) underlineColor = format.underlineColor(); - underlines.push_back(ui::CompositionUnderline(start, end, toSk(underlineColor), /*thick*/ false, SK_ColorTRANSPARENT)); + underlines.push_back(ui::ImeTextSpan(ui::ImeTextSpan::Type::kComposition, start, end, toSk(underlineColor), /*thick*/ false, SK_ColorTRANSPARENT)); break; } case QInputMethodEvent::Cursor: @@ -1672,7 +1672,7 @@ void RenderWidgetHostViewQt::updateNeedsBeginFramesInternal() m_addedFrameObserver = m_needsBeginFrames; } -bool RenderWidgetHostViewQt::OnBeginFrameDerivedImpl(const cc::BeginFrameArgs& args) +bool RenderWidgetHostViewQt::OnBeginFrameDerivedImpl(const viz::BeginFrameArgs& args) { m_beginFrameSource->OnUpdateVSyncParameters(args.frame_time, args.interval); if (m_rendererCompositorFrameSink) diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 1ac32456a472d5b36f8a6d071efbfc9a76e009ad..548142c84e8fe2743c696153be92e71c53dabad8 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -43,8 +43,8 @@ #include "render_widget_host_view_qt_delegate.h" #include "base/memory/weak_ptr.h" -#include "cc/scheduler/begin_frame_source.h" -#include "cc/resources/transferable_resource.h" +#include "components/viz/common/frame_sinks/begin_frame_source.h" +#include "components/viz/common/resources/transferable_resource.h" #include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/renderer_host/text_input_manager.h" @@ -102,7 +102,7 @@ class RenderWidgetHostViewQt , public ui::GestureProviderClient , public RenderWidgetHostViewQtDelegateClient , public base::SupportsWeakPtr<RenderWidgetHostViewQt> - , public cc::BeginFrameObserverBase + , public viz::BeginFrameObserverBase #ifndef QT_NO_ACCESSIBILITY , public QAccessible::ActivationObserver #endif // QT_NO_ACCESSIBILITY @@ -151,8 +151,8 @@ public: void Destroy() override; void SetTooltipText(const base::string16 &tooltip_text) override; bool HasAcceleratedSurface(const gfx::Size&) override; - void DidCreateNewRendererCompositorFrameSink(cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) override; - void SubmitCompositorFrame(const viz::LocalSurfaceId&, cc::CompositorFrame) override; + void DidCreateNewRendererCompositorFrameSink(viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) override; + void SubmitCompositorFrame(const viz::LocalSurfaceId&, viz::CompositorFrame) override; void WheelEventAck(const blink::WebMouseWheelEvent &event, content::InputEventAckState ack_result) override; void GetScreenInfo(content::ScreenInfo* results); @@ -180,7 +180,7 @@ public: void OnTextSelectionChanged(content::TextInputManager *text_input_manager, RenderWidgetHostViewBase *updated_view) override; // cc::BeginFrameObserverBase implementation. - bool OnBeginFrameDerivedImpl(const cc::BeginFrameArgs& args) override; + bool OnBeginFrameDerivedImpl(const viz::BeginFrameArgs& args) override; void OnBeginFrameSourcePausedChanged(bool paused) override; void handleMouseEvent(QMouseEvent*); @@ -243,14 +243,14 @@ private: std::unique_ptr<RenderWidgetHostViewQtDelegate> m_delegate; QExplicitlySharedDataPointer<ChromiumCompositorData> m_chromiumCompositorData; - std::vector<cc::ReturnedResource> m_resourcesToRelease; + std::vector<viz::ReturnedResource> m_resourcesToRelease; bool m_needsDelegatedFrameAck; LoadVisuallyCommittedState m_loadVisuallyCommittedState; QMetaObject::Connection m_adapterClientDestroyedConnection; WebContentsAdapterClient *m_adapterClient; MultipleMouseClickHelper m_clickHelper; - cc::mojom::CompositorFrameSinkClient *m_rendererCompositorFrameSink; + viz::mojom::CompositorFrameSinkClient *m_rendererCompositorFrameSink; bool m_imeInProgress; bool m_receivedEmptyImeText; @@ -258,7 +258,7 @@ private: bool m_initPending; - std::unique_ptr<cc::SyntheticBeginFrameSource> m_beginFrameSource; + std::unique_ptr<viz::SyntheticBeginFrameSource> m_beginFrameSource; bool m_needsBeginFrames; bool m_addedFrameObserver; diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 5980d7b84c301c73498a921ad78273ab77ba13f8..a77bcf7854f92989fffaed09d53aa3adb8d4a8df 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -49,10 +49,11 @@ #include "components/spellcheck/renderer/spellcheck_provider.h" #endif #include "components/cdm/renderer/widevine_key_system_properties.h" +#include "components/error_page/common/error.h" #include "components/error_page/common/error_page_params.h" #include "components/error_page/common/localized_error.h" #if BUILDFLAG(ENABLE_BASIC_PRINTING) -#include "components/printing/renderer/print_web_view_helper.h" +#include "components/printing/renderer/print_render_frame_helper.h" #endif // if BUILDFLAG(ENABLE_BASIC_PRINTING) #include "components/visitedlink/renderer/visitedlink_slave.h" #include "components/web_cache/renderer/web_cache_impl.h" @@ -136,7 +137,7 @@ void ContentRendererClientQt::RenderFrameCreated(content::RenderFrame* render_fr new SpellCheckProvider(render_frame, m_spellCheck.data()); #endif #if BUILDFLAG(ENABLE_BASIC_PRINTING) - new printing::PrintWebViewHelper( + new printing::PrintRenderFrameHelper( render_frame, base::WrapUnique(new PrintWebViewHelperDelegateQt())); #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -166,14 +167,13 @@ void ContentRendererClientQt::RunScriptsAtDocumentEnd(content::RenderFrame* rend UserResourceController::instance()->RunScriptsAtDocumentEnd(render_frame); } -bool ContentRendererClientQt::HasErrorPage(int httpStatusCode, std::string *errorDomain) +bool ContentRendererClientQt::HasErrorPage(int httpStatusCode) { // Use an internal error page, if we have one for the status code. - if (!error_page::LocalizedError::HasStrings(error_page::LocalizedError::kHttpErrorDomain, httpStatusCode)) { + if (!error_page::LocalizedError::HasStrings(error_page::Error::kHttpErrorDomain, httpStatusCode)) { return false; } - *errorDomain = error_page::LocalizedError::kHttpErrorDomain; return true; } @@ -182,6 +182,20 @@ bool ContentRendererClientQt::ShouldSuppressErrorPage(content::RenderFrame *fram return !(frame->GetWebkitPreferences().enable_error_page); } +std::string domain2String(blink::WebURLError::Domain domain) +{ + switch (domain) { + case blink::WebURLError::Domain::kEmpty: + return "(null)"; + case blink::WebURLError::Domain::kNet: + return "net"; + case blink::WebURLError::Domain::kTest: + return "testing"; + } + Q_UNREACHABLE(); + return std::string(); +} + // To tap into the chromium localized strings. Ripped from the chrome layer (highly simplified). void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderFrame* renderFrame, const blink::WebURLRequest &failedRequest, const blink::WebURLError &error, std::string *errorHtml, base::string16 *errorDescription) { @@ -196,12 +210,12 @@ void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderFrame* re // TODO(elproxy): We could potentially get better diagnostics here by first calling // NetErrorHelper::GetErrorStringsForDnsProbe, but that one is harder to untangle. - error_page::LocalizedError::GetStrings(error.reason, error.domain.Utf8(), error.unreachable_url, isPost - , error.stale_copy_in_cache && !isPost, false, false, locale - , std::unique_ptr<error_page::ErrorPageParams>(), &errorStrings); + error_page::LocalizedError::GetStrings( + error.reason, domain2String(error.domain), error.unreachable_url, isPost, + error.stale_copy_in_cache, false, false, + locale, std::unique_ptr<error_page::ErrorPageParams>(), &errorStrings); resourceId = IDR_NET_ERROR_HTML; - const base::StringPiece template_html(ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resourceId)); if (template_html.empty()) NOTREACHED() << "unable to load template. ID: " << resourceId; @@ -210,7 +224,7 @@ void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderFrame* re } if (errorDescription) - *errorDescription = error_page::LocalizedError::GetErrorDetails(error.domain.Utf8(), error.reason, isPost); + *errorDescription = error_page::LocalizedError::GetErrorDetails(domain2String(error.domain), error.reason, isPost); } unsigned long long ContentRendererClientQt::VisitedLinkHash(const char *canonicalUrl, size_t length) @@ -228,7 +242,7 @@ bool ContentRendererClientQt::IsLinkVisited(unsigned long long linkHash) // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE.Chromium file. -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) static const char kExternalClearKeyPepperType[] = "application/x-ppapi-clearkey-cdm"; static bool IsPepperCdmAvailable(const std::string& pepper_type, @@ -410,7 +424,7 @@ static void AddPepperBasedWidevine(std::vector<std::unique_ptr<media::KeySystemP void ContentRendererClientQt::AddSupportedKeySystems(std::vector<std::unique_ptr<media::KeySystemProperties>> *key_systems) { -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) AddExternalClearKey(key_systems); #if defined(WIDEVINE_CDM_AVAILABLE) diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index 45ad2e8729a934f58ced33f99b7af62224d95717..18cf129c25f1d1a47d758e19519724840f94abc6 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -66,7 +66,7 @@ public: void RenderViewCreated(content::RenderView *render_view) override; void RenderFrameCreated(content::RenderFrame* render_frame) override; bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) override; - bool HasErrorPage(int httpStatusCode, std::string *errorDomain) override; + bool HasErrorPage(int http_status_code) override; void GetNavigationErrorStrings(content::RenderFrame* renderFrame, const blink::WebURLRequest& failedRequest, const blink::WebURLError& error, std::string* errorHtml, base::string16* errorDescription) override; diff --git a/src/core/renderer/print_web_view_helper_delegate_qt.h b/src/core/renderer/print_web_view_helper_delegate_qt.h index 68e515d4d48ef8ca93db5168761a59c7422becf3..e3020922fc057366740ca9829b2455a933fae44a 100644 --- a/src/core/renderer/print_web_view_helper_delegate_qt.h +++ b/src/core/renderer/print_web_view_helper_delegate_qt.h @@ -44,7 +44,7 @@ #ifndef PRINT_WEB_VIEW_HELPER_DELEGATE_QT_H #define PRINT_WEB_VIEW_HELPER_DELEGATE_QT_H -#include "components/printing/renderer/print_web_view_helper.h" +#include "components/printing/renderer/print_render_frame_helper.h" namespace content { class RenderView; @@ -52,7 +52,7 @@ class RenderView; namespace QtWebEngineCore { -class PrintWebViewHelperDelegateQt : public printing::PrintWebViewHelper::Delegate +class PrintWebViewHelperDelegateQt : public printing::PrintRenderFrameHelper::Delegate { public: ~PrintWebViewHelperDelegateQt() override; diff --git a/src/core/renderer/user_resource_controller.cpp b/src/core/renderer/user_resource_controller.cpp index f858790536436004bbb131758b32e78c9799a705..eed5208766f003ec57feb53c4870ff963582339d 100644 --- a/src/core/renderer/user_resource_controller.cpp +++ b/src/core/renderer/user_resource_controller.cpp @@ -58,6 +58,8 @@ #include "type_conversion.h" #include "user_script.h" +#include <QRegularExpression> + Q_GLOBAL_STATIC(UserResourceController, qt_webengine_userResourceController) static content::RenderView * const globalScriptsIndex = 0; @@ -65,6 +67,28 @@ static content::RenderView * const globalScriptsIndex = 0; // Scripts meant to run after the load event will be run 500ms after DOMContentLoaded if the load event doesn't come within that delay. static const int afterLoadTimeout = 500; +static bool regexMatchesURL(const std::string &pat, const GURL &url) { + QRegularExpression qre(QtWebEngineCore::toQt(pat)); + qre.setPatternOptions(QRegularExpression::CaseInsensitiveOption); + if (!qre.isValid()) + return false; + return qre.match(QtWebEngineCore::toQt(url.spec())).hasMatch(); +} + +static bool includeRuleMatchesURL(const std::string &pat, const GURL &url) +{ + // Match patterns for greasemonkey's @include and @exclude rules which can + // be either strings with wildcards or regular expressions. + if (pat.front() == '/' && pat.back() == '/') { + std::string re(++pat.cbegin(), --pat.cend()); + if (regexMatchesURL(re, url)) + return true; + } else if (base::MatchPattern(url.spec(), pat)) { + return true; + } + return false; +} + static bool scriptMatchesURL(const UserScriptData &scriptData, const GURL &url) { // Logic taken from Chromium (extensions/common/user_script.cc) bool matchFound; @@ -82,7 +106,7 @@ static bool scriptMatchesURL(const UserScriptData &scriptData, const GURL &url) if (!scriptData.globs.empty()) { matchFound = false; for (auto it = scriptData.globs.begin(), end = scriptData.globs.end(); it != end; ++it) { - if (base::MatchPattern(url.spec(), *it)) + if (includeRuleMatchesURL(*it, url)) matchFound = true; } if (!matchFound) @@ -91,7 +115,7 @@ static bool scriptMatchesURL(const UserScriptData &scriptData, const GURL &url) if (!scriptData.excludeGlobs.empty()) { for (auto it = scriptData.excludeGlobs.begin(), end = scriptData.excludeGlobs.end(); it != end; ++it) { - if (base::MatchPattern(url.spec(), *it)) + if (includeRuleMatchesURL(*it, url)) return false; } } @@ -110,7 +134,7 @@ private: // RenderFrameObserver implementation. void DidFinishDocumentLoad() override; void DidFinishLoad() override; - void DidStartProvisionalLoad(blink::WebDataSource* data_source) override; + void DidStartProvisionalLoad(blink::WebDocumentLoader *document_loader) override; void FrameDetached() override; void OnDestruct() override; bool OnMessageReceived(const IPC::Message& message) override; @@ -217,9 +241,9 @@ void UserResourceController::RenderFrameObserverHelper::DidFinishLoad() m_weakPtrFactory.GetWeakPtr(), UserScriptData::AfterLoad, frame)); } -void UserResourceController::RenderFrameObserverHelper::DidStartProvisionalLoad(blink::WebDataSource *data_source) +void UserResourceController::RenderFrameObserverHelper::DidStartProvisionalLoad(blink::WebDocumentLoader *document_loader) { - Q_UNUSED(data_source); + Q_UNUSED(document_loader); blink::WebLocalFrame *frame = render_frame()->GetWebFrame(); m_pendingFrames.remove(frame); } diff --git a/src/core/renderer_host/user_resource_controller_host.cpp b/src/core/renderer_host/user_resource_controller_host.cpp index 2799d5d8556667fa69e1255107f8e189eb7e3bd1..a9071df8f7260c0f7ca0041383e43fd40dfca7db 100644 --- a/src/core/renderer_host/user_resource_controller_host.cpp +++ b/src/core/renderer_host/user_resource_controller_host.cpp @@ -142,9 +142,10 @@ void UserResourceControllerHost::addUserScript(const UserScript &script, WebCont m_perContentsScripts.insert(contents, currentScripts); } } - contents->Send(new RenderFrameObserverHelper_AddScript(contents->GetRenderViewHost()-> - GetMainFrame()->GetRoutingID(), - script.data())); + contents->GetRenderViewHost()->Send( + new RenderFrameObserverHelper_AddScript( + contents->GetRenderViewHost()->GetMainFrame()->GetRoutingID(), + script.data())); } } @@ -180,9 +181,10 @@ bool UserResourceControllerHost::removeUserScript(const UserScript &script, WebC QList<UserScript>::iterator it = std::find(list.begin(), list.end(), script); if (it == list.end()) return false; - contents->Send(new RenderFrameObserverHelper_RemoveScript(contents-> - GetMainFrame()->GetRoutingID(), - (*it).data())); + contents->GetRenderViewHost()->Send( + new RenderFrameObserverHelper_RemoveScript( + contents->GetMainFrame()->GetRoutingID(), + (*it).data())); list.erase(it); } return true; @@ -198,8 +200,8 @@ void UserResourceControllerHost::clearAllScripts(WebContentsAdapter *adapter) } else { content::WebContents *contents = adapter->webContents(); m_perContentsScripts.remove(contents); - contents->Send(new RenderFrameObserverHelper_ClearScripts(contents-> - GetMainFrame()->GetRoutingID())); + contents->GetRenderViewHost()->Send( + new RenderFrameObserverHelper_ClearScripts(contents->GetMainFrame()->GetRoutingID())); } } diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp index c47b255b7b20ff06df666dc41e659622c859543d..b624d7e454d5322b9083e379bd80cb7a9c30edf5 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp +++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp @@ -41,6 +41,7 @@ #include "base/strings/string16.h" #include "content/public/browser/render_view_host.h" +#include "content/public/browser/web_contents.h" #include "common/qt_messages.h" #include "type_conversion.h" @@ -55,7 +56,10 @@ WebChannelIPCTransportHost::WebChannelIPCTransportHost(content::WebContents *con , content::WebContentsObserver(contents) , m_worldId(worldId) { - Send(new WebChannelIPCTransport_Install(routing_id(), m_worldId)); + contents->GetRenderViewHost()->Send( + new WebChannelIPCTransport_Install( + contents->GetRenderViewHost()->GetRoutingID(), + m_worldId)); } WebChannelIPCTransportHost::~WebChannelIPCTransportHost() @@ -78,9 +82,15 @@ void WebChannelIPCTransportHost::setWorldId(uint worldId) { if (worldId == m_worldId) return; - Send(new WebChannelIPCTransport_Uninstall(routing_id(), m_worldId)); + web_contents()->GetRenderViewHost()->Send( + new WebChannelIPCTransport_Uninstall( + web_contents()->GetRenderViewHost()->GetRoutingID(), + m_worldId)); m_worldId = worldId; - Send(new WebChannelIPCTransport_Install(routing_id(), m_worldId)); + web_contents()->GetRenderViewHost()->Send( + new WebChannelIPCTransport_Install( + web_contents()->GetRenderViewHost()->GetRoutingID(), + m_worldId)); } void WebChannelIPCTransportHost::sendMessage(const QJsonObject &message) @@ -88,7 +98,11 @@ void WebChannelIPCTransportHost::sendMessage(const QJsonObject &message) QJsonDocument doc(message); int size = 0; const char *rawData = doc.rawData(&size); - Send(new WebChannelIPCTransport_Message(routing_id(), std::vector<char>(rawData, rawData + size), m_worldId)); + web_contents()->GetRenderViewHost()->Send( + new WebChannelIPCTransport_Message( + web_contents()->GetRenderViewHost()->GetRoutingID(), + std::vector<char>(rawData, rawData + size), + m_worldId)); } void WebChannelIPCTransportHost::onWebChannelMessage(const std::vector<char> &message) diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index 22d626e967c6991887841f49815bac3228e2a660..fd0f247353f81dafbc5a0ab76ea302ccc2b1a631 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -42,8 +42,10 @@ #include "base/command_line.h" #include "base/memory/ptr_util.h" #include "base/strings/string_util.h" -#include "base/threading/worker_pool.h" +#include "base/task_scheduler/post_task.h" #include "base/threading/sequenced_worker_pool.h" +#include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h" +#include "content/network/proxy_service_mojo.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/cookie_store_factory.h" #include "content/public/common/content_features.h" @@ -66,8 +68,6 @@ #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" #include "net/proxy/proxy_script_fetcher_impl.h" #include "net/proxy/proxy_service.h" -#include "net/proxy/proxy_service_v8.h" -#include "net/proxy/proxy_resolver_v8.h" #include "net/ssl/channel_id_service.h" #include "net/ssl/default_channel_id_store.h" #include "net/ssl/ssl_config_service_defaults.h" @@ -224,12 +224,15 @@ void URLRequestContextGetterQt::generateStorage() // We must stop all requests before deleting their backends. if (m_storage) { + m_cookieDelegate->setCookieMonster(0); + m_storage->set_cookie_store(0); cancelAllUrlRequests(); // we need to get rid of dangling pointer due to coming storage deletion m_urlRequestContext->set_http_transaction_factory(0); m_httpNetworkSession.reset(); } + m_storage.reset(new net::URLRequestContextStorage(m_urlRequestContext.get())); net::ProxyConfigService *proxyConfigService = m_proxyConfigService.fetchAndStoreAcquire(0); @@ -248,12 +251,13 @@ void URLRequestContextGetterQt::generateStorage() if (!m_dhcpProxyScriptFetcherFactory) m_dhcpProxyScriptFetcherFactory.reset(new net::DhcpProxyScriptFetcherFactory); - m_storage->set_proxy_service(net::CreateProxyServiceUsingV8ProxyResolver( + m_storage->set_proxy_service(content::CreateProxyServiceUsingMojoFactory( + ChromeMojoProxyResolverFactory::GetInstance(), std::unique_ptr<net::ProxyConfigService>(proxyConfigService), new net::ProxyScriptFetcherImpl(m_urlRequestContext.get()), m_dhcpProxyScriptFetcherFactory->Create(m_urlRequestContext.get()), host_resolver.get(), - NULL /* NetLog */, + nullptr /* NetLog */, m_networkDelegate.get())); m_storage->set_ssl_config_service(new net::SSLConfigServiceDefaults); @@ -303,8 +307,8 @@ void URLRequestContextGetterQt::generateCookieStore() if (!m_channelIdPath.isEmpty() && m_persistentCookiesPolicy != BrowserContextAdapter::NoPersistentCookies) { channel_id_db = new net::SQLiteChannelIDStore( toFilePath(m_channelIdPath), - BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( - BrowserThread::GetBlockingPool()->GetSequenceToken())); + base::CreateSequencedTaskRunnerWithTraits( + {base::MayBlock(), base::TaskPriority::BACKGROUND})); } m_storage->set_channel_id_service( @@ -312,47 +316,44 @@ void URLRequestContextGetterQt::generateCookieStore() new net::DefaultChannelIDStore(channel_id_db.get())))); // Unset it first to get a chance to destroy and flush the old cookie store before opening a new on possibly the same file. - m_storage->set_cookie_store(0); m_cookieDelegate->setCookieMonster(0); + m_storage->set_cookie_store(0); std::unique_ptr<net::CookieStore> cookieStore; switch (m_persistentCookiesPolicy) { case BrowserContextAdapter::NoPersistentCookies: - cookieStore = - content::CreateCookieStore(content::CookieStoreConfig( + cookieStore = content::CreateCookieStore( + content::CookieStoreConfig( base::FilePath(), content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, - NULL, - m_cookieDelegate.get()) - ); + nullptr) + ); break; case BrowserContextAdapter::AllowPersistentCookies: - cookieStore = - content::CreateCookieStore(content::CookieStoreConfig( + cookieStore = content::CreateCookieStore( + content::CookieStoreConfig( toFilePath(m_cookiesPath), content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, - NULL, - m_cookieDelegate.get()) + nullptr) ); break; case BrowserContextAdapter::ForcePersistentCookies: - cookieStore = - content::CreateCookieStore(content::CookieStoreConfig( + cookieStore = content::CreateCookieStore( + content::CookieStoreConfig( toFilePath(m_cookiesPath), content::CookieStoreConfig::RESTORED_SESSION_COOKIES, - NULL, - m_cookieDelegate.get()) + nullptr) ); break; } net::CookieMonster * const cookieMonster = static_cast<net::CookieMonster*>(cookieStore.get()); cookieStore->SetChannelIDServiceID(m_urlRequestContext->channel_id_service()->GetUniqueID()); + m_cookieDelegate->setCookieMonster(cookieMonster); m_storage->set_cookie_store(std::move(cookieStore)); const std::vector<std::string> cookieableSchemes(kCookieableSchemes, kCookieableSchemes + arraysize(kCookieableSchemes)); cookieMonster->SetCookieableSchemes(cookieableSchemes); - m_cookieDelegate->setCookieMonster(cookieMonster); if (!m_updateAllStorage && m_updateHttpCache) { // HttpCache needs to be regenerated when we generate a new channel id service @@ -509,8 +510,7 @@ void URLRequestContextGetterQt::generateHttpCache() net::MEMORY_CACHE, net::CACHE_BACKEND_DEFAULT, base::FilePath(), - m_httpCacheMaxSize, - BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE) + m_httpCacheMaxSize ); break; case BrowserContextAdapter::DiskHttpCache: @@ -519,8 +519,7 @@ void URLRequestContextGetterQt::generateHttpCache() net::DISK_CACHE, net::CACHE_BACKEND_DEFAULT, toFilePath(m_httpCachePath), - m_httpCacheMaxSize, - BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE) + m_httpCacheMaxSize ); break; case BrowserContextAdapter::NoCache: @@ -559,9 +558,11 @@ void URLRequestContextGetterQt::generateJobFactory() m_protocolHandlers.clear(); jobFactory->SetProtocolHandler(url::kDataScheme, std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>(new net::DataProtocolHandler())); - jobFactory->SetProtocolHandler(url::kFileScheme, std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>(new net::FileProtocolHandler( - content::BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( - base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)))); + jobFactory->SetProtocolHandler(url::kFileScheme, + std::make_unique<net::FileProtocolHandler>( + base::CreateTaskRunnerWithTraits({base::MayBlock(), + base::TaskPriority::BACKGROUND, + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))); jobFactory->SetProtocolHandler(kQrcSchemeQt, std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>(new QrcProtocolHandlerQt())); jobFactory->SetProtocolHandler(url::kFtpScheme, net::FtpProtocolHandler::Create(m_urlRequestContext->host_resolver())); diff --git a/src/core/user_script.cpp b/src/core/user_script.cpp index b33dd6a7db34c6138acec1662791145cf583c203..9b9d66d556780ac5a0983b410d921e8d6e500d1c 100644 --- a/src/core/user_script.cpp +++ b/src/core/user_script.cpp @@ -244,13 +244,20 @@ void UserScript::parseMetadataHeader() if (GetDeclarationValue(line, kNameDeclaration, &value)) { setName(toQt(value)); } else if (GetDeclarationValue(line, kIncludeDeclaration, &value)) { - // We escape some characters that MatchPattern() considers special. - base::ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); - base::ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); + if (value.front() != '/' || value.back() != '/') { + // The greasemonkey spec only allows for wildcards (*), so + // escape the additional things which MatchPattern allows. + base::ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); + base::ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); + } scriptData->globs.push_back(value); } else if (GetDeclarationValue(line, kExcludeDeclaration, &value)) { - base::ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); - base::ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); + if (value.front() != '/' || value.back() != '/') { + // The greasemonkey spec only allows for wildcards (*), so + // escape the additional things which MatchPattern allows. + base::ReplaceSubstringsAfterOffset(&value, 0, "\\", "\\\\"); + base::ReplaceSubstringsAfterOffset(&value, 0, "?", "\\?"); + } scriptData->excludeGlobs.push_back(value); } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) { if (URLPattern::PARSE_SUCCESS == urlPatternParser.Parse(value)) diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 668e791c15622a7a18fff85af0a56bf782fc614e..f87cc115b651b8d7d33a1cf189af2a177eca9342 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -389,7 +389,7 @@ QSharedPointer<WebContentsAdapter> WebContentsAdapter::createFromSerializedNavig // Set up the file access rights for the selected navigation entry. // TODO(joth): This is duplicated from chrome/.../session_restore.cc and // should be shared e.g. in NavigationController. http://crbug.com/68222 - const int id = newWebContents->GetRenderProcessHost()->GetID(); + const int id = newWebContents->GetMainFrame()->GetProcess()->GetID(); const content::PageState& pageState = controller.GetActiveEntry()->GetPageState(); const std::vector<base::FilePath>& filePaths = pageState.GetReferencedFiles(); for (std::vector<base::FilePath>::const_iterator file = filePaths.begin(); file != filePaths.end(); ++file) @@ -478,7 +478,7 @@ void WebContentsAdapter::initialize(WebContentsAdapterClient *adapterClient) content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); Q_ASSERT(rvh); if (!rvh->IsRenderViewLive()) - static_cast<content::WebContentsImpl*>(d->webContents.get())->CreateRenderViewForRenderManager(rvh, MSG_ROUTING_NONE, MSG_ROUTING_NONE, content::FrameReplicationState()); + static_cast<content::WebContentsImpl*>(d->webContents.get())->CreateRenderViewForRenderManager(rvh, MSG_ROUTING_NONE, MSG_ROUTING_NONE, base::UnguessableToken::Create(), content::FrameReplicationState()); } void WebContentsAdapter::reattachRWHV() @@ -707,7 +707,9 @@ QString WebContentsAdapter::pageTitle() const QString WebContentsAdapter::selectedText() const { Q_D(const WebContentsAdapter); - return toQt(d->webContents->GetRenderWidgetHostView()->GetSelectedText()); + if (auto *rwhv = d->webContents->GetRenderWidgetHostView()) + return toQt(rwhv->GetSelectedText()); + return QString(); } void WebContentsAdapter::undo() @@ -853,7 +855,7 @@ void WebContentsAdapter::setZoomFactor(qreal factor) content::HostZoomMap *zoomMap = content::HostZoomMap::GetForWebContents(d->webContents.get()); if (zoomMap) { - int render_process_id = d->webContents->GetRenderProcessHost()->GetID(); + int render_process_id = d->webContents->GetMainFrame()->GetProcess()->GetID(); int render_view_id = d->webContents->GetRenderViewHost()->GetRoutingID(); zoomMap->SetTemporaryZoomLevel(render_process_id, render_view_id, zoomLevel); } @@ -884,6 +886,8 @@ QAccessibleInterface *WebContentsAdapter::browserAccessible() content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); Q_ASSERT(rvh); content::BrowserAccessibilityManager *manager = static_cast<content::RenderFrameHostImpl*>(rvh->GetMainFrame())->GetOrCreateBrowserAccessibilityManager(); + if (!manager) // FIXME! + return nullptr; content::BrowserAccessibility *acc = manager->GetRoot(); content::BrowserAccessibilityQt *accQt = static_cast<content::BrowserAccessibilityQt*>(acc); return accQt; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 7b765d99baa2850ee12b2ea1b5808b9a2fe8144b..5364afa94f2b7d8bbbdb8f7269cfe807d8cfc6cb 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -219,16 +219,6 @@ void WebContentsDelegateQt::DidStartNavigation(content::NavigationHandle *naviga if (!navigation_handle->IsInMainFrame()) return; - // Suppress extra loadStarted signal for data URL with specified base URL. - if (navigation_handle->GetURL().SchemeIs(url::kDataScheme)) { - content::NavigationEntry *pending_entry = navigation_handle->GetWebContents()->GetController().GetPendingEntry(); - - if (pending_entry && !pending_entry->GetBaseURLForDataURL().is_empty() && - navigation_handle->GetURL() == pending_entry->GetURL()) { - return; - } - } - // Error-pages are not reported as separate started navigations. Q_ASSERT(!navigation_handle->IsErrorPage()); @@ -295,9 +285,8 @@ void WebContentsDelegateQt::didFailLoad(const QUrl &url, int errorCode, const QS EmitLoadFinished(false /* success */ , url, false /* isErrorPage */, errorCode, errorDescription); } -void WebContentsDelegateQt::DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, const base::string16& error_description, bool was_ignored_by_handler) +void WebContentsDelegateQt::DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, const base::string16& error_description) { - Q_UNUSED(was_ignored_by_handler); if (render_frame_host->GetParent()) return; @@ -460,7 +449,7 @@ void WebContentsDelegateQt::UpdateTargetURL(content::WebContents* source, const void WebContentsDelegateQt::WasShown() { - web_cache::WebCacheManager::GetInstance()->ObserveActivity(web_contents()->GetRenderProcessHost()->GetID()); + web_cache::WebCacheManager::GetInstance()->ObserveActivity(web_contents()->GetMainFrame()->GetProcess()->GetID()); } void WebContentsDelegateQt::DidFirstVisuallyNonEmptyPaint() diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index c056d36abf1e193dd0ecfc0e04296c875cd6f66d..7e21e4b55d8d3edb8de0176517a1150f586a8b0f 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -133,8 +133,7 @@ public: void RenderFrameDeleted(content::RenderFrameHost *render_frame_host) override; void DidStartNavigation(content::NavigationHandle *navigation_handle) override; void DidFinishNavigation(content::NavigationHandle *navigation_handle) override; - void DidFailLoad(content::RenderFrameHost *render_frame_host, const GURL &validated_url, - int error_code, const base::string16 &error_description, bool was_ignored_by_handler) override; + void DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, const base::string16& error_description) override; void DidFinishLoad(content::RenderFrameHost *render_frame_host, const GURL &validated_url) override; void BeforeUnloadFired(const base::TimeTicks& proceed_time) override; void DidUpdateFaviconURL(const std::vector<content::FaviconURL> &candidates) override; diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 84f6ce738b0b47ccd47a4f351cdc16c9b79cfcb1..a10aef1150a6cc6608f55d29c05ee188818ba983 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -377,6 +377,8 @@ WebEngineContext::WebEngineContext() // upstream Chromium commit ba52f56207a4b9d70b34880fbff2352e71a06422. parsedCommandLine->AppendSwitchASCII(switches::kEnableFeatures, features::kAllowContentInitiatedDataUrlNavigations.name); + // If the renderer renders the validation messages, we no longer get the callbacks we have in the API. + parsedCommandLine->AppendSwitchASCII(switches::kDisableBlinkFeatures, "ValidationBubbleInRenderer"); if (useEmbeddedSwitches) { parsedCommandLine->AppendSwitchASCII(switches::kEnableFeatures, features::kOverlayScrollbar.name); @@ -388,8 +390,10 @@ WebEngineContext::WebEngineContext() parsedCommandLine->AppendSwitch(switches::kDisableGpuShaderDiskCache); parsedCommandLine->AppendSwitch(switches::kDisable2dCanvasAntialiasing); parsedCommandLine->AppendSwitch(cc::switches::kDisableCompositedAntialiasing); - parsedCommandLine->AppendSwitchASCII(switches::kProfilerTiming, switches::kProfilerTimingDisabledValue); } + base::FeatureList::InitializeInstance( + parsedCommandLine->GetSwitchValueASCII(switches::kEnableFeatures), + parsedCommandLine->GetSwitchValueASCII(switches::kDisableFeatures)); GLContextHelper::initialize(); @@ -464,8 +468,9 @@ WebEngineContext::WebEngineContext() } } - if (qt_gl_global_share_context()->format().profile() == QSurfaceFormat::CompatibilityProfile) - parsedCommandLine->AppendSwitch(switches::kCreateDefaultGLContext); +// FIXME: +// if (qt_gl_global_share_context()->format().profile() == QSurfaceFormat::CompatibilityProfile) +// parsedCommandLine->AppendSwitch(switches::kCreateDefaultGLContext); } else { qWarning("WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed."); } diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index b2b89c78d3ea001bcd22c4e7fce280ee64a78608..d16c2bd156ae87c41bc5e48be9b6d57fb6d1f292 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -278,7 +278,7 @@ void WebEngineSettings::initDefaults() bool smoothScrolling = commandLine->HasSwitch(switches::kEnableSmoothScrolling); bool webGL = content::GpuProcessHost::gpu_enabled() && !commandLine->HasSwitch(switches::kDisable3DAPIs) && - !commandLine->HasSwitch(switches::kDisableExperimentalWebGL); + !commandLine->HasSwitch(switches::kDisableWebGL); bool accelerated2dCanvas = content::GpuProcessHost::gpu_enabled() && !commandLine->HasSwitch(switches::kDisableAccelerated2dCanvas); bool allowRunningInsecureContent = commandLine->HasSwitch(switches::kAllowRunningInsecureContent); @@ -379,7 +379,7 @@ void WebEngineSettings::applySettingsToWebPreferences(content::WebPreferences *p prefs->plugins_enabled = testAttribute(PluginsEnabled); prefs->fullscreen_supported = testAttribute(FullScreenSupportEnabled); prefs->accelerated_2d_canvas_enabled = testAttribute(Accelerated2dCanvasEnabled); - prefs->experimental_webgl_enabled = testAttribute(WebGLEnabled); + prefs->webgl1_enabled = prefs->webgl2_enabled = testAttribute(WebGLEnabled); prefs->should_print_backgrounds = testAttribute(PrintElementBackgrounds); prefs->allow_running_insecure_content = testAttribute(AllowRunningInsecureContent); prefs->allow_geolocation_on_insecure_origins = testAttribute(AllowGeolocationOnInsecureOrigins); diff --git a/src/core/yuv_video_node.cpp b/src/core/yuv_video_node.cpp index 9e69130f228487b8e180243afce09146a9d41e3d..81afa5674fd098d3ea7625a0c562053c19ec19b3 100644 --- a/src/core/yuv_video_node.cpp +++ b/src/core/yuv_video_node.cpp @@ -66,7 +66,7 @@ public: protected: const char *vertexShader() const override { - // Keep in sync with cc::VertexShaderPosTexYUVStretchOffset + // Keep in sync with logic in VertexShader in components/viz/service/display/shader.cc const char *shader = "attribute highp vec4 a_position;\n" "attribute mediump vec2 a_texCoord;\n" @@ -86,7 +86,7 @@ protected: } const char *fragmentShader() const override { - // Keep in sync with cc::FragmentShaderYUVVideo + // Keep in sync with logic in FragmentShader in components/viz/service/display/shader.cc static const char *shader = "varying mediump vec2 v_yaTexCoord;\n" "varying mediump vec2 v_uvTexCoord;\n" diff --git a/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro b/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro index 55b78c69670768eb24a6046620fe0d957148d4fc..47b7d4ff745e2079903f9f36e73974f1be4ee3a6 100644 --- a/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro +++ b/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro @@ -36,7 +36,8 @@ win32: QMAKE_CXXFLAGS_WARN_ON = -wd4577 win32: DEFINES += NOMINMAX CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir() -INCLUDEPATH += $$CHROMIUM_SRC_DIR +INCLUDEPATH += $$CHROMIUM_SRC_DIR \ + $$OUT_PWD/../../core/$$getConfigDir()/gen SOURCES += \ main.cpp diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 3a63b87089bccd82522d1a0ff61d590f359fb91c..1a979df00a8b44381736ed312773f82d9aa6f67a 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -383,8 +383,14 @@ void QQuickWebEngineViewPrivate::loadStarted(const QUrl &provisionalUrl, bool is isLoading = true; m_history->reset(); m_certificateErrorControllers.clear(); - QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus); - Q_EMIT q->loadingChanged(&loadRequest); + + QPointer<QQuickWebEngineView> pq(q); + QTimer::singleShot(0, [=]() + { + QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus); + if (pq) + pq->loadingChanged(&loadRequest); + }); } void QQuickWebEngineViewPrivate::loadCommitted() diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp index 926c3e0429a5735b6c0f20076859bc67e7485c50..50a3e6ff6d48b7246d6852f3bde905a2f720f61c 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp @@ -88,6 +88,9 @@ public: void interceptRequest(QWebEngineUrlRequestInfo &info) override { + // Since 63 we also intercept some unrelated blob requests.. + if (info.requestUrl().scheme() == QLatin1String("blob")) + return; info.block(info.requestMethod() != QByteArrayLiteral("GET")); if (shouldIntercept && info.requestUrl().toString().endsWith(QLatin1String("__placeholder__"))) info.redirect(QUrl("qrc:///resources/content.html")); @@ -152,6 +155,9 @@ public: void interceptRequest(QWebEngineUrlRequestInfo &info) override { + // Since 63 we also intercept the original data requests + if (info.requestUrl().scheme() == QLatin1String("data")) + return; if (info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeFavicon) return; diff --git a/tests/auto/quick/qmltests/data/TestWebEngineView.qml b/tests/auto/quick/qmltests/data/TestWebEngineView.qml index cadad4e270e0fa6475ed53f165a6df0440f5d474..f5e83c5d25fa32fbdfe5ce7cb48c968c5669dd28 100644 --- a/tests/auto/quick/qmltests/data/TestWebEngineView.qml +++ b/tests/auto/quick/qmltests/data/TestWebEngineView.qml @@ -35,26 +35,27 @@ WebEngineView { property bool windowCloseRequestedSignalEmitted: false settings.focusOnNavigationEnabled: true - function waitForLoadSucceeded() { - var success = _waitFor(function() { return loadStatus == WebEngineView.LoadSucceededStatus }) + function waitForLoadSucceeded(timeout) { + var success = _waitFor(function() { return loadStatus == WebEngineView.LoadSucceededStatus }, timeout) loadStatus = null return success } - function waitForLoadFailed() { - var failure = _waitFor(function() { return loadStatus == WebEngineView.LoadFailedStatus }) + function waitForLoadFailed(timeout) { + var failure = _waitFor(function() { return loadStatus == WebEngineView.LoadFailedStatus }, timeout) loadStatus = null return failure } - function waitForLoadStopped() { - var stop = _waitFor(function() { return loadStatus == WebEngineView.LoadStoppedStatus }) + function waitForLoadStopped(timeout) { + var stop = _waitFor(function() { return loadStatus == WebEngineView.LoadStoppedStatus }, timeout) loadStatus = null return stop } function waitForWindowCloseRequested() { return _waitFor(function() { return windowCloseRequestedSignalEmitted; }); } - function _waitFor(predicate) { - var timeout = 12000 + function _waitFor(predicate, timeout) { + if (timeout === undefined) + timeout = 12000; var i = 0 while (i < timeout && !predicate()) { testResult.wait(50) diff --git a/tests/auto/quick/qmltests/data/script-with-metadata.js b/tests/auto/quick/qmltests/data/script-with-metadata.js index 4dcf50f554b2908598afcbe4cdcd1cc72a234c14..de2e3974c22a0e376f08776e9f59b2e6c473fdff 100644 --- a/tests/auto/quick/qmltests/data/script-with-metadata.js +++ b/tests/auto/quick/qmltests/data/script-with-metadata.js @@ -2,8 +2,10 @@ // @name Test script // @homepageURL http://www.qt.io/ // @description Test script with metadata block -// @include *test*.html +// @include *data/test*.html +// @include /favicon.html?$/ // @exclude *test2.html +// @exclude /test[-]iframe/ // @run-at document-end // ==/UserScript== diff --git a/tests/auto/quick/qmltests/data/tst_favicon.qml b/tests/auto/quick/qmltests/data/tst_favicon.qml index 1159f31943d39c0770296fa6cae673b5c9110a25..6f8adeb67b120acbcc981a9c213d00ede9acea9d 100644 --- a/tests/auto/quick/qmltests/data/tst_favicon.qml +++ b/tests/auto/quick/qmltests/data/tst_favicon.qml @@ -179,7 +179,7 @@ TestWebEngineView { compare(iconChangedSpy.count, 0) - var url = Qt.resolvedUrl("invalid://url") + var url = Qt.resolvedUrl("http://url.invalid") webEngineView.url = url verify(webEngineView.waitForLoadFailed()) verify(webEngineView.testSupport.waitForErrorPageLoadSucceeded()) @@ -195,7 +195,7 @@ TestWebEngineView { compare(iconChangedSpy.count, 0) - var url = Qt.resolvedUrl("invalid://url") + var url = Qt.resolvedUrl("http://url.invalid") webEngineView.url = url verify(webEngineView.waitForLoadFailed()) diff --git a/tests/auto/quick/qmltests/data/tst_loadFail.qml b/tests/auto/quick/qmltests/data/tst_loadFail.qml index 47f4a2862f5451e85f73b701767d38c0f067c2f3..7b51009a1540e8a8e7bf37baf3063065dec893bd 100644 --- a/tests/auto/quick/qmltests/data/tst_loadFail.qml +++ b/tests/auto/quick/qmltests/data/tst_loadFail.qml @@ -128,14 +128,14 @@ TestWebEngineView { loadRequest = loadRequestArray[2] compare(loadRequest.status, WebEngineView.LoadStartedStatus) compare(loadRequest.errorDomain, WebEngineView.NoErrorDomain) - compare(loadRequest.url, "data:text/html,chromewebdata") + compare(loadRequest.url, "chrome-error://chromewebdata/") verify(loadRequest.isErrorPage) // Loading of the error page must be successful loadRequest = loadRequestArray[3] compare(loadRequest.status, WebEngineView.LoadSucceededStatus) compare(loadRequest.errorDomain, WebEngineView.NoErrorDomain) - compare(loadRequest.url, "data:text/html,chromewebdata") + compare(loadRequest.url, "chrome-error://chromewebdata/") verify(loadRequest.isErrorPage) compare(webEngineView.url, unavailableUrl) diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml index 80d7a18b35efcdaa017e0a7db2dac7ac2a864a3c..37ba4da43e208d0931fbdf3d863f96bba551ddc3 100644 --- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml +++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml @@ -209,7 +209,7 @@ TestWebEngineView { var bogusSite = "http://www.somesitethatdoesnotexist.abc/"; var handleLoadFailed = function(loadRequest) { - if (loadRequest.status == WebEngineView.LoadFailedStatus) { + if (loadRequest.status === WebEngineView.LoadFailedStatus) { // loadHtml constructs data URL webEngineView.loadHtml("load failed", bogusSite); compare(loadRequest.url, bogusSite); @@ -231,7 +231,7 @@ TestWebEngineView { loadRequest = loadRequestArray[2]; compare(loadRequest.status, WebEngineView.LoadStartedStatus); compare(loadRequest.activeUrl, aboutBlank); - compare(loadRequest.url, bogusSite) + compare(loadRequest.url, "data:text/html;charset=UTF-8,load failed") loadRequest = loadRequestArray[3]; compare(loadRequest.status, WebEngineView.LoadSucceededStatus); compare(loadRequest.activeUrl, bogusSite); @@ -262,7 +262,7 @@ TestWebEngineView { var loadRequest = null; var handleLoadStarted = function(loadRequest) { - if (loadRequest.status == WebEngineView.LoadStartedStatus) + if (loadRequest.status === WebEngineView.LoadStartedStatus) webEngineView.stop(); } webEngineView.loadingChanged.connect(handleLoadStarted); diff --git a/tests/auto/quick/qmltests/data/tst_userScripts.qml b/tests/auto/quick/qmltests/data/tst_userScripts.qml index e9a4eba994030295137c575d4516ddc5166dc796..d7c7d59832bd5186cd40bfa54c42ec2aa077c6f9 100644 --- a/tests/auto/quick/qmltests/data/tst_userScripts.qml +++ b/tests/auto/quick/qmltests/data/tst_userScripts.qml @@ -170,7 +170,7 @@ Item { webEngineView.userScripts = [ scriptWithMetadata ]; - // @include *test*.html + // @include *data/test*.html webEngineView.url = Qt.resolvedUrl("test1.html"); webEngineView.waitForLoadSucceeded(); tryCompare(webEngineView, "title", "New title"); @@ -179,6 +179,16 @@ Item { webEngineView.url = Qt.resolvedUrl("test2.html"); webEngineView.waitForLoadSucceeded(); tryCompare(webEngineView, "title", "Test page with huge link area"); + + // @include /favicon.html?$/ + webEngineView.url = Qt.resolvedUrl("favicon.html"); + webEngineView.waitForLoadSucceeded(); + tryCompare(webEngineView, "title", "New title"); + + // @exclude /test[-]iframe/ + webEngineView.url = Qt.resolvedUrl("test-iframe.html"); + webEngineView.waitForLoadSucceeded(); + tryCompare(webEngineView, "title", "Test page with huge link area and iframe"); } function test_profileWideScript() { diff --git a/tests/auto/quick/qmltests/data/tst_viewSource.qml b/tests/auto/quick/qmltests/data/tst_viewSource.qml index 576035ef247ca8f3f664f5cf577967fd2cee64b2..a9cf11f3484e089c8dc4289f8a93a3aea61ecdf6 100644 --- a/tests/auto/quick/qmltests/data/tst_viewSource.qml +++ b/tests/auto/quick/qmltests/data/tst_viewSource.qml @@ -64,7 +64,7 @@ TestWebEngineView { function init() { webEngineView.url = Qt.resolvedUrl("test1.html"); - verify(webEngineView.waitForLoadSucceeded()); + verify(webEngineView.waitForLoadSucceeded(20000)); newViewRequestedSpy.clear(); titleChangedSpy.clear(); @@ -113,9 +113,9 @@ TestWebEngineView { webEngineView.url = row.userInputUrl; if (row.loadSucceed) { - verify(webEngineView.waitForLoadSucceeded()); + verify(webEngineView.waitForLoadSucceeded(15000)); } else { - verify(webEngineView.waitForLoadFailed()); + verify(webEngineView.waitForLoadFailed(15000)); } tryVerify(function() { return titleChangedSpy.count == 1; }); diff --git a/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp b/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp index 3ce697faf415b61d3875b3c716ad03ac32c24207..992254206e774c7aa2ac761fd653113fce9a334b 100644 --- a/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp +++ b/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp @@ -622,6 +622,8 @@ void tst_QWebEngineDownloads::downloadViaSetUrl() auto indexFavRR = waitForFaviconRequest(&server); QVERIFY(indexFavRR); + indexRR.reset(); + indexFavRR.reset(); QTRY_COMPARE(loadSpy.count(), 1); QTRY_COMPARE(urlSpy.count(), 1); @@ -642,16 +644,20 @@ void tst_QWebEngineDownloads::downloadViaSetUrl() auto fileRR = waitForRequest(&server); QVERIFY(fileRR); + QCOMPARE(fileRR->requestMethod(), QByteArrayLiteral("GET")); + QCOMPARE(fileRR->requestPath(), QByteArrayLiteral("/file")); fileRR->setResponseHeader(QByteArrayLiteral("content-disposition"), QByteArrayLiteral("attachment")); fileRR->setResponseBody(QByteArrayLiteral("redacted")); fileRR->sendResponse(); - auto fileFavRR = waitForFaviconRequest(&server); - QVERIFY(fileFavRR); +// Since 63 we no longer get favicon requests here: +// auto fileFavRR = waitForFaviconRequest(&server); +// QVERIFY(fileFavRR); QTRY_COMPARE(loadSpy.count(), 1); QTRY_COMPARE(urlSpy.count(), 2); QTRY_COMPARE(downloadUrls.count(), 1); + fileRR.reset(); QCOMPARE(loadSpy.takeFirst().value(0).toBool(), false); QCOMPARE(urlSpy.takeFirst().value(0).toUrl(), fileUrl); QCOMPARE(urlSpy.takeFirst().value(0).toUrl(), indexUrl); diff --git a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp index 6ae4c41e6532af94a37d3026978a7f3ee7f3e1c9..da041ee592c0762fc10275781ea965752871fa0d 100644 --- a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp +++ b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp @@ -236,10 +236,10 @@ void tst_QWebEngineFaviconManager::errorPageEnabled() QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl))); QSignalSpy iconChangedSpy(m_page, SIGNAL(iconChanged(QIcon))); - QUrl url("invalid://url"); + QUrl url("http://url.invalid"); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 2); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 14000); QCOMPARE(iconUrlChangedSpy.count(), 0); QCOMPARE(iconChangedSpy.count(), 0); @@ -255,10 +255,10 @@ void tst_QWebEngineFaviconManager::errorPageDisabled() QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl))); QSignalSpy iconChangedSpy(m_page, SIGNAL(iconChanged(QIcon))); - QUrl url("invalid://url"); + QUrl url("http://url.invalid"); m_page->load(url); - QTRY_COMPARE(loadFinishedSpy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 12000); QCOMPARE(iconUrlChangedSpy.count(), 0); QCOMPARE(iconChangedSpy.count(), 0); diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 7d69213684fc17949eae66d8ea940f08c33013fc..23c66058ed0b54aa6e5debba5c31b6f8fa3a62da 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -294,43 +294,41 @@ void tst_QWebEnginePage::cleanupTestCase() class NavigationRequestOverride : public QWebEnginePage { public: - NavigationRequestOverride(QWebEngineView* parent, bool initialValue) : QWebEnginePage(parent), m_acceptNavigationRequest(initialValue) {} + NavigationRequestOverride(QWebEngineProfile* profile, bool initialValue) : QWebEnginePage(profile, nullptr), m_acceptNavigationRequest(initialValue) {} bool m_acceptNavigationRequest; protected: virtual bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) { Q_UNUSED(url); - Q_UNUSED(type); Q_UNUSED(isMainFrame); - - return m_acceptNavigationRequest; + if (type == QWebEnginePage::NavigationTypeFormSubmitted) + return m_acceptNavigationRequest; + return true; } }; void tst_QWebEnginePage::acceptNavigationRequest() { - QWebEngineView view; - QSignalSpy loadSpy(&view, SIGNAL(loadFinished(bool))); + QWebEngineProfile profile; + NavigationRequestOverride page(&profile, false); - NavigationRequestOverride* newPage = new NavigationRequestOverride(&view, false); - view.setPage(newPage); + QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); - // acceptNavigationRequest and QWebEngineUrlRequestInterceptor::interceptRequest are not called - // for data: urls, which means the test is broken, aka setting - // newPage->m_acceptNavigationRequest to false does nothing to stop the page from loading. - // See QTBUG-50922 comments. - view.setHtml(QString("<html><body><form name='tstform' action='data:text/html,foo'method='get'>" + page.setHtml(QString("<html><body><form name='tstform' action='data:text/html,foo'method='get'>" "<input type='text'><input type='submit'></form></body></html>"), QUrl()); QTRY_COMPARE(loadSpy.count(), 1); - evaluateJavaScriptSync(view.page(), "tstform.submit();"); - - newPage->m_acceptNavigationRequest = true; - evaluateJavaScriptSync(view.page(), "tstform.submit();"); + evaluateJavaScriptSync(&page, "tstform.submit();"); QTRY_COMPARE(loadSpy.count(), 2); - QCOMPARE(toPlainTextSync(view.page()), QString("foo?")); + // Content hasn't changed so the form submit will still work + page.m_acceptNavigationRequest = true; + evaluateJavaScriptSync(&page, "tstform.submit();"); + QTRY_COMPARE(loadSpy.count(), 3); + + // Now the content has changed + QCOMPARE(toPlainTextSync(&page), QString("foo?")); } class JSTestPage : public QWebEnginePage @@ -1936,7 +1934,7 @@ void tst_QWebEnginePage::userAgentNewlineStripping() // The user agent will be updated after a page load. page.load(QUrl("about:blank")); - QCOMPARE(evaluateJavaScriptSync(&page, "navigator.userAgent").toString(), QStringLiteral("My User Agent X-New-Http-Header: Oh Noes!")); + QTRY_COMPARE(evaluateJavaScriptSync(&page, "navigator.userAgent").toString(), QStringLiteral("My User Agent X-New-Http-Header: Oh Noes!")); } void tst_QWebEnginePage::crashTests_LazyInitializationOfMainFrame() @@ -3405,7 +3403,7 @@ void tst_QWebEnginePage::setHtmlWithImageResource() QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); page.setHtml(html, QUrl("file:///path/to/file")); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 12000); QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1); QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 128); @@ -4044,7 +4042,6 @@ void tst_QWebEnginePage::setUrlHistory() void tst_QWebEnginePage::setUrlUsingStateObject() { - const QUrl aboutBlank("about:blank"); QUrl url; QSignalSpy urlChangedSpy(m_page, SIGNAL(urlChanged(QUrl))); int expectedUrlChangeCount = 0; @@ -4053,12 +4050,10 @@ void tst_QWebEnginePage::setUrlUsingStateObject() url = QUrl("qrc:/resources/test1.html"); m_page->setUrl(url); - QSignalSpy spyFinished(m_page, &QWebEnginePage::loadFinished); - QVERIFY(spyFinished.wait()); expectedUrlChangeCount++; - QCOMPARE(urlChangedSpy.count(), expectedUrlChangeCount); + QTRY_COMPARE(urlChangedSpy.count(), expectedUrlChangeCount); QCOMPARE(m_page->url(), url); - QCOMPARE(m_page->history()->count(), 1); + QTRY_COMPARE(m_page->history()->count(), 1); evaluateJavaScriptSync(m_page, "window.history.pushState(null, 'push', 'navigate/to/here')"); expectedUrlChangeCount++; @@ -4076,9 +4071,8 @@ void tst_QWebEnginePage::setUrlUsingStateObject() QVERIFY(m_page->history()->canGoBack()); evaluateJavaScriptSync(m_page, "window.history.back()"); - QTest::qWait(100); expectedUrlChangeCount++; - QCOMPARE(urlChangedSpy.count(), expectedUrlChangeCount); + QTRY_COMPARE(urlChangedSpy.count(), expectedUrlChangeCount); QCOMPARE(m_page->url(), QUrl("qrc:/resources/test1.html")); QVERIFY(m_page->history()->canGoForward()); QVERIFY(!m_page->history()->canGoBack()); @@ -4339,8 +4333,8 @@ void tst_QWebEnginePage::toPlainTextLoadFinishedRace() QTRY_VERIFY(spy.count() == 1); QCOMPARE(toPlainTextSync(page.data()), QString("foobarbaz")); - page->load(QUrl("fail:unknown/scheme")); - QTRY_VERIFY(spy.count() == 2); + page->load(QUrl("http://fail.invalid/")); + QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 2, 12000); QString s = toPlainTextSync(page.data()); QVERIFY(s.contains("foobarbaz") == !enableErrorPage); diff --git a/tests/auto/widgets/qwebengineschemes/tst_qwebengineschemes.cpp b/tests/auto/widgets/qwebengineschemes/tst_qwebengineschemes.cpp index cacfc1a3c82ecb1ac53e7d398974abb8992ce5fe..9381b39305d063240b295e238b5637f3d1f7d60b 100644 --- a/tests/auto/widgets/qwebengineschemes/tst_qwebengineschemes.cpp +++ b/tests/auto/widgets/qwebengineschemes/tst_qwebengineschemes.cpp @@ -49,8 +49,10 @@ public: { } int acceptNavigationRequestCalls = 0; - bool acceptNavigationRequest(const QUrl &/*url*/, NavigationType /*type*/, bool /*isMainFrame*/) override + bool acceptNavigationRequest(const QUrl &/*url*/, NavigationType type, bool /*isMainFrame*/) override { + if (type == QWebEnginePage::NavigationTypeTyped) + return true; this->acceptNavigationRequestCalls++; return false; } @@ -60,13 +62,14 @@ void tst_QWebEngineSchemes::unknownUrlSchemePolicy() { QWebEngineView view; AcceptNavigationRequestHandler page; + QSignalSpy loadFinishedSpy(&page, &QWebEnginePage::loadFinished); view.setPage(&page); view.resize(400, 40); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); QWebEngineSettings *settings = view.page()->profile()->settings(); + settings->setAttribute(QWebEngineSettings::ErrorPageEnabled, false); settings->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, true); - QSignalSpy loadFinishedSpy(&view, &QWebEngineView::loadFinished); QWebEngineSettings::UnknownUrlSchemePolicy policies[6] = {QWebEngineSettings::DisallowUnknownUrlSchemes, QWebEngineSettings::DisallowUnknownUrlSchemes, @@ -91,7 +94,7 @@ void tst_QWebEngineSchemes::unknownUrlSchemePolicy() } else { // navigation request coming from user interaction shouldAccept = (2 <= i); // all cases except DisallowUnknownUrlSchemes view.setHtml("<html><body><a id='nonexlink' href='nonexistentscheme://somewhere'>nonexistentscheme://somewhere</a></body></html>"); - QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 1, 30000); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 1, 15000); // focus and trigger the link view.page()->runJavaScript("document.getElementById('nonexlink').focus();", [&view](const QVariant &result) { Q_UNUSED(result); @@ -101,7 +104,7 @@ void tst_QWebEngineSchemes::unknownUrlSchemePolicy() } bool errorPageEnabled = settings->testAttribute(QWebEngineSettings::ErrorPageEnabled); - QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 2 + (errorPageEnabled ? 1 : 0), 30000); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 2 + (errorPageEnabled ? 1 : 0), 15000); QCOMPARE(page.acceptNavigationRequestCalls, shouldAccept ? 1 : 0); } } diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py index 4abc230090112934b050b1a48e519e3e17178c21..69e22d5a6bcc5e497fedd793797e85ea61429813 100755 --- a/tools/scripts/take_snapshot.py +++ b/tools/scripts/take_snapshot.py @@ -92,6 +92,7 @@ def isInChromiumBlacklist(file_path): not 'third_party/chromevox' in file_path and not 'media/webrtc/desktop_media_list.h' in file_path and not 'media/webrtc/desktop_streams_registry.' in file_path and + not 'browser/net/chrome_mojo_proxy_resolver_factory.' in file_path and not '/browser/devtools/' in file_path and not '/browser/ui/webui/' in file_path and not 'common/chrome_constants.' in file_path and @@ -143,6 +144,7 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('native_client') or file_path.startswith('net/android/java') or (file_path.startswith('net/data/') and '_unittest/' in file_path) + or file_path.startswith('net/data/fuzzer_data/') or file_path.startswith('remoting') or file_path.startswith('rlz') or file_path.startswith('testing/android') @@ -160,10 +162,11 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/ashmem') or file_path.startswith('third_party/binutils') or file_path.startswith('third_party/bison') - or (file_path.startswith('third_party/cacheinvalidation') and - not file_path.endswith('isolate')) + or file_path.startswith('third_party/breakpad') or file_path.startswith('third_party/boringssl/crypto_test_data.cc') or file_path.startswith('third_party/boringssl/src/fuzz') + or (file_path.startswith('third_party/cacheinvalidation') and + not file_path.endswith('isolate')) or file_path.startswith('third_party/catapult') or file_path.startswith('third_party/chromite') or file_path.startswith('third_party/cld_2') @@ -221,6 +224,7 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/trace-viewer') or file_path.startswith('third_party/undoview') or file_path.startswith('third_party/webgl') + or file_path.startswith('third_party/webrtc/resources/') or file_path.startswith('tools/android') or file_path.startswith('tools/luci_go') or file_path.startswith('tools/metrics') diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index 4ca5d7aac2938af9ae22ce23cca9adb8d34f4427..7a22765ef2d1bc0a98dadeaab01e31a4d73d33cf 100644 --- a/tools/scripts/version_resolver.py +++ b/tools/scripts/version_resolver.py @@ -38,8 +38,8 @@ import json import urllib2 import git_submodule as GitSubmodule -chromium_version = '61.0.3163.140' -chromium_branch = '3163' +chromium_version = '63.0.3239.117' +chromium_branch = '3239' ninja_version = 'v1.8.2' json_url = 'http://omahaproxy.appspot.com/all.json'