This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
I'm a bit confused as to why "objects representing IDL exceptions" are considered "platform objects". It is possible to construct and throw such IDL exceptions in ECMAscript without it being a platform object. This makes IDL exceptions indistinguishable from platform objects. I'll also note that the whole notion of platform objects and that they can only be distinguished by a magical inaccessible internal property shuts out JavaScript only implementations (which seems to go a bit against the spirit of ECMAScript, which exposes most of its guts to developers). That seems bad :( If this is the case, then there should be a isPlatformObject() method defined on Object. //true var foo = Object.isPlatformObject(Node)
FYI... this is my hacky checker for platform objects: //check platform object if(ECMAScript.Type(O) === "Function"){ var name = O.name; var nativeString = "function " + name + "() { [native code] }"; if(O.toString() === nativeString){ classType = "platform object"; return classType; } }
Most (all?) behaviours of platform objects you should be able to implement using Proxies. Note that platform objects do not necessarily have to be ECMAScript host objects, so you could very well use a native object to implement them, especially since they don't need any special behaviour that you would need Proxies for. You will need to track some internal state for them though, to "know" that they are platform objects. This is because: * Object.prototype.toString needs to return "[object DOMException]" say for the DOMException IDL exception. Object.prototype.toString is defined to look at the object's class string, if it is a platform object. * Platform objects cannot be passed to something expecting a dictionary type, or a callback interface type. * The accessor property get/set functions for exception fields inspect their this object to ensure they are a platform object of the right type (and if not, throw).
NEEDSINFO awaiting concrete suggestions for text improvements.