In QML, one can use XMLHttpRequest. Not so with a plain JS engine. The
reason for that lies in the fact that a JS engine did not have any
network access, because all network functionality was in the type
loader, and the type loader was coupled to the QV4::Engine.
This has changed in d2bc4a4330, but we
stil don't expose XMLHttpRequest to a plain QJSEngine.
Nevertheless, it conceptually lives in the global object, and we need to
collect information about it to enable code completion and linting.
Consequently, expose a function in QV4::Engine, which allows us to
manually trigger the registration, and call it in qmljsrootgen.
Going forward, we should arguably have a QJSEngine::Extension for
XMLHttpReuqest, after which we could remove the hack.
Note that as before, qmljsrootgen prints a few warnings, because we call
functions in contexts in which they must not be called. As before, we
ignore this for now.
As a side-effect, this adds a few more entries to the qmltypes file for
new entries on the global Qt object.
Task-number: QTBUG-137075
Pick-to: 6.10
Change-Id: I21e9d62bf075e8d4356db8f357502feb927717e7
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>