diff options
-rw-r--r-- | src/core/api/qwebenginecookiestore.cpp | 32 | ||||
-rw-r--r-- | src/core/api/qwebenginecookiestore.h | 12 | ||||
-rw-r--r-- | src/core/api/qwebenginecookiestore_p.h | 3 | ||||
-rw-r--r-- | src/core/cookie_monster_delegate_qt.cpp | 6 | ||||
-rw-r--r-- | tests/quicktestbrowser/BrowserWindow.qml | 8 | ||||
-rw-r--r-- | tests/quicktestbrowser/main.cpp | 8 |
6 files changed, 3 insertions, 66 deletions
diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp index ab2612803..c0a3f3208 100644 --- a/src/core/api/qwebenginecookiestore.cpp +++ b/src/core/api/qwebenginecookiestore.cpp @@ -175,20 +175,6 @@ void QWebEngineCookieStorePrivate::onCookieChanged(const QNetworkCookie &cookie, Q_EMIT q->cookieAdded(cookie); } -bool QWebEngineCookieStorePrivate::canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url) -{ - if (filterCallback) { - QWebEngineCookieStore::FilterRequest request; - request.accepted = true; - request.firstPartyUrl = firstPartyUrl; - request.cookieLine = cookieLine; - request.cookieSource = url; - callbackDirectory.invokeDirectly<QWebEngineCookieStore::FilterRequest&>(filterCallback, request); - return request.accepted; - } - return true; -} - /*! \class QWebEngineCookieStore \inmodule QtWebEngineCore @@ -350,22 +336,4 @@ void QWebEngineCookieStore::deleteAllCookies() d->deleteAllCookies(); } -/*! - \fn void QWebEngineCookieStore::setCookieFilter(FunctorOrLambda filterCallback) - - Installs a cookie filter that can reject cookies before they are added to the cookie store. - The \a filterCallback must be a lambda or functor taking FilterRequest structure. If the - cookie is to be rejected, the filter can set FilterRequest::accepted to \c false. - - The callback should not be used to execute heavy tasks since it is running on the - IO thread and therefore blocks the Chromium networking. - - \sa deleteAllCookies(), loadAllCookies() -*/ -void QWebEngineCookieStore::setCookieFilter(const QWebEngineCallback<QWebEngineCookieStore::FilterRequest&> &filter) -{ - Q_D(QWebEngineCookieStore); - d->filterCallback = filter; -} - QT_END_NAMESPACE diff --git a/src/core/api/qwebenginecookiestore.h b/src/core/api/qwebenginecookiestore.h index 3a52a2025..b1d625385 100644 --- a/src/core/api/qwebenginecookiestore.h +++ b/src/core/api/qwebenginecookiestore.h @@ -57,20 +57,8 @@ class QWEBENGINE_EXPORT QWebEngineCookieStore : public QObject { Q_OBJECT public: - struct FilterRequest { - bool accepted; - - QUrl firstPartyUrl; - QByteArray cookieLine; - QUrl cookieSource; - }; virtual ~QWebEngineCookieStore(); -#ifdef Q_QDOC - void setCookieFilter(FunctorOrLambda filterCallback); -#else - void setCookieFilter(const QWebEngineCallback<FilterRequest&> &filterCallback); -#endif void setCookie(const QNetworkCookie &cookie, const QUrl &origin = QUrl()); void deleteCookie(const QNetworkCookie &cookie, const QUrl &origin = QUrl()); void deleteSessionCookies(); diff --git a/src/core/api/qwebenginecookiestore_p.h b/src/core/api/qwebenginecookiestore_p.h index 348dcd69f..41456cfdc 100644 --- a/src/core/api/qwebenginecookiestore_p.h +++ b/src/core/api/qwebenginecookiestore_p.h @@ -75,7 +75,6 @@ class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStorePrivate : public QObjectPri friend class QTypeInfo<CookieData>; public: QtWebEngineCore::CallbackDirectory callbackDirectory; - QWebEngineCallback<QWebEngineCookieStore::FilterRequest&> filterCallback; QVector<CookieData> m_pendingUserCookies; quint64 m_nextCallbackId; bool m_deleteSessionCookiesPending; @@ -94,8 +93,6 @@ public: void deleteAllCookies(); void getAllCookies(); - bool canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url); - void onGetAllCallbackResult(qint64 callbackId, const QByteArray &cookieList); void onSetCallbackResult(qint64 callbackId, bool success); void onDeleteCallbackResult(qint64 callbackId, int numCookies); diff --git a/src/core/cookie_monster_delegate_qt.cpp b/src/core/cookie_monster_delegate_qt.cpp index 3689d54d7..493743385 100644 --- a/src/core/cookie_monster_delegate_qt.cpp +++ b/src/core/cookie_monster_delegate_qt.cpp @@ -166,10 +166,8 @@ void CookieMonsterDelegateQt::setClient(QWebEngineCookieStore *client) bool CookieMonsterDelegateQt::canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url) { - if (!m_client) - return true; - - return m_client->d_func()->canSetCookie(firstPartyUrl, cookieLine, url); + // TODO: should be used for FilterRequest implementation + return true; } void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie& cookie, bool removed, ChangeCause cause) diff --git a/tests/quicktestbrowser/BrowserWindow.qml b/tests/quicktestbrowser/BrowserWindow.qml index 3fcca4aab..cf583c60d 100644 --- a/tests/quicktestbrowser/BrowserWindow.qml +++ b/tests/quicktestbrowser/BrowserWindow.qml @@ -79,7 +79,6 @@ ApplicationWindow { property alias javaScriptEnabled: javaScriptEnabled.checked; property alias errorPageEnabled: errorPageEnabled.checked; property alias pluginsEnabled: pluginsEnabled.checked; - property alias thirdPartyCookiesEnabled: thirdPartyCookiesEnabled.checked; } // Make sure the Qt.WindowFullscreenButtonHint is set on OS X. @@ -255,13 +254,6 @@ ApplicationWindow { checked: true } MenuItem { - id: thirdPartyCookiesEnabled - text: "Third party cookies enabled" - checkable: true - checked: true - onToggled: applicationRoot.thirdPartyCookiesEnabled = checked - } - MenuItem { id: offTheRecordEnabled text: "Off The Record" checkable: true diff --git a/tests/quicktestbrowser/main.cpp b/tests/quicktestbrowser/main.cpp index 61977a018..85a02ab34 100644 --- a/tests/quicktestbrowser/main.cpp +++ b/tests/quicktestbrowser/main.cpp @@ -86,15 +86,9 @@ int main(int argc, char **argv) QObject *rootObject = appEngine.rootObjects().first(); QQuickWebEngineProfile *profile = new QQuickWebEngineProfile(rootObject); - QWebEngineCookieStore *client = profile->cookieStore(); const QMetaObject *rootMeta = rootObject->metaObject(); - int index = rootMeta->indexOfProperty("thirdPartyCookiesEnabled"); - Q_ASSERT(index != -1); - QMetaProperty thirdPartyCookiesProperty = rootMeta->property(index); - client->setCookieFilter([rootObject,&thirdPartyCookiesProperty](const QWebEngineCookieStore::FilterRequest&){ return thirdPartyCookiesProperty.read(rootObject).toBool(); }); - - index = rootMeta->indexOfProperty("testProfile"); + int index = rootMeta->indexOfProperty("testProfile"); Q_ASSERT(index != -1); QMetaProperty profileProperty = rootMeta->property(index); profileProperty.write(rootObject, qVariantFromValue(profile)); |