Don't save or load cookies for non-cookieable scheme requests.

This fixes an IsCanonical() DCHECK failure triggered by calling
CanonicalCookie::Create for a non-cookieable URL.

This change also adds unit test coverage for cross-origin cookie
behavior with sub-resource requests (iframe, XHR, Fetch).
This commit is contained in:
Marshall Greenblatt
2020-09-04 15:08:55 -04:00
parent 19391d8ab0
commit 4791109a28
10 changed files with 288 additions and 44 deletions

View File

@@ -9,6 +9,7 @@
#include <string>
#include "include/base/cef_bind.h"
#include "include/cef_cookie.h"
#include "include/cef_frame.h"
#include "include/cef_request.h"
#include "include/cef_request_context.h"
@@ -73,6 +74,23 @@ CefRefPtr<CefResourceHandler> CreateResourceHandler(
CefRefPtr<CefResponse> response,
const std::string& response_data);
typedef std::vector<CefCookie> CookieVector;
typedef base::Callback<void(const CookieVector& cookies)> CookieDoneCallback;
// Retrieves all cookies from |manager| and executes |callback| upon completion.
// If |deleteCookies| is true the cookies will also be deleted.
void GetAllCookies(CefRefPtr<CefCookieManager> manager,
bool deleteCookies,
const CookieDoneCallback& callback);
// Retrieves URL cookies from |manager| and executes |callback| upon completion.
// If |deleteCookies| is true the cookies will also be deleted.
void GetUrlCookies(CefRefPtr<CefCookieManager> manager,
const CefString& url,
bool includeHttpOnly,
bool deleteCookies,
const CookieDoneCallback& callback);
} // namespace test_request
#endif // CEF_TESTS_CEFTESTS_TEST_REQUEST_H_