mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
639 B
41 lines
639 B
/*
|
|
* Duktape.Buffer virtual properties don't work in Object.defineProperty().
|
|
*/
|
|
|
|
/*---
|
|
{
|
|
"custom": true
|
|
}
|
|
---*/
|
|
|
|
/*===
|
|
object 8 testdata
|
|
100
|
|
TypeError
|
|
100
|
|
object 8 testdata
|
|
===*/
|
|
|
|
function test() {
|
|
var buf = new Duktape.Buffer('testdata');
|
|
print(typeof buf, buf.length, buf);
|
|
|
|
print(buf[4]);
|
|
try {
|
|
Object.defineProperty(buf, '4', {
|
|
value: 68
|
|
});
|
|
} catch (e) {
|
|
// TypeError: property is virtual
|
|
print(e.name);
|
|
//print(e.stack || e);
|
|
}
|
|
print(buf[4]);
|
|
print(typeof buf, buf.length, buf);
|
|
}
|
|
|
|
try {
|
|
test();
|
|
} catch (e) {
|
|
print(e.stack || e);
|
|
}
|
|
|