[Qtwebengine] Uncaught TypeError: channel.execCallbacks[message.id] is not a function

Goldberg, Ilya (DWFN) Ilya.Goldberg at smithsdetection.com
Fri Apr 24 13:20:00 CEST 2020


Hi Milian,

Thank you for your response.

I've tried the latest qwebchannel.js file from 5.14 code.
Still having the same "Uncaught TypeError: ..." appears.
I've double checked both our application and web page again in Qt5.5 and it is working fine, without any errors.

Assuming that WebEngine is working and the issue is probably related to an upgrade of Chromium from version 40.x to 69.x but still one would expect some sort of backward compatibility.
In order to debug our web page I need to access developer tools in Chrome via the QTWEBENGINE_REMOTE_DEBUGGING port. And this feature does not work either. I've sent a separate request to this list about the developer tools issue.
And again the developer tools works fine from application running under Qt5.5 but does not under Qt5.12.8. There are no changes in our code between these trials.

Meanwhile, here is how we are using the webchannel in our main application code:
m_webView = new QWebEngineView();
m_page = new MyWebEnginePage(this);
m_webView->setPage(m_page);
m_webChannel = new WebChannel(this);

QUrl URL(QString("http://www.google.com") ); //This is just an example web page
QWebChannel *channel = new QWebChannel(m_webView->page());
m_webView->page()->setWebChannel(channel);
channel->registerObject(QStringLiteral("dialog"), m_webChannel);
m_webView->load(URL);
m_webView->show();

for(const auto& child:m_webView->children())
    {
        child->installEventFilter(this);
   }

Where WebChannel declared as:
/* This object will be shared with HTML client via the QWebChannel */
class WebChannel : public QObject
{
    Q_OBJECT


public:
    explicit WebChannel(QObject* parent = 0) : QObject(parent) {}

signals:
    void clicked();
    void returned(bool home);

public slots:
/*
        These slots are invoked from the HTML client side.
*/
        Q_INVOKABLE void clickCallback();
        Q_INVOKABLE void callbackSlot(bool home);
};


On the web page side, the qwebchannel is used to return ClickCallback() on every touch and also callbackSlot() when needed to leave the web page and return back to main application.  JavaScript extract to handle the qwebchannel:

<script type="text/javascript" src="<c:url value="/js/qtwebchannel/qwebchannel.js"/>"></script>
if(typeof qt != 'undefined')
{
//This will only work in QtWebEngine browser
new QWebChannel(qt.webChannelTransport, function (channel) {
dialog = channel.objects.dialog;
});
}

var exitSession = function(home)
{
if (typeof dialog != 'undefined')
{
dialog.callbackSlot(home);
}
else if(typeof qt != 'undefined')
{
//This will only work in QtWebEngine browser
new QWebChannel(qt.webChannelTransport, function (channel) {
dialog = channel.objects.dialog;
dialog.callbackSlot(home);
});
}
}

jq('body').on('touchstart mousedown', function(e) {

if(!clickFlag) {
clickFlag = true;
setTimeout(function(){ clickFlag = false; }, 500);

clearTimeout(sessionTimeout);
sessionTimeout = setTimeout(function(){ exitSession(false); }, defaultSessionTimeout_ms);

if (typeof dialog != 'undefined') {
dialog.clickCallback();
} else if(typeof qt != 'undefined') {
//This will only work in QtWebEngine browser
new QWebChannel(qt.webChannelTransport, function (channel) {
dialog = channel.objects.dialog;
dialog.clickCallback();
});
}
} .....

Can you spot any problem with the way we use qwebchannel?

Cheers,
Ilya


-----Original Message-----
From: QtWebEngine <qtwebengine-bounces at lists.qt-project.org> On Behalf Of qtwebengine-request at lists.qt-project.org
Sent: 23 April 2020 11:00
To: qtwebengine at lists.qt-project.org
Subject: EXTERNAL: QtWebEngine Digest, Vol 49, Issue 1

CAUTION: This email came from outside Smiths Group. Be cautious with the contents unless you can confirm the sender is genuine.


Send QtWebEngine mailing list submissions to
        qtwebengine at lists.qt-project.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.qt-project.org/listinfo/qtwebengine
or, via email, send a message with subject or body 'help' to
        qtwebengine-request at lists.qt-project.org

You can reach the person managing the list at
        qtwebengine-owner at lists.qt-project.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of QtWebEngine digest..."


Today's Topics:

   1. Uncaught TypeError: channel.execCallbacks[message.id] is not
      a function (Goldberg, Ilya (DWFN))
   2. Re: Uncaught TypeError: channel.execCallbacks[message.id] is
      not a function (Milian Wolff)


----------------------------------------------------------------------

Message: 1
Date: Wed, 22 Apr 2020 15:30:46 +0000
From: "Goldberg, Ilya (DWFN)" <Ilya.Goldberg at smithsdetection.com>
To: "qtwebengine at lists.qt-project.org"
        <qtwebengine at lists.qt-project.org>
Subject: [Qtwebengine] Uncaught TypeError:
        channel.execCallbacks[message.id] is not a function
Message-ID:
        <DM6PR18MB2699B531513643AD620F0A7DE3D20 at DM6PR18MB2699.namprd18.prod.outlook.com>

Content-Type: text/plain; charset="utf-8"

Hi All,
We are migrating from Qt5.5 to Qt5.12.8 on CentOS 7, 64bit x86 processor.

Qt main application is working. Our webpage is based on JavaScript, running on Apache-Tomcat. It is using channel back to the main application (using qtwebchannel.js) as we need to know when user wants to return from the webpage into our main app.
The webpage works fine under Qt5.5.
After upgrading to Qt5.12.8 found that the webpage is broken (all elements are in wrong places and it does not work as expected).
In the log file found multiple messages: "Uncaught TypeError: channel.execCallbacks[message.id] is not a function".

Did anyone experienced similar error messages?
Any clue on fixing it?

Thank you.
PROPRIETARY: This e-mail contains proprietary information some or all of which may be legally privileged. It is intended for the recipient only. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qtwebengine/attachments/20200422/5c57082b/attachment-0001.html>

------------------------------

Message: 2
Date: Wed, 22 Apr 2020 20:46:13 +0200
From: Milian Wolff <milian.wolff at kdab.com>
To: "qtwebengine at lists.qt-project.org"
        <qtwebengine at lists.qt-project.org>
Cc: "Goldberg, Ilya \(DWFN\)" <Ilya.Goldberg at smithsdetection.com>
Subject: Re: [Qtwebengine] Uncaught TypeError:
        channel.execCallbacks[message.id] is not a function
Message-ID: <2525401.mvXUDI8C0e at agathebauer>
Content-Type: text/plain; charset="utf-8"

On Mittwoch, 22. April 2020 17:30:46 CEST Goldberg, Ilya (DWFN) wrote:
> Hi All,
> We are migrating from Qt5.5 to Qt5.12.8 on CentOS 7, 64bit x86 processor.
>
> Qt main application is working. Our webpage is based on JavaScript,
> running on Apache-Tomcat. It is using channel back to the main
> application (using
> qtwebchannel.js) as we need to know when user wants to return from the
> webpage into our main app. The webpage works fine under Qt5.5.
> After upgrading to Qt5.12.8 found that the webpage is broken (all
> elements are in wrong places and it does not work as expected). In the
> log file found multiple messages: "Uncaught TypeError:
> channel.execCallbacks[message.id] is not a function".
>
> Did anyone experienced similar error messages?
> Any clue on fixing it?

I haven't seen this, can you please try the latest qtwebchannel code from the
5.14 branch? Afaik it should be compatible with 5.12.

Cheers

--
Milian Wolff | milian.wolff at kdab.com | Senior Software Engineer KDAB (Deutschland) GmbH, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3826 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/qtwebengine/attachments/20200422/9be28717/attachment-0001.bin>

------------------------------

Subject: Digest Footer

_______________________________________________
QtWebEngine mailing list
QtWebEngine at lists.qt-project.org
https://lists.qt-project.org/listinfo/qtwebengine


------------------------------

End of QtWebEngine Digest, Vol 49, Issue 1
******************************************

************************************************
CAUTION:THIS MESSAGE ORIGINATED FROM THE PUBLIC INTERNET AND WAS NOT SENT FROM THE SMITHS EMAIL SYSTEM
************************************************
PROPRIETARY: This e-mail contains proprietary information some or all of which may be legally privileged. It is intended for the recipient only. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail.


More information about the QtWebEngine mailing list