mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
4.1.0.8修复一个headers设置问题;修复多线程关闭tab时可能报错问题
This commit is contained in:
parent
b854df764c
commit
6a3918756e
@ -12,4 +12,4 @@ from ._pages.chromium_page import ChromiumPage
|
||||
from ._pages.session_page import SessionPage
|
||||
from ._pages.web_page import WebPage
|
||||
|
||||
__version__ = '4.1.0.7'
|
||||
__version__ = '4.1.0.8'
|
||||
|
@ -396,15 +396,16 @@ class Chromium(object):
|
||||
pass
|
||||
|
||||
def _onTargetDestroyed(self, **kwargs):
|
||||
tab_id = kwargs['targetId']
|
||||
self._dl_mgr.clear_tab_info(tab_id)
|
||||
for key in [k for k, i in self._frames.items() if i == tab_id]:
|
||||
self._frames.pop(key, None)
|
||||
for d in self._all_drivers.get(tab_id, tuple()):
|
||||
d.stop()
|
||||
self._drivers.pop(tab_id, None)
|
||||
self._all_drivers.pop(tab_id, None)
|
||||
self._tab_to_close.discard(tab_id)
|
||||
with self._lock:
|
||||
tab_id = kwargs['targetId']
|
||||
self._dl_mgr.clear_tab_info(tab_id)
|
||||
for key in [k for k, i in self._frames.items() if i == tab_id]:
|
||||
self._frames.pop(key, None)
|
||||
for d in self._all_drivers.get(tab_id, tuple()):
|
||||
d.stop()
|
||||
self._drivers.pop(tab_id, None)
|
||||
self._all_drivers.pop(tab_id, None)
|
||||
self._tab_to_close.discard(tab_id)
|
||||
|
||||
def _on_disconnect(self):
|
||||
if not self._disconnect_flag:
|
||||
|
@ -302,10 +302,10 @@ def tree(ele_or_page, text=False, show_js=False, show_css=False):
|
||||
def format_headers(txt):
|
||||
if isinstance(txt, (dict, CaseInsensitiveDict)):
|
||||
for k, v in txt.items():
|
||||
if k in (':method', ':scheme', ':authority', ':path'):
|
||||
txt.pop(k)
|
||||
elif v not in (None, False, True):
|
||||
if v not in (None, False, True):
|
||||
txt[k] = str(v)
|
||||
for i in (':method', ':scheme', ':authority', ':path'):
|
||||
txt.pop(i, None)
|
||||
return txt
|
||||
headers = {}
|
||||
for header in txt.split('\n'):
|
||||
|
Loading…
x
Reference in New Issue
Block a user