Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.4.2
-
None
Description
The following program, which is given as the actual example from when `registerModule` was added (https://codereview.qt-project.org/c/qt/qtdeclarative/+/345339):
QJSEngine engine; QJSValue num(666); engine.registerModule("themarkofthebeast", num); QString program = "import badnews from \"themarkofthebeast\";"; QJSValue result = engine.evaluate(program); qDebug() << result.toString();
Fails to execute, producing the following output on the console:
"SyntaxError: Unexpected token `import'"
In other words, QJEngine appears to not understand "import" at all, which is weird because it's literally the example given in the patch that added registerModule to QJSEngine.
As a consequence:
- registerModule can't be used for anything
- no modules can be imported in the JS program
- it is prohibitively difficult to extend the JS with C++ code
Unless I'm making some sort of usage mistake, this seems both basic and severe, and I'm not sure how registerModule would have ever passed testing to begin with...