Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cztomczak opened this issue May 22, 2018 · 3 comments

Comments

@cztomczak
Copy link
Owner

cztomczak commented May 22, 2018

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(

@cztomczak cztomczak added this to the v66 milestone May 22, 2018
jakogut added a commit to jakogut/cefpython that referenced this issue May 22, 2018
jakogut added a commit to jakogut/cefpython that referenced this issue May 22, 2018
@cztomczak
Copy link
Owner Author

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

@cztomczak cztomczak 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 May 25, 2018
@cztomczak
Copy link
Owner Author

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.

@cztomczak cztomczak reopened this May 25, 2018
@cztomczak cztomczak 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. Jan 23, 2020
@cztomczak
Copy link
Owner Author

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
Projects
None yet
Development

No branches or pull requests

1 participant