Re: Discussion of File API at TPAC in Lyon

On Sun, Nov 14, 2010 at 8:32 AM, Cameron McCormack <cam@mcc.id.au> wrote:
> Jonas Sicking:
>> Since I wrote the IDL for indexeddb above, WebIDL has gotten support
>> for "static" which should do what we want. Though it's a bit unclear
>> if using a real interface would cause there to be a .prototype
>> property on the URL interface which we for now don't want, right. It's
>> also unclear if static functions appear on URL objects as well.
>
> The new static keyword will cause the function property to exist on the
> interface object and not on the prototype. †Thus you canít access the
> function directly by getting a property on an instance of the interface.

Ok, here is what I'll propose as the final solution:

FileAPI will define the following WebIDL:

[Supplemental]
interface URL {
  static DOMString createObjectURL(in Blob blob);
  static void revokeObjectURL(in DOMString url);
};

It will also contain the following normative text:

ECMAScript implementations of this specification MUST ensure that they
do not expose a <code>prototype</code> property on the URL interface
object unless the implementation also implements the [URL]
specification. In other words, the following expression
<code>URL.prototype</code> MUST evaluate to true if the implementation
implements the [URL] specification, and MUST NOT evaluate to true
otherwise.

I'll also talk with Adam Barth and encourage the following text in the
URL specification:

Users of this API are encouraged to feature test by checking <code>if
(URL && URL.prototype) { ...</code>. Otherwise there is a risk that
implementations which implement the [File API] specification, but not
this specification, will pass the feature test.


Unless I hear otherwise from people, I'll assume that everyone is
happy with this.

/ Jonas

Received on Tuesday, 16 November 2010 00:35:59 UTC