Closed Bug 856647 Opened 11 years ago Closed 11 years ago

Throw on Object.preventExtensions(document)

Categories

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

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bruant.d, Unassigned)

References

Details

From WebIDL:
http://dev.w3.org/2006/webapi/WebIDL/#indexed-and-named-properties
> 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.

Currently, Object.preventExtensions(document) doesn't throw while it should.
(thanks Ms2ger for the heads up)
Blocks: 803542
Presumably moving to WebIDL bindings here will fix.  Certainly it works right for nodelists.
No longer blocks: 803542
Depends on: 803542
One spec question:  Should Object.preventExtensions(window) throw?  As spec is written right now, yes, but that doesn't seem right to me.
Flags: needinfo?(cam)
If it doesn't throw, then you need to define what happens if new indexed properties are meant to appear on the object.  Having them appear when the object has [[Extensible]] == false would violate the rules for host objects in http://es5.github.com/#x8.6.2.  I thought it would be simpler to disallow this rather than define the set of visible indexed properties to be capped at what it is at the time Object.preventExtensions() is called.
Flags: needinfo?(cam)
Ah, I had forgotten that indexed properties are on the object itself.  So yeah, throwing for a window makes sense, esp. as you're always talking about a WindowProxy anyway.
Looks fixed here.
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.