mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Fix creating QWebChannel on first QWebEnginePage load
The "qt" object may be undefined at the time QWebEngineScript that creates web channel is being run. Try to create the web channel until it finally succeeds in 100ms intervals. Fixes the "Uncaught ReferenceError: qt is not defined" error message.
This commit is contained in:
parent
962c236372
commit
f785d81c41
@ -45,9 +45,16 @@ QString Scripts::setupWebChannel()
|
||||
" return;"
|
||||
"}"
|
||||
""
|
||||
"new QWebChannel(qt.webChannelTransport, function(channel) {"
|
||||
" registerExternal(channel.objects.qz_object);"
|
||||
"});"
|
||||
"function registerWebChannel() {"
|
||||
" try {"
|
||||
" new QWebChannel(qt.webChannelTransport, function(channel) {"
|
||||
" registerExternal(channel.objects.qz_object);"
|
||||
" });"
|
||||
" } catch (e) {"
|
||||
" setTimeout(registerWebChannel, 100);"
|
||||
" }"
|
||||
"}"
|
||||
"registerWebChannel();"
|
||||
""
|
||||
"})()");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user