Closed
Bug 901723
Opened 12 years ago
Closed 11 years ago
Uint8Array prototype is not extensible.
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 695438
People
(Reporter: adam, Unassigned)
References
Details
User Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36
Steps to reproduce:
Create a simple script:
Uint8Array.prototype.read = function () {
this.start = 5;
console.log(this.start); // variable undefined
};
Also:
Uint8Array.prototype.start = 5;
Uint8Array.prototype.read = function () {
this.start = 6;
console.log(this.start); // prints 6
};
The same happens with Object.defineProperty(Uint8Array.prototype, ...
Actual results:
this.start behaves as an immutable variable, you can't assign a value to it.
Expected results:
It should get the correct value or raise an error (at least in strict mode).
![]() |
||
Comment 1•12 years ago
|
||
Isn't this just bug 695438? In particular, it's the _instances_ that are not extensible, not the prototype, no?
You are right, this seems to be a duplicate, they describe the very same behavior.
But how can I add a custom property to every Uint8Array? Do I have to create a wrapper object?
Comment 3•11 years ago
|
||
Yup, this is a duplicate of bug 695438. Once that is fixed, defining a getter/setter will work.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•