Skip to content

Commit c3f4310

Browse files
authored
Merge pull request #1185 from webrtcHacks/firefox-guard-more
firefox: do not wrap for obsolete shims
2 parents 5c2749e + 8d072e0 commit c3f4310

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

src/js/firefox/firefox_shim.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,17 @@ export function shimRTCDataChannel(window) {
182182
}
183183
}
184184

185-
export function shimAddTransceiver(window) {
185+
export function shimAddTransceiver(window, browserDetails) {
186186
// https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
187187
// Firefox ignores the init sendEncodings options passed to addTransceiver
188188
// https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
189189
if (!(typeof window === 'object' && window.RTCPeerConnection)) {
190190
return;
191191
}
192+
// Fixed by https://bugzilla.mozilla.org/show_bug.cgi?id=1401592 in FF110.
193+
if (browserDetails.version >= 110) {
194+
return;
195+
}
192196
const origAddTransceiver = window.RTCPeerConnection.prototype.addTransceiver;
193197
if (origAddTransceiver) {
194198
window.RTCPeerConnection.prototype.addTransceiver =
@@ -253,10 +257,14 @@ export function shimAddTransceiver(window) {
253257
}
254258
}
255259

256-
export function shimGetParameters(window) {
260+
export function shimGetParameters(window, browserDetails) {
257261
if (!(typeof window === 'object' && window.RTCRtpSender)) {
258262
return;
259263
}
264+
// Fixed by https://bugzilla.mozilla.org/show_bug.cgi?id=1401592 in FF110.
265+
if (browserDetails.version >= 110) {
266+
return;
267+
}
260268
const origGetParameters = window.RTCRtpSender.prototype.getParameters;
261269
if (origGetParameters) {
262270
window.RTCRtpSender.prototype.getParameters =
@@ -270,13 +278,17 @@ export function shimGetParameters(window) {
270278
}
271279
}
272280

273-
export function shimCreateOffer(window) {
281+
export function shimCreateOffer(window, browserDetails) {
274282
// https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
275283
// Firefox ignores the init sendEncodings options passed to addTransceiver
276284
// https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
277285
if (!(typeof window === 'object' && window.RTCPeerConnection)) {
278286
return;
279287
}
288+
// Fixed by https://bugzilla.mozilla.org/show_bug.cgi?id=1401592 in FF110.
289+
if (browserDetails.version >= 110) {
290+
return;
291+
}
280292
const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;
281293
window.RTCPeerConnection.prototype.createOffer = function createOffer() {
282294
if (this.setParametersPromises && this.setParametersPromises.length) {
@@ -292,13 +304,17 @@ export function shimCreateOffer(window) {
292304
};
293305
}
294306

295-
export function shimCreateAnswer(window) {
307+
export function shimCreateAnswer(window, browserDetails) {
296308
// https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
297309
// Firefox ignores the init sendEncodings options passed to addTransceiver
298310
// https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
299311
if (!(typeof window === 'object' && window.RTCPeerConnection)) {
300312
return;
301313
}
314+
// Fixed by https://bugzilla.mozilla.org/show_bug.cgi?id=1401592 in FF110.
315+
if (browserDetails.version >= 110) {
316+
return;
317+
}
302318
const origCreateAnswer = window.RTCPeerConnection.prototype.createAnswer;
303319
window.RTCPeerConnection.prototype.createAnswer = function createAnswer() {
304320
if (this.setParametersPromises && this.setParametersPromises.length) {

src/js/firefox/getdisplaymedia.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
'use strict';
1010

1111
export function shimGetDisplayMedia(window, preferredMediaSource) {
12-
if (window.navigator.mediaDevices &&
13-
'getDisplayMedia' in window.navigator.mediaDevices) {
12+
if (!(window.navigator.mediaDevices)) {
1413
return;
1514
}
16-
if (!(window.navigator.mediaDevices)) {
15+
if (window.navigator.mediaDevices &&
16+
'getDisplayMedia' in window.navigator.mediaDevices) {
1717
return;
1818
}
1919
window.navigator.mediaDevices.getDisplayMedia =

0 commit comments

Comments
 (0)