mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 861718 - Friendly error about PeerConnection missing in Offline mode. r=jesup
This commit is contained in:
parent
1d8fb34e7d
commit
75340a373b
@ -272,7 +272,7 @@ PeerConnection.prototype = {
|
|||||||
|
|
||||||
// Nothing starts until ICE gathering completes.
|
// Nothing starts until ICE gathering completes.
|
||||||
this._queueOrRun({
|
this._queueOrRun({
|
||||||
func: this._pc.initialize,
|
func: this._getPC().initialize,
|
||||||
args: [this._observer, win, rtcConfig, Services.tm.currentThread],
|
args: [this._observer, win, rtcConfig, Services.tm.currentThread],
|
||||||
wait: true
|
wait: true
|
||||||
});
|
});
|
||||||
@ -285,6 +285,13 @@ PeerConnection.prototype = {
|
|||||||
_globalPCList.addPC(this);
|
_globalPCList.addPC(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_getPC: function() {
|
||||||
|
if (!this._pc) {
|
||||||
|
throw new Components.Exception("PeerConnection is gone (did you turn on Offline mode?)");
|
||||||
|
}
|
||||||
|
return this._pc;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a function to the queue or run it immediately if the queue is empty.
|
* Add a function to the queue or run it immediately if the queue is empty.
|
||||||
* Argument is an object with the func, args and wait properties; wait should
|
* Argument is an object with the func, args and wait properties; wait should
|
||||||
@ -467,7 +474,7 @@ PeerConnection.prototype = {
|
|||||||
this._onCreateOfferFailure = onError;
|
this._onCreateOfferFailure = onError;
|
||||||
|
|
||||||
this._queueOrRun({
|
this._queueOrRun({
|
||||||
func: this._pc.createOffer,
|
func: this._getPC().createOffer,
|
||||||
args: [constraints],
|
args: [constraints],
|
||||||
wait: true
|
wait: true
|
||||||
});
|
});
|
||||||
@ -493,7 +500,7 @@ PeerConnection.prototype = {
|
|||||||
|
|
||||||
// TODO: Implement provisional answer.
|
// TODO: Implement provisional answer.
|
||||||
|
|
||||||
this._pc.createAnswer(constraints);
|
this._getPC().createAnswer(constraints);
|
||||||
},
|
},
|
||||||
|
|
||||||
createAnswer: function(onSuccess, onError, constraints, provisional) {
|
createAnswer: function(onSuccess, onError, constraints, provisional) {
|
||||||
@ -536,7 +543,7 @@ PeerConnection.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._queueOrRun({
|
this._queueOrRun({
|
||||||
func: this._pc.setLocalDescription,
|
func: this._getPC().setLocalDescription,
|
||||||
args: [type, desc.sdp],
|
args: [type, desc.sdp],
|
||||||
wait: true,
|
wait: true,
|
||||||
type: desc.type
|
type: desc.type
|
||||||
@ -565,7 +572,7 @@ PeerConnection.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._queueOrRun({
|
this._queueOrRun({
|
||||||
func: this._pc.setRemoteDescription,
|
func: this._getPC().setRemoteDescription,
|
||||||
args: [type, desc.sdp],
|
args: [type, desc.sdp],
|
||||||
wait: true,
|
wait: true,
|
||||||
type: desc.type
|
type: desc.type
|
||||||
@ -589,7 +596,7 @@ PeerConnection.prototype = {
|
|||||||
this._onAddIceCandidateError = onError;
|
this._onAddIceCandidateError = onError;
|
||||||
|
|
||||||
this._queueOrRun({
|
this._queueOrRun({
|
||||||
func: this._pc.addIceCandidate,
|
func: this._getPC().addIceCandidate,
|
||||||
args: [cand.candidate, cand.sdpMid || "", cand.sdpMLineIndex],
|
args: [cand.candidate, cand.sdpMid || "", cand.sdpMLineIndex],
|
||||||
wait: true
|
wait: true
|
||||||
});
|
});
|
||||||
@ -598,7 +605,7 @@ PeerConnection.prototype = {
|
|||||||
addStream: function(stream, constraints) {
|
addStream: function(stream, constraints) {
|
||||||
// TODO: Implement constraints.
|
// TODO: Implement constraints.
|
||||||
this._queueOrRun({
|
this._queueOrRun({
|
||||||
func: this._pc.addStream,
|
func: this._getPC().addStream,
|
||||||
args: [stream],
|
args: [stream],
|
||||||
wait: false
|
wait: false
|
||||||
});
|
});
|
||||||
@ -611,7 +618,7 @@ PeerConnection.prototype = {
|
|||||||
|
|
||||||
close: function() {
|
close: function() {
|
||||||
this._queueOrRun({
|
this._queueOrRun({
|
||||||
func: this._pc.close,
|
func: this._getPC().close,
|
||||||
args: [false],
|
args: [false],
|
||||||
wait: false
|
wait: false
|
||||||
});
|
});
|
||||||
@ -620,17 +627,17 @@ PeerConnection.prototype = {
|
|||||||
|
|
||||||
get localStreams() {
|
get localStreams() {
|
||||||
this._checkClosed();
|
this._checkClosed();
|
||||||
return this._pc.localStreams;
|
return this._getPC().localStreams;
|
||||||
},
|
},
|
||||||
|
|
||||||
get remoteStreams() {
|
get remoteStreams() {
|
||||||
this._checkClosed();
|
this._checkClosed();
|
||||||
return this._pc.remoteStreams;
|
return this._getPC().remoteStreams;
|
||||||
},
|
},
|
||||||
|
|
||||||
get localDescription() {
|
get localDescription() {
|
||||||
this._checkClosed();
|
this._checkClosed();
|
||||||
let sdp = this._pc.localDescription;
|
let sdp = this._getPC().localDescription;
|
||||||
if (sdp.length == 0) {
|
if (sdp.length == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -642,7 +649,7 @@ PeerConnection.prototype = {
|
|||||||
|
|
||||||
get remoteDescription() {
|
get remoteDescription() {
|
||||||
this._checkClosed();
|
this._checkClosed();
|
||||||
let sdp = this._pc.remoteDescription;
|
let sdp = this._getPC().remoteDescription;
|
||||||
if (sdp.length == 0) {
|
if (sdp.length == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -660,7 +667,7 @@ PeerConnection.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var state="undefined";
|
var state="undefined";
|
||||||
switch (this._pc.readyState) {
|
switch (this._getPC().readyState) {
|
||||||
case Ci.IPeerConnection.kNew:
|
case Ci.IPeerConnection.kNew:
|
||||||
state = "new";
|
state = "new";
|
||||||
break;
|
break;
|
||||||
@ -707,7 +714,7 @@ PeerConnection.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Synchronous since it doesn't block.
|
// Synchronous since it doesn't block.
|
||||||
let channel = this._pc.createDataChannel(
|
let channel = this._getPC().createDataChannel(
|
||||||
label, protocol, type, dict.outOfOrderAllowed, dict.maxRetransmitTime,
|
label, protocol, type, dict.outOfOrderAllowed, dict.maxRetransmitTime,
|
||||||
dict.maxRetransmitNum, dict.preset ? true : false,
|
dict.maxRetransmitNum, dict.preset ? true : false,
|
||||||
dict.stream != undefined ? dict.stream : 0xFFFF
|
dict.stream != undefined ? dict.stream : 0xFFFF
|
||||||
@ -720,7 +727,7 @@ PeerConnection.prototype = {
|
|||||||
numstreams = 16;
|
numstreams = 16;
|
||||||
}
|
}
|
||||||
this._queueOrRun({
|
this._queueOrRun({
|
||||||
func: this._pc.connectDataConnection,
|
func: this._getPC().connectDataConnection,
|
||||||
args: [localport, remoteport, numstreams],
|
args: [localport, remoteport, numstreams],
|
||||||
wait: false
|
wait: false
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user