W3C home > Mailing lists > Public > public-audio@w3.org > October to December 2012

[Bug 20525] MIDIAccess methods aren't restricted to instances created by requestMIDIAccess

From: <bugzilla@jessica.w3.org>
Date: Thu, 27 Dec 2012 17:38:21 +0000
To: public-audio@w3.org
Message-ID: <bug-20525-5429-Oo1vGnRNuG@http.www.w3.org/Bugs/Public/>

Marcos Caceres <w3c@marcosc.com> changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
                 CC|                            |w3c@marcosc.com
         Resolution|FIXED                       |---

--- Comment #2 from Marcos Caceres <w3c@marcosc.com> ---
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


(yes, it's freeken complicated and I've been trying to grok that for about a

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] }
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.  

Please revert the changes.

You are receiving this mail because:
You are the QA Contact for the bug.
Received on Thursday, 27 December 2012 17:38:26 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:15 UTC