From b96784cc6677bef9bd32afb7ca7e6e713114ee9f Mon Sep 17 00:00:00 2001 From: Michael Bruning Date: Wed, 4 May 2016 17:01:45 +0200 Subject: Revert marking qrc: as a local scheme It was causing a regression that broke applications that embedded JavaScript in qrc files and accessed them from other embedded JavaScript files. This is e.g. a typical pattern for applications that used QtWebChannel. This partially reverts 29f9a2fb68568208a70ba9efef0e455b50a4d3e3 Task-number: QTBUG-53108 Change-Id: I8b26395d84258b6d9aca8e0c5f07d4435617f44d Reviewed-by: Kai Koehne Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Michal Klocek --- src/core/renderer/content_renderer_client_qt.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/core') diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index e53076525..3886e54a0 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -73,8 +73,6 @@ public: blink::WebString qrcScheme(base::ASCIIToUTF16(kQrcSchemeQt)); // mark qrc as a secure scheme (avoids deprecation warnings) blink::WebSecurityPolicy::registerURLSchemeAsSecure(qrcScheme); - // mark qrc as a local scheme (allows local access to qrc) - blink::WebSecurityPolicy::registerURLSchemeAsLocal(qrcScheme); } }; -- cgit v1.2.3 From f2370c0d09998f382364a9a58932cf717c28a764 Mon Sep 17 00:00:00 2001 From: Ilia Kirianovskii Date: Tue, 16 Feb 2016 11:35:48 +0300 Subject: Fix CXX :visited selector This patch fixes highlighting of visited links and now Acid3 test completely works (100 of 100). The reason is that VisitedLinkMaster must be initialized before a new RenderView will be created. Otherwise, it will not handle content::NOTIFICATION_RENDERER_PROCESS_CREATED event and therefore VisitedLinkSlave will be left uninitialized (salt_ is zero). Because of this reason CSS :visited selector was broken and didn't work. Change-Id: I769cd5dbae2ffb95fd128df634a54e562b9cc91d Reviewed-by: Ilia Kirianovskii Reviewed-by: Joerg Bornemann --- src/core/browser_context_adapter.cpp | 19 ++++++++++++++----- src/core/browser_context_adapter.h | 1 + src/core/web_contents_adapter.cpp | 6 ++++++ 3 files changed, 21 insertions(+), 5 deletions(-) (limited to 'src/core') diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index 481197eed..702851ba5 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -101,7 +101,8 @@ void BrowserContextAdapter::setStorageName(const QString &storageName) m_name = storageName; if (m_browserContext->url_request_getter_.get()) m_browserContext->url_request_getter_->updateStorageSettings(); - m_visitedLinksManager.reset(); + if (m_visitedLinksManager) + resetVisitedLinksManager(); } void BrowserContextAdapter::setOffTheRecord(bool offTheRecord) @@ -111,7 +112,8 @@ void BrowserContextAdapter::setOffTheRecord(bool offTheRecord) m_offTheRecord = offTheRecord; if (m_browserContext->url_request_getter_.get()) m_browserContext->url_request_getter_->updateStorageSettings(); - m_visitedLinksManager.reset(); + if (m_visitedLinksManager) + resetVisitedLinksManager(); } BrowserContextQt *BrowserContextAdapter::browserContext() @@ -122,7 +124,7 @@ BrowserContextQt *BrowserContextAdapter::browserContext() WebEngineVisitedLinksManager *BrowserContextAdapter::visitedLinksManager() { if (!m_visitedLinksManager) - m_visitedLinksManager.reset(new WebEngineVisitedLinksManager(this)); + resetVisitedLinksManager(); return m_visitedLinksManager.data(); } @@ -195,7 +197,8 @@ void BrowserContextAdapter::setDataPath(const QString &path) m_dataPath = path; if (m_browserContext->url_request_getter_.get()) m_browserContext->url_request_getter_->updateStorageSettings(); - m_visitedLinksManager.reset(); + if (m_visitedLinksManager) + resetVisitedLinksManager(); } QString BrowserContextAdapter::cachePath() const @@ -336,7 +339,8 @@ void BrowserContextAdapter::setVisitedLinksPolicy(BrowserContextAdapter::Visited if (m_visitedLinksPolicy == visitedLinksPolicy) return; m_visitedLinksPolicy = visitedLinksPolicy; - m_visitedLinksManager.reset(); + if (m_visitedLinksManager) + resetVisitedLinksManager(); } int BrowserContextAdapter::httpCacheMaxSize() const @@ -459,4 +463,9 @@ void BrowserContextAdapter::setHttpAcceptLanguage(const QString &httpAcceptLangu m_browserContext->url_request_getter_->updateUserAgent(); } +void BrowserContextAdapter::resetVisitedLinksManager() +{ + m_visitedLinksManager.reset(new WebEngineVisitedLinksManager(this)); +} + } // namespace QtWebEngineCore diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h index b133eab65..1eeb88770 100644 --- a/src/core/browser_context_adapter.h +++ b/src/core/browser_context_adapter.h @@ -163,6 +163,7 @@ public: private: void updateCustomUrlSchemeHandlers(); + void resetVisitedLinksManager(); QString m_name; bool m_offTheRecord; diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 30c589c56..66d133f60 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -394,6 +394,12 @@ void WebContentsAdapter::initialize(WebContentsAdapterClient *adapterClient) // This should only be necessary after having restored the history to a new WebContentsAdapter. d->webContents->GetController().LoadIfNecessary(); + // Create an instance of WebEngineVisitedLinksManager to catch the first + // content::NOTIFICATION_RENDERER_PROCESS_CREATED event. This event will + // force to initialize visited links in VisitedLinkSlave. + // It must be done before creating a RenderView. + d->browserContextAdapter->visitedLinksManager(); + // Create a RenderView with the initial empty document content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); Q_ASSERT(rvh); -- cgit v1.2.3 From f4b806ffbc2f11a5a64fab2856dfe68ae7d603c8 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 18 May 2016 14:55:13 +0200 Subject: Fix pasting images to web pages WebKit expects pasted images to have the MIME type image/png (see code and comment in DataObjectItem::getAsFile()). Task-number: QTBUG-53409 Change-Id: I2b0c1244d309687ad190db26c5b00718ed0c4258 Reviewed-by: Allan Sandfeld Jensen --- src/core/clipboard_qt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 9ac5c7a17..e632c5583 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -282,6 +282,8 @@ void ClipboardQt::ReadAvailableTypes(ui::ClipboardType type, std::vectorclear(); const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); + if (mimeData->hasImage()) + types->push_back(toString16(QStringLiteral("image/png"))); Q_FOREACH (const QString &mimeType, mimeData->formats()) types->push_back(toString16(mimeType)); *contains_filenames = false; @@ -325,8 +327,6 @@ void ClipboardQt::ReadRTF(ui::ClipboardType type, std::string* result) const SkBitmap ClipboardQt::ReadImage(ui::ClipboardType type) const { - // FIXME: Untested, pasting image data seems to only be supported through - // FileReader.readAsDataURL in JavaScript and this isn't working down the pipe for some reason. const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); QImage image = qvariant_cast(mimeData->imageData()); -- cgit v1.2.3 From 3206e85c0f7ee3de9953977ffbb0137de0ee01f3 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 18 May 2016 16:29:40 +0200 Subject: Silence zero-as-null-pointer=constant warnings This appears to have been added to headerclean and is now preventing us from integrating. Change-Id: I7c25a85c0d62c945d4f4a68f559000fab8c880cc Reviewed-by: Joerg Bornemann --- src/core/api/qwebenginecookiestore.h | 2 +- src/core/api/qwebengineurlrequestinterceptor.h | 2 +- src/core/api/qwebengineurlschemehandler.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/api/qwebenginecookiestore.h b/src/core/api/qwebenginecookiestore.h index b1d625385..eac976fae 100644 --- a/src/core/api/qwebenginecookiestore.h +++ b/src/core/api/qwebenginecookiestore.h @@ -70,7 +70,7 @@ Q_SIGNALS: void cookieRemoved(const QNetworkCookie &cookie); private: - explicit QWebEngineCookieStore(QObject *parent = 0); + explicit QWebEngineCookieStore(QObject *parent = Q_NULLPTR); friend class QtWebEngineCore::BrowserContextAdapter; friend class QtWebEngineCore::CookieMonsterDelegateQt; Q_DISABLE_COPY(QWebEngineCookieStore) diff --git a/src/core/api/qwebengineurlrequestinterceptor.h b/src/core/api/qwebengineurlrequestinterceptor.h index a3b7cf979..e9f9c8d5f 100644 --- a/src/core/api/qwebengineurlrequestinterceptor.h +++ b/src/core/api/qwebengineurlrequestinterceptor.h @@ -52,7 +52,7 @@ class QWEBENGINE_EXPORT QWebEngineUrlRequestInterceptor : public QObject Q_OBJECT Q_DISABLE_COPY(QWebEngineUrlRequestInterceptor) public: - explicit QWebEngineUrlRequestInterceptor(QObject *p = 0) + explicit QWebEngineUrlRequestInterceptor(QObject *p = Q_NULLPTR) : QObject (p) { } diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h index d9fc15250..738bc281b 100644 --- a/src/core/api/qwebengineurlschemehandler.h +++ b/src/core/api/qwebengineurlschemehandler.h @@ -52,7 +52,7 @@ class QWebEngineUrlRequestJob; class QWEBENGINE_EXPORT QWebEngineUrlSchemeHandler : public QObject { Q_OBJECT public: - QWebEngineUrlSchemeHandler(QObject *parent = 0); + QWebEngineUrlSchemeHandler(QObject *parent = Q_NULLPTR); ~QWebEngineUrlSchemeHandler(); virtual void requestStarted(QWebEngineUrlRequestJob*) = 0; -- cgit v1.2.3