Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: inject.preload.js

Issue 29607555: Issue 6030 - Ensure RTCPeerConnection exists before wrapping it (Closed)
Patch Set: Created Nov. 14, 2017, 10:34 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: inject.preload.js
diff --git a/inject.preload.js b/inject.preload.js
index 109f31ab1f88b79f5e3ef5d5d34423e8ed7e53aa..c03f0c762d98fe8351e3462923926a883c0f219b 100644
--- a/inject.preload.js
+++ b/inject.preload.js
@@ -225,6 +225,13 @@ function injected(eventName, injectedIntoContentWindow)
*/
let RealRTCPeerConnection = window.RTCPeerConnection ||
window.webkitRTCPeerConnection;
+
+ // Firefox has the option (media.peerconnection.enabled) to disable WebRTC
Manish Jethani 2017/11/14 10:57:56 Wouldn't it be better to wrap the entire code for
Wladimir Palant 2017/11/14 11:12:49 I agree. While I'm normally not a big fan of incre
kzar 2017/11/14 11:36:35 Done.
+ // in which case RealRTCPeerConnection is undefined. Note: This logic assumes
+ // that the WebRTC wrapping code comes last in the injected function!
+ if (typeof RealRTCPeerConnection == "undefined")
+ return;
+
let closeRTCPeerConnection = Function.prototype.call.bind(
RealRTCPeerConnection.prototype.close
);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld