mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Scripts: Register window.external to all frames
It seems that only one QWebChannel connection per page is supported, so we need to forward window.external to all subframes.
This commit is contained in:
parent
fa2779e6b9
commit
19f1ed6bfb
@ -459,7 +459,7 @@ function init()
|
||||
if (window.external) {
|
||||
init();
|
||||
} else {
|
||||
document.addEventListener('qz_external_created', init);
|
||||
document.addEventListener('_qupzilla_external_created', init);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -25,12 +25,24 @@ QString Scripts::setupWebChannel()
|
||||
{
|
||||
QString source = QL1S("(function() {"
|
||||
"%1"
|
||||
"new QWebChannel(qt.webChannelTransport, function(channel) {"
|
||||
" window.external = channel.objects.qz_object;"
|
||||
"function registerExternal(e) {"
|
||||
" window.external = e;"
|
||||
" if (window.external) {"
|
||||
" var event = new Event('qz_external_created');"
|
||||
" var event = new Event('_qupzilla_external_created');"
|
||||
" document.dispatchEvent(event);"
|
||||
" }"
|
||||
"}"
|
||||
"if (self !== top) {"
|
||||
" if (top.external)"
|
||||
" registerExternal(top.external);"
|
||||
" else"
|
||||
" top.document.addEventListener('_qupzilla_external_created', function() {"
|
||||
" registerExternal(top.external);"
|
||||
" });"
|
||||
" return;"
|
||||
"}"
|
||||
"new QWebChannel(qt.webChannelTransport, function(channel) {"
|
||||
" registerExternal(channel.objects.qz_object);"
|
||||
"});"
|
||||
"})()");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user