Fix #676: deliver CanSendCookie/CanSaveCookie via ResourceRequestHandler#694
Open
linesight wants to merge 1 commit into
Open
Fix #676: deliver CanSendCookie/CanSaveCookie via ResourceRequestHandler#694linesight wants to merge 1 commit into
linesight wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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.