As of today, the syntax for Web IDL constructors no longer involves an extended attribute on the interface. There's now something that looks more like a method named "constructor" with no explicitly-defined return type.

So this:

  [Constructor(DOMString str)]
  interface MyInterface {};

is now written like so:

  interface MyInterface {
    constructor(DOMString str);
  };

This means we can now specify extended attributes on the constructor, and therefore we no longer assume that all constructors throw. If yours does, you can use [Throws] in the usual way to indicate that:

  interface ThrowingConstructor {
    [Throws] constructor();
  };

It may take some time for specifications to update to the new syntax because not all of the tooling is updated yet; see https://github.com/heycam/webidl/issues/778 which tracks that. So in the meantime, including new spec IDL that uses constructors may require some hand-editing to get it into the new form.

-Boris
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to