Closed Bug 856640 Opened 11 years ago Closed 11 years ago

Properties can be added after Object.preventExtensions(document)

Categories

(Core :: DOM: Core & HTML, defect)

21 Branch
x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: bruant.d, Unassigned)

References

(Blocks 1 open bug)

Details

Testcase:
------------
var ext = Object.isExtensible(document);
console.log('ext', ext);

Object.preventExtensions(document);

ext = Object.isExtensible(document);
console.log('ext', ext);

console.log('document.azerty', document.hasOwnProperty('azerty'))
document.azerty = 12;
console.log('document.azerty', document.hasOwnProperty('azerty'))
----------------

Actual result:
Last logged value is 'true' (the property has been added)

Expected:
Last logged value should be 'false'.
Alternatively, an error could be thrown at the "Object.preventExtensions(document);" line.

I've noticed this bug in many objects which have been moved to the new WebIDL binding, so I feel the error is to be chased in that direction.
Assignee: general → nobody
Component: JavaScript Engine → DOM
My original test was on Aurora. After testing on Nightly, this seems to have been fixed.
Sorry for the false alarm.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Version: unspecified → 21 Branch
In fact, Object.preventExtensions(document) should throw:

> Platform objects implementing an interface that supports indexed or
> named properties cannot be fixed; if Object.freeze, Object.seal or
> Object.preventExtensions is called on one of these objects,
> these the function MUST throw a TypeError.
(In reply to :Ms2ger from comment #2)
> In fact, Object.preventExtensions(document) should throw:
> 
> > Platform objects implementing an interface that supports indexed or
> > named properties cannot be fixed; if Object.freeze, Object.seal or
> > Object.preventExtensions is called on one of these objects,
> > these the function MUST throw a TypeError.
True. Bug 856647
> I've noticed this bug in many objects which have been moved to the new WebIDL binding

Which "document" hasn't.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.