Skip to content

GetCookieManager sometimes not called due to a race condition. API removed in latest CEF. #429

Description

@cztomczak

The GetCookieManager callback doesn't have browser parameter in upstream CEF. This param is set during synchronous browser creation in CreateBrowserSync [1], so it is not immediately available. See comment in request context handler in C++ [2] and the SetBrowser method. Fix needs to be applied in [3] with such code:

if cefBrowser.get():
    pyBrowser = GetPyBrowser(cefBrowser, "GetCookieManager")
else:
    pyBrowser = None

And app code needs to be aware that browser param in GetCookieManager may be None - API docs need to state that.

Issue originally reported on the forum:
https://groups.google.com/d/msg/cefpython/e3bFx1I5BZA/2ZM7jKk8AgAJ

Ref:
[1]

# Request context - part 2/2.

[2]
// Browser may be NULL when instantiated from cefpython.CreateBrowserSync.

[3]
cdef public CefRefPtr[CefCookieManager] RequestHandler_GetCookieManager(

Activity

  1. added this to the v66 milestone on May 22, 2018
  2. cztomczak commented on May 25, 2018

    @cztomczak
    OwnerAuthor

    This error happened to me as well when running wxpython.py example.

  3. changed the title [-]RequestHandler_GetCookieManager throws "Exception: GetCookieManager: CefBrowser reference is NULL" w/ CEF 65.0+[/-] [+]GetCookieManager sometimes not called due to a race condition[/+] on May 25, 2018
  4. cztomczak commented on May 25, 2018

    @cztomczak
    OwnerAuthor

    Fixing the error is not enough, because if browser is NULL then we can't call user callback, as it is assigned to that browser. It must be fixed so that GetCookieManager callback is always called.

  5. changed the title [-]GetCookieManager sometimes not called due to a race condition[/-] [+]GetCookieManager sometimes not called due to a race condition. API removed in latest CEF.[/+] on Jan 23, 2020
  6. cztomczak commented on Jan 23, 2020

    @cztomczak
    OwnerAuthor

    The GetCookieManager API was removed from upstream CEF. You can no longer create an instance on CefCookieManager, instead you have to create a new instance of CefRequestContext and provide a different cache_path to have a separate cookie store. This and other NetworkService related changes were disucced in upstream: https://bitbucket.org/chromiumembedded/cef/issues/2622/implement-support-for-networkservice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions