Skip to content

Commit 0be4137

Browse files
linesightclaude
andcommitted
CEF 146: fix cookie visitor thread assertion and update snippet URLs
- cookie.pyx: change CookieVisitor_Visit thread assertion from TID_IO to TID_UI — CEF 146 changed CookieVisitor::Visit to always fire on the UI thread (previously IO thread), causing AssertionError on every callback - cookies.py: fix bug where OnLoadingStateChange checked "if is_loading" (fires on load start) instead of "if not is_loading" (fires on complete); update dead html-kit.com URL to https://www.google.com/ - network_cookies.py: update dead html-kit.com URL to https://www.google.com/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 48705a2 commit 0be4137

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

examples/snippets/cookies.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
def main():
1010
cef.Initialize()
1111
browser = cef.CreateBrowserSync(
12-
url="http://www.html-kit.com/tools/cookietester/",
12+
url="https://www.google.com/",
1313
window_title="Cookies")
1414
browser.SetClientHandler(LoadHandler())
1515
cef.MessageLoop()
@@ -19,7 +19,7 @@ def main():
1919

2020
class LoadHandler(object):
2121
def OnLoadingStateChange(self, browser, is_loading, **_):
22-
if is_loading:
22+
if not is_loading:
2323
print("Page loading complete - start visiting cookies")
2424
manager = cef.CookieManager.GetGlobalManager()
2525
# Must keep a strong reference to the CookieVisitor object
@@ -32,7 +32,7 @@ def OnLoadingStateChange(self, browser, is_loading, **_):
3232
# To visit cookies only for a given url uncomment the
3333
# code below.
3434
"""
35-
url = "http://www.html-kit.com/tools/cookietester/"
35+
url = "https://www.google.com/"
3636
http_only_cookies = False
3737
result = manager.VisitUrlCookies(url, http_only_cookies,
3838
self.cookie_visitor)

examples/snippets/network_cookies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
def main():
1010
cef.Initialize()
1111
browser = cef.CreateBrowserSync(
12-
url="http://www.html-kit.com/tools/cookietester/",
12+
url="https://www.google.com/",
1313
window_title="Network cookies")
1414
browser.SetClientHandler(RequestHandler())
1515
cef.MessageLoop()

src/cookie.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ cdef public cpp_bool CookieVisitor_Visit(
315315
cdef PyCookie pyCookie
316316
cdef list pyDeleteCookie = [False]
317317
try:
318-
assert IsThread(TID_IO), "Must be called on the IO thread"
318+
assert IsThread(TID_UI), "Must be called on the UI thread"
319319
pyCookieVisitor = GetPyCookieVisitor(cookieVisitorId)
320320
pyCookie = CreatePyCookie(cookie)
321321
if pyCookieVisitor:

0 commit comments

Comments
 (0)