mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 857439 Part 4: Fix MediaStreamList wrapping r=bz
This commit is contained in:
parent
2fc3ae46ec
commit
00b6a3274d
@ -28,22 +28,18 @@ MediaStreamList::~MediaStreamList()
|
||||
}
|
||||
|
||||
JSObject*
|
||||
MediaStreamList::WrapObject(JSContext* cx, ErrorResult& error)
|
||||
MediaStreamList::WrapObject(JSContext* cx, bool* aTookOwnership)
|
||||
{
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
nsCOMPtr<nsIScriptGlobalObject> global =
|
||||
do_QueryInterface(mPeerConnection->GetWindow());
|
||||
JSObject* scope = global->GetGlobalJSObject();
|
||||
if (!scope) {
|
||||
error.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSAutoCompartment ac(cx, scope);
|
||||
JSObject* obj = MediaStreamListBinding::Wrap(cx, scope, this);
|
||||
if (!obj) {
|
||||
error.Throw(NS_ERROR_FAILURE);
|
||||
}
|
||||
JSObject* obj = MediaStreamListBinding::Wrap(cx, scope, this, aTookOwnership);
|
||||
return obj;
|
||||
#else
|
||||
return nullptr;
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
MediaStreamList(sipcc::PeerConnectionImpl* peerConnection, StreamType type);
|
||||
~MediaStreamList();
|
||||
|
||||
JSObject* WrapObject(JSContext* cx, ErrorResult& error);
|
||||
JSObject* WrapObject(JSContext* cx, bool* aTookOwnership);
|
||||
|
||||
DOMMediaStream* IndexedGetter(uint32_t index, bool& found);
|
||||
uint32_t Length();
|
||||
|
@ -1466,11 +1466,11 @@ GetStreams(JSContext* cx, PeerConnectionImpl* peerConnection,
|
||||
{
|
||||
nsAutoPtr<MediaStreamList> list(new MediaStreamList(peerConnection, type));
|
||||
|
||||
ErrorResult rv;
|
||||
JSObject* obj = list->WrapObject(cx, rv);
|
||||
if (rv.Failed()) {
|
||||
bool tookOwnership = false;
|
||||
JSObject* obj = list->WrapObject(cx, &tookOwnership);
|
||||
if (!tookOwnership) {
|
||||
streams->setNull();
|
||||
return rv.ErrorCode();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Transfer ownership to the binding.
|
||||
|
Loading…
Reference in New Issue
Block a user