Skip to content

Fix #676: deliver CanSendCookie/CanSaveCookie via ResourceRequestHandler#694

Open
linesight wants to merge 1 commit into
cztomczak:cefpython147from
linesight:fix-676-cookie-access-filter
Open

Fix #676: deliver CanSendCookie/CanSaveCookie via ResourceRequestHandler#694
linesight wants to merge 1 commit into
cztomczak:cefpython147from
linesight:fix-676-cookie-access-filter

Conversation

@linesight

Copy link
Copy Markdown
Contributor

Fix #676

CEF 123 moved the cookie callbacks off CefRequestHandler into CefCookieAccessFilter, reachable only through
CefRequestHandler::GetResourceRequestHandler() ->
CefResourceRequestHandler::GetCookieAccessFilter(). cefpython never implemented GetResourceRequestHandler, so the cookie filter was never installed and CanSendCookie/CanSaveCookie never fired.

  • Add ResourceRequestHandler (CefResourceRequestHandler) whose GetCookieAccessFilter() returns a CookieAccessFilter, and implement RequestHandler::GetResourceRequestHandler() to return it.
  • Add #pragma once to cookie_access_filter.h, now included from two places (request_handler.h and resource_request_handler.h).

Guard a latent NULL dereference the wiring exposes: these callbacks run on the IO thread where CefFrame::GetBrowser() can return NULL (observed for cross-origin subresource requests; CEF also documents browser/frame as optional for service-worker / CefURLRequest origins). GetPyFrame() previously did frame.GetBrowser().GetIdentifier() unconditionally and crashed. Guard it in GetPyFrame() and skip-with-log in the cookie filter when no browser is resolvable, allowing the cookie by default.

…questHandler

CanSendCookie/CanSaveCookie were moved off CefRequestHandler into
CefCookieAccessFilter with the NetworkService migration (CEF based on
Chromium 75, CEF issue #2622), reachable only through
CefRequestHandler::GetResourceRequestHandler() ->
CefResourceRequestHandler::GetCookieAccessFilter(). cefpython (previously
on CEF 66) never implemented GetResourceRequestHandler, so after the
upgrade to CEF 123 the cookie filter was never installed and
CanSendCookie/CanSaveCookie never fired.

- Add ResourceRequestHandler (CefResourceRequestHandler) whose
  GetCookieAccessFilter() returns a CookieAccessFilter, and implement
  RequestHandler::GetResourceRequestHandler() to return it.
- Add #pragma once to cookie_access_filter.h, now included from two
  places (request_handler.h and resource_request_handler.h).

Guard a latent NULL dereference the wiring exposes: these callbacks run
on the IO thread where CefFrame::GetBrowser() can return NULL (observed
for cross-origin subresource requests; CEF also documents browser/frame
as optional for service-worker / CefURLRequest origins). GetPyFrame()
previously did frame.GetBrowser().GetIdentifier() unconditionally and
crashed. Guard it in GetPyFrame() and skip-with-log in the cookie filter
when no browser is resolvable, allowing the cookie by default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant