- From: <bugzilla@jessica.w3.org>
- Date: Thu, 27 Dec 2012 17:53:45 +0000
- To: public-audio@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20525 Jussi Kalliokoski <jussi.kalliokoski@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |INVALID --- Comment #4 from Jussi Kalliokoski <jussi.kalliokoski@gmail.com> --- (In reply to comment #3) > (In reply to comment #2) > > The object on the global scope is a different object :) This is where WebIDL > > gets funky. That's called the "interface object" and it does not expose the > > methods. > > > > See: > > http://www.w3.org/TR/WebIDL/#es-interfaces > > > > (yes, it's freeken complicated and I've been trying to grok that for about a > > year) > > > > you basically end up with this: > > //This one holds constants and statics > > var interfaceObject= function MidiAccess(){ > > if(this instanceof MidiAccess){ > > var msg="DOM object constructor cannot be called as a function." > > throw new TypeError(msg); > > } > > } > > //This one makes actual instances > > var interfacePrototypeObj = function MIDIAccess(){} > > window.MIDIAccess = interfaceObject; > > > > > > You can confirm this in the browser by querying any object. For example: > > > > >> Event > > function Event() { [native code] } > > >>Event() > > TypeError: DOM object constructor cannot be called as a function. > > > > Note that Event does not expose preventDefault() or any other instance > > method. Only the constants are exposed. > > Event doesn't, but Event.prototype does: > > typeof Event.prototype.preventDefault === 'function' // true But actually, yeah, WebIDL prevents calling the interface methods with a non-platform-object "this" value, so I'll revert this. -- You are receiving this mail because: You are the QA Contact for the bug.
Received on Thursday, 27 December 2012 17:53:47 UTC