Javascript 为什么XMLHttpRequestResponseText不存在?

Javascript 为什么XMLHttpRequestResponseText不存在?,javascript,qt,xmlhttprequest,qml,Javascript,Qt,Xmlhttprequest,Qml,QML中的可复制示例: main.cpp #include <QSsl> 我得到的输出: qml: calling callback 我预期的产出: qml: calling callback qml: RESULTS: <the HTML located at https://www.google.com/> 然后我得到输出: qml: Am I alive? qml: I am alive 为什么XMLHttpRequest responseText不存在?为

QML中的可复制示例:

main.cpp

#include <QSsl>
我得到的输出:

qml: calling callback
我预期的产出:

qml: calling callback
qml: RESULTS: <the HTML located at https://www.google.com/>
然后我得到输出:

qml: Am I alive?
qml: I am alive

为什么XMLHttpRequest responseText不存在?为什么它会杀死console.log(),而不会抛出“未定义”或其他错误?是否有更好的方法从该网页中删除html?

在使用Qt Creator 4.11.0的Windows 10 x86_64中,OP的
main.qml中的此函数根本不起任何作用:

function logResults(results) {
    console.log("RESULTS: " + results)
}
但它在Linux上工作得非常好。问题只存在于Windows中。输出面板中未打印任何内容。没有错误,没有“qml:something”。娜达。作为一种解决方法,此备选方案可用于:

function logResults(results) {
    console.log("RESULTS Length=", results.length);
    console.log("results.substr=", results.substr(0, 20)); 
}
它在“应用程序输出”面板上打印一些内容:

工作正常,但再次失败:

console.log("results.substr=", results.substr(0, 32800)); 
这表明有一个大约32K的限制,当内容大于此限制时,console.log()会自动失败。但只在窗户里。这闻起来像是Qt里的一只虫子

编辑

这不仅是
console.log()
的问题,也是QtCreator的日志记录的问题。此程序无法打印应用程序输出面板中的所有输出:

qml: RESULTS Length= 47932
qml: results.substr= <!doctype html><html
#include <QCoreApplication>
#include <QDebug>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QString str;
    str.fill('1', 32763);
    qDebug() << str;
    str.fill('2', 32764);
    qDebug() << str;
    return 0;
}
#包括
#包括
int main(int argc,char*argv[])
{
qcorea应用程序(argc、argv);
QString-str;
填充街('1',32763);
qDebug()在终端复选框中运行,但当复选框清除时将忽略该复选框。任何大于32763个字符的消息都将在应用程序输出中静音


创建错误报告:

在使用Qt 5.14的linux中,我得到了
qml:调用回调qml:RESULTS:谢谢,知道它至少部分工作,这是一个很大的安慰。我正在运行windows Qt 5.12.6…安装了QtWebEngine,我正在通过将SSL.dll文件放在/debug和/release文件夹中来公开这些文件…如果这可能导致此问题,请打开十个我。否则,我正在安装5.14,我会在那里试用。我建议您找出您使用的Qt版本需要的OpenSSL版本。您在控制台中收到任何错误消息吗?最初我收到一个错误,直到我将.dll文件放到调试和发布文件夹中…现在我已将OpenSSL更新为1.1.1版,t当我设置
INCLUDEPATH+=C:\OpenSSL-Win64\bin
…时,我还将
libcrypto
libssl
.dll文件从
\bin
中删除到了/debug和/release文件夹中。我遇到了错误
qt.network.ssl:qsslslslslslslslslssocket::connectToHostEncrypted:TLS初始化失败
它在我的Ubuntu 19.04环境中工作我将更深入地研究windows OpenSSL,这似乎是这里的问题看起来该漏洞现在已在Qt 5.14.2中修复:
console.log("results.substr=", results.substr(0, 32000)); 
console.log("results.substr=", results.substr(0, 32800)); 
#include <QCoreApplication>
#include <QDebug>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QString str;
    str.fill('1', 32763);
    qDebug() << str;
    str.fill('2', 32764);
    qDebug() << str;
    return 0;
}