Make AudioContext an EventTarget

RESOLVED FIXED in mozilla23

Status

()

defect
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Ehsan, Assigned: Ehsan)

Tracking

Trunk
mozilla23
x86
macOS
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Blocks: 865261
Posted patch WIP (obsolete) — Splinter Review
This crashes when AddRefing an AudioContext:

Assertion failure: e->mObject == owner (wrong entry), at ../../../dist/include/nsISupportsImpl.h:145

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
nsCycleCollectingAutoRefCnt::incr (this=0x124f61e58, owner=0x124f61e10) at nsISupportsImpl.h:145
145	      MOZ_ASSERT(e->mObject == owner, "wrong entry");
(gdb) bt
#0  nsCycleCollectingAutoRefCnt::incr (this=0x124f61e58, owner=0x124f61e10) at nsISupportsImpl.h:145
#1  0x0000000102639d54 in mozilla::dom::AudioContext::AddRef (this=0x124f61e10) at AudioContext.h:61
#2  0x0000000102639bd8 in nsRefPtr<mozilla::dom::AudioContext>::nsRefPtr (this=0x10d193de8, aRawPtr=0x124f61e10) at nsAutoPtr.h:904
#3  0x0000000102638f8d in nsRefPtr<mozilla::dom::AudioContext>::nsRefPtr (this=0x10d193de8, aRawPtr=0x124f61e10) at nsAutoPtr.h:905
#4  0x00000001026386a4 in mozilla::dom::AudioBuffer::AudioBuffer (this=0x10d193dc0, aContext=0x124f61e10, aLength=2048, aSampleRate=8000) at /Users/ehsanakhgari/moz/mozilla-central/content/media/webaudio/AudioBuffer.cpp:51
#5  0x00000001026385fd in mozilla::dom::AudioBuffer::AudioBuffer (this=0x10d193dc0, aContext=0x124f61e10, aLength=2048, aSampleRate=8000) at /Users/ehsanakhgari/moz/mozilla-central/content/media/webaudio/AudioBuffer.cpp:55
#6  0x000000010263f45f in mozilla::dom::AudioContext::CreateBuffer (this=0x124f61e10, aJSContext=0x123683f80, aNumberOfChannels=2, aLength=2048, aSampleRate=8000, aRv=@0x7fff5fbf4690) at /Users/ehsanakhgari/moz/mozilla-central/content/media/webaudio/AudioContext.cpp:100
#7  0x0000000103bca42d in mozilla::dom::AudioContextBinding::createBuffer (cx=0x123683f80, obj={<js::HandleBase<JSObject *>> = {<No data fields>}, ptr = 0x7fff5fbf4790}, self=0x124f61e10, argc=3, vp=0x10da321c0) at AudioContextBinding.cpp:226

Am I doing something wrong with the CC macros here?
Assignee: nobody → ehsan
Status: NEW → ASSIGNED
Attachment #741663 - Flags: feedback?(continuation)
Comment on attachment 741663 [details] [diff] [review]
WIP

Hmm.  My interpretation is that it looks like nsDOMEventTargetHelper is nsISupports, so you are going to have to reCOMtaminate AudioContext.

- Instead of NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING I think you want NS_DECL_ISUPPORTS_INHERITED.
- Define a QI again with the right CC stuff.

Probably other stuff.
Attachment #741663 - Flags: feedback?(continuation)
I am a fool, and you are a hero! :-)
Posted patch Patch (v1)Splinter Review
Attachment #741663 - Attachment is obsolete: true
Attachment #741671 - Flags: review?(paul)
Comment on attachment 741671 [details] [diff] [review]
Patch (v1)

Review of attachment 741671 [details] [diff] [review]:
-----------------------------------------------------------------

I can't review that. While I think I understand what is going on, I have no idea if it is correct, sorry.
Attachment #741671 - Flags: review?(paul)
Maybe Olli could review it?
Comment on attachment 741671 [details] [diff] [review]
Patch (v1)

Sure.
Attachment #741671 - Flags: review?(bugs)
Comment on attachment 741671 [details] [diff] [review]
Patch (v1)

As far as I see, you can drop mWindow. nsDOMEventTargetHelper knows the owner
and has GetOwner().

With that, r=me
Attachment #741671 - Flags: review?(bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/120f3f229643
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
Depends on: 866570
Mass moving Web Audio bugs to the Web Audio component.  Filter on duckityduck.
Component: Video/Audio → Web Audio
You need to log in before you can comment on or make changes to this bug.