summaryrefslogtreecommitdiffstats
path: root/src/core/cookie_monster_delegate_qt.h
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@theqtcompany.com>2015-05-19 13:36:49 +0200
committerAndras Becsi <andras.becsi@theqtcompany.com>2015-07-16 09:46:09 +0000
commit5139958132a9f7116d6aad8a94656aa7741d7d58 (patch)
treedee37d61ebdbe0285eedd0294a496ed2d687faef /src/core/cookie_monster_delegate_qt.h
parent80bceea0a7b3f9b8f52a6ddc481e61ad3e43d85f (diff)
Add cookie API tests
This tests the part of the cookie API that can be tested locally. The notification about third-party cookies (acceptCookieFromUrl) can not be tested locally since it requires cookies to be set from a different domain than the main frame, which requires a remote host or a local web server with support for virtual DNS. Testing requires the ability to set cookies for local pages loaded through the qrc scheme. We could eventually extend this in the future to enable setting cookies on registered custom schemes, but for that we might have to implement our own cookie store. Since Chromium's cookie store relies on source url's to manage cookies and qrc:// cookies do not specify a domain, a specific source url is needed to be able to delete an individual cookie that has been set by a page loaded through qrc://. This patch requires a new function on QNetworkCookie to be able to forward the source url of the cookie to Chromium. Change-Id: I97dd04b27fbb8ec63060f9b741ad65c29a773a6c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/core/cookie_monster_delegate_qt.h')
-rw-r--r--src/core/cookie_monster_delegate_qt.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/cookie_monster_delegate_qt.h b/src/core/cookie_monster_delegate_qt.h
index 971a09bbc..e5e295853 100644
--- a/src/core/cookie_monster_delegate_qt.h
+++ b/src/core/cookie_monster_delegate_qt.h
@@ -55,6 +55,13 @@ QT_FORWARD_DECLARE_CLASS(QWebEngineCookieStoreClient)
namespace QtWebEngineCore {
+// Extends net::CookieMonster::kDefaultCookieableSchemes with qrc, without enabling
+// cookies for the file:// scheme, which is disabled by default in Chromium.
+// Since qrc:// is similar to file:// and there are some unknowns about how
+// to correctly handle file:// cookies, qrc:// should only be used for testing.
+static const char* const kCookieableSchemes[] =
+ { "http", "https", "qrc", "ws", "wss" };
+
class QWEBENGINE_EXPORT CookieMonsterDelegateQt: public net::CookieMonsterDelegate {
QPointer<QWebEngineCookieStoreClient> m_client;
scoped_refptr<net::CookieMonster> m_cookieMonster;