Bugzilla – Bug 17593
Figure out if something needs to be said about [[Construct]]
Last modified: 2012-06-26 09:07:16 UTC
* Ms2ger tries to figure out what kind of error new window.ImageData(1,1) should throw
<bz> ms2ger: doesn't the spec say?
<Ms2ger> I'm not sure
<bz> one sec
<Ms2ger> [[Construct]] doesn't appear in normative prose in WebIDL
<bz> " Interfaces that do not have a constructor will throw an exception when called as a function. "
<Ms2ger> Only, I'm not sure if it needs to
<bz> oh, hmm
<bz> it defines a [[Call]]
<bz> that might be a spec bug
<Ms2ger> Looking at http://ecma-international.org/ecma-262/5.1/#sec-11.2.2
<bz> and even the [[Call]] doesn't say what exception is thrown
<bz> just "an exception"
<Ms2ger> "If constructor does not implement the [[Construct]] internal method, throw a TypeError exception."
<bz> please file bugs on webidl
Cameron, please figure it out :)
Note to self: fix 2d.imageData.object.ctor.html when this bug is fixed.
Interface objects are function objects:
All function objects have the the default [[Construct]] behaviour that the ES spec defines:
This is regardless of whether there was a [Constructor] on the interface.
The default [[Construct]] behaviour is to create a new object and invoke [[Call]]:
[[Call]] will throw a TypeError if the interface was not defined with a [Constructor]:
(scroll down to "The internal [[Call]] method ...")