1
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:
David Rosca 2016-11-04 10:59:28 +01:00
parent 962c236372
commit f785d81c41

View File

@ -45,9 +45,16 @@ QString Scripts::setupWebChannel()
" return;"
"}"
""
"function registerWebChannel() {"
" try {"
" new QWebChannel(qt.webChannelTransport, function(channel) {"
" registerExternal(channel.objects.qz_object);"
" });"
" } catch (e) {"
" setTimeout(registerWebChannel, 100);"
" }"
"}"
"registerWebChannel();"
""
"})()");