Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
5.7.0
-
None
-
linux, x64 but likely present on all OSes
Description
The qt object placed in the global Javascript namespace is deleted when the page is reloaded, or a new page is loaded in an existing QWebEngineView.
This is a regression from previous Qt releases (IIRC the last version I tested on was 5.5)
Simply PyQt script to replicate
from PyQt5.Qt import QApplication, QWebEngineView, QTimer, QWebChannel app = QApplication([]) v = QWebEngineView() c = QWebChannel() v.page().setWebChannel(c) v.setHtml('<script>alert("qt is: " + window.qt)</script>') v.show() QTimer.singleShot(1000, v.reload) app.exec_()
The first alert shows an existing window.qt the second alert (after the reload) show window.qt is undefined.
This breaks communication between the web application and the C++ application using QWebChannel.