From W3C Wiki
Jump to: navigation, search

ECMAScript binding issues

This page is a collection of stuff regarding the ECMAScript DOM binding spec.

Some things to take into account

Differences between OMG IDL and W3C IDL

I think it'd be best to use a subset of OMG IDL. From looking a few IDL snippets on, this would be removing:

  • local types
  • valuetypes (except boxed valuetypes, which are used to define DOMString in DOM3Core)
  • char, wchar, string, wstring, fixed_pt types
  • enums
  • structs
  • natives
  • unions
  • oneway
  • context expressions
  • out/inout parameters
  • "Repository Identity Related Declarations"
  • "Event Declarations"
  • "Component Declarations"
  • "Home Declarations"

Need arrays for <canvas> image data access.

But we now have operation overloading (e.g. as used in XHR). Do we really want this?

Why use `valuetype DOMString sequence<unsigned short>` instead of `typedef sequence<unsigned short> DOMString`? does it allow `null`?

Why use `sequence<unsigned short>` instead of `wstring`? is it because a `wchar` must be a character (and thus can't be a UTF-16 surrogate)?

We should use `getraises` and `setraises` from OMG IDL 3.0 for attribute exceptions.

W3C IDL type → ES type mapping

IDL type
`void` (for return types)
`unsigned short`
`unsigned long`
`unsigned long long`
`DOMString` (from DOM3Core)

Need to define what happens when an "invalid" value is given for a given type (e.g. -1 for an `unsigned long`). Certain things can probably be defined in terms of ToUint32, ToObject, etc. from ecma-262.

Overloaded operations


Map- and array-like objects

Anne says Jonas thought of an idea where (static) NodeLists can have their integer properties assigned to, and the node would be replaced.

Host objects implementing interfaces

ES objects implementing interfaces

Callback functions

Other qualifiers

  • const
  • readonly
    • just corresponds to ReadOnly property attribute? or should throw an exception on setting?


Function calling


From Hixie

Feel free to fold the following into the above sections. I just wanted to jot some things down lest I forget.

This spec will have to define how to determine the following for each object what the various things in ECMAScript 8.6.2 are for the object (Class, Prototype, CanPut, DefaultValue, Construct, etc).

It will have to define for each member of each object how whether the property is ReadOnly, DontEnum, DontDelete, Internal, Replaceable (the latter being an extension to JS that isn't in the spec).

It will have to define how to tell what's a constructor vs what's a method and how to handle them when they are called as the opposite of each other.

It will have to define what the prototype chain of each object should be, in terms of the browsing contexts defined in HTML5.

It will have to define what happens when you change objects in the prototype chain.

It will have to define how type coercion happens given typed parameters.

It will have to support varargs.