Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
5.10.1, 5.11.0 Alpha, 5.11.0 Beta 1
-
None
Description
E.g.:
console.log(JSON.stringify(Object.getOwnPropertyDescriptor(Function.prototype, 'toString')));
in Qt <= 5.9 prints correct:
{"writable":true,"enumerable":false,"configurable":true}
in Qt >= 5.10 prints wrong:
{"writable":false,"enumerable":false,"configurable":false}
Also:
(function() { var funcToString = Function.prototype.toString; var funcLength = 'function'.length; Object.defineProperty(Function.prototype, 'toString', { value: function() { var ret = funcToString.call(this); if (this.name) ret = ret.slice(0, funcLength) + ' ' + this.name + ret.slice(funcLength); return ret; }, writable: true, enumerable: false, configurable: true }); }()) function foo() { } console.log(foo.toString());
in <= 5.9 works as intended (adds name to function string), in >= 5.10 throws TypeError: Type error (this is wrong behavior).
As the result, it is not possible to use any polyfill JS library inside QML JS engine, since all of them relies on modifying builtins functions.
Attachments
Issue Links
- relates to
-
QTBUG-55058 Qt 5.7 QML breaks 3rd party JavaScript library
- Reported
-
QTBUG-84341 ECMAScript / Javascript Engine builtin objects are immutable (frozen)
- Open