You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The custom user agent breaks again, and the devtool also breaks. Moreover, if I close one window, then the whole program freezes and crashes. On the Linux terminal it gives a segmentation fault.
I tried moving the code of customizing user agent after os.environ['QTWEBENGINE_REMOTE_DEBUGGING'] = BrowserView.inspector_port in webview/platforms/qt.py and getting the devtool fixed. Though I don't know why it works:
if is_webengine:
environ_append(
'QTWEBENGINE_CHROMIUM_settings',
'--use-fake-ui-for-media-stream',
'--enable-features=AutoplayIgnoreWebAudio',
)
- user_agent = _settings['user_agent']- if user_agent and is_webengine:- self.view.page().profile().setHttpUserAgent(user_agent)
if _settings['debug'] and is_webengine:
# Initialise Remote debugging (need to be done only once)
if not BrowserView.inspector_port:
BrowserView.inspector_port = BrowserView._get_debug_port()
os.environ['QTWEBENGINE_REMOTE_DEBUGGING'] = BrowserView.inspector_port
else:
self.view.setContextMenuPolicy(
QtCore.Qt.NoContextMenu
) # disable right click context menu
+ user_agent = _settings['user_agent']+ if user_agent and is_webengine:+ self.view.page().profile().setHttpUserAgent(user_agent)
if is_webengine:
if _settings['private_mode']:
self.profile = QWebEngineProfile()
For the other two issues. I compared the commits and found the changes related to them:
A commit between f277868 and 54cd806 (I checked the repo's commit history) breaks the custom user agent:
if is_webengine:
if _settings['private_mode']:
self.profile = QWebEngineProfile()
else:
self.profile = QWebEngineProfile('pywebview')
self.profile.setPersistentStoragePath(_profile_storage_path)
self.cookies = {}
cookie_store = self.profile.cookieStore()
cookie_store.cookieAdded.connect(self.on_cookie_added)
cookie_store.cookieRemoved.connect(self.on_cookie_removed)
- self.view.setPage(BrowserView.WebPage(self.view, profile=self.profile))+ self.view.setPage(BrowserView.WebPage(self, profile=self.profile))
elif not is_webengine and not _settings['private_mode']:
logger.warning('qtwebkit does not support private_mode')
Commit 3077861 causes the segmentation fault when closing the window:
del BrowserView.instances[self.uid]
+ self.view.page().deleteLater()
self.close()
If I revert the above two changes then the issue is resolved. Though I don't know why it works (again).
Practicalities
YES I am willing to work on this issue myself.
NO I am prepared to support this issue financially.
The text was updated successfully, but these errors were encountered:
Sorry for the late response. I have not tested with PyQT6, I am still on 5. i will try to test to reproduce these issues, but meanwhile could you create a PR with your fixes?
self.view.page().deleteLater() was added to address page not being released after the window close.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Specification
I believe this issue is not related to OS. PyQt5 is not tested.
Description
The custom user agent breaks again, and the devtool also breaks. Moreover, if I close one window, then the whole program freezes and crashes. On the Linux terminal it gives a segmentation fault.
I tried moving the code of customizing user agent after
os.environ['QTWEBENGINE_REMOTE_DEBUGGING'] = BrowserView.inspector_port
inwebview/platforms/qt.py
and getting the devtool fixed. Though I don't know why it works:For the other two issues. I compared the commits and found the changes related to them:
A commit between f277868 and 54cd806 (I checked the repo's commit history) breaks the custom user agent:
Commit 3077861 causes the segmentation fault when closing the window:
del BrowserView.instances[self.uid] + self.view.page().deleteLater() self.close()
If I revert the above two changes then the issue is resolved. Though I don't know why it works (again).
Practicalities
YES I am willing to work on this issue myself.
NO I am prepared to support this issue financially.
The text was updated successfully, but these errors were encountered: