Closed
Bug 934309
Opened 12 years ago
Closed 12 years ago
Web Audio Node properties don't respond to "hasOwnProperty"
Categories
(Core :: Web Audio, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: stuartmemo, Unassigned)
References
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1690.2 Safari/537.36
Steps to reproduce:
Create oscillator like so...
var context = new AudioContext(),
osc = context.createOscillator;
console.log(osc.context);
console.log(osc.hasOwnProperty('context');
Actual results:
console.log(osc.context); // logs context.
console.log(osc.hasOwnProperty('context')); // returns false
Expected results:
osc.hasOwnProperty('context') should return true as context property exists.
| Reporter | ||
Comment 1•12 years ago
|
||
Typos sorry, corrected code...
var context = new AudioContext(),
osc = context.createOscillator();
console.log(osc.context);
console.log(osc.hasOwnProperty('context'));
| Reporter | ||
Updated•12 years ago
|
Component: Untriaged → Web Audio
Product: Firefox → Core
Comment 2•12 years ago
|
||
|context| is a property of AudioNode.
Is hasOwnProperty('context') meant to return true for objects with derived interfaces?
| Reporter | ||
Comment 3•12 years ago
|
||
I believe hasOwnProperty should work regardless of the object. The fact that it's an object with that property is enough. Might be wrong though!
Comment 4•12 years ago
|
||
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty#Example:_Direct_versus_inherited_properties
If osc.hasOwnProperty('type') returns true, then this is probably intended behavior.
Comment 5•12 years ago
|
||
Looking at that example, I don't even know whether osc.hasOwnProperty('type') should return true.
| Reporter | ||
Comment 6•12 years ago
|
||
I believe it should. I think it would be different if I were to create the oscillator node and have it inherit the properties of AudioNode in JavaScript. Because such nodes are native to the browser, hasOwnProperty('whatever') should return true.
Comment 7•12 years ago
|
||
No, the Web IDL spec is very clear about that.
Why don't you use ('whatever' in osc)?
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 8•12 years ago
|
||
Is this because osc.context can't be changed on creation of the oscillator?
Yeah, I can easily get around this, I just thought it was a bug as it behaves differently in Chrome. Will raise a bug over there :)
You need to log in
before you can comment on or make changes to this bug.
Description
•