Allow WebExtensions to disable WebRTC

RESOLVED FIXED in Firefox 55

Status

()

Toolkit
WebExtensions: General
P2
normal
RESOLVED FIXED
3 months ago
2 months ago

People

(Reporter: bsilverberg, Assigned: bsilverberg)

Tracking

(Blocks: 1 bug, {dev-doc-complete})

unspecified
mozilla55
dev-doc-complete
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(firefox55 fixed)

Details

(Whiteboard: triaged[privacy])

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Assignee)

Description

3 months ago
As there are already settings in the privacy API which deal with WebRTC, I think it makes sense to add this to the privacy.network namespace.

According to the notes in [1], this would make use of the `media.peerconnection.enabled`, which seems to be accurate looking at m-c code. That is a boolean, so this can be browser.privacy.network.webRTCEnabled.

[1] https://docs.google.com/document/d/1HZiI-dqFATzLpmTtN1Bg6tD8y4N0Ne3D74LEWWgttOk/edit#
Comment hidden (mozreview-request)
(Assignee)

Comment 2

3 months ago
Comment on attachment 8870853 [details]
Bug 1364975 - Allow WebExtensions to disable WebRTC,

Byron, could you please take a look at this and confirm that if a WebExtension wants to be able to disable and enable WebRTC `media.peerconnection.enabled` is the correct preference to flip?
Attachment #8870853 - Flags: review?(docfaraday)

Comment 3

3 months ago
Comment on attachment 8870853 [details]
Bug 1364975 - Allow WebExtensions to disable WebRTC,

Yeah, that's the pref you want.
Attachment #8870853 - Flags: review?(docfaraday) → review+

Comment 4

3 months ago
Does this pref affect getUserMedia()?  Or is that considered not part of webrtc?
(Assignee)

Comment 5

3 months ago
(In reply to Andrew Swan [:aswan] from comment #4)
> Does this pref affect getUserMedia()?  Or is that considered not part of
> webrtc?

My manual testing indicates that this does not affect getUserMedia(). I assume that getUserMedia has uses outside of WebRTC.

Comment 6

3 months ago
(In reply to Bob Silverberg [:bsilverberg] from comment #5)
> (In reply to Andrew Swan [:aswan] from comment #4)
> > Does this pref affect getUserMedia()?  Or is that considered not part of
> > webrtc?
> 
> My manual testing indicates that this does not affect getUserMedia(). I
> assume that getUserMedia has uses outside of WebRTC.

Does it?  I'm only familiar with it in the context of webrtc.  How about naming this something more specific to remove any possible confusion?  eg, PeerConnectionEnabled?
(Assignee)

Comment 7

3 months ago
(In reply to Andrew Swan [:aswan] from comment #6)
> (In reply to Bob Silverberg [:bsilverberg] from comment #5)
> > (In reply to Andrew Swan [:aswan] from comment #4)
> > > Does this pref affect getUserMedia()?  Or is that considered not part of
> > > webrtc?
> > 
> > My manual testing indicates that this does not affect getUserMedia(). I
> > assume that getUserMedia has uses outside of WebRTC.
> 
> Does it?  I'm only familiar with it in the context of webrtc.  How about
> naming this something more specific to remove any possible confusion?  eg,
> PeerConnectionEnabled?

I think getUserMedia belongs to the Media Capture and Streams API, which is used by WebRTC, as documented on MDN [1]:

"WebRTC serves multiple purposes, and overlaps substantially with the Media Capture and Streams API. Together, they provide powerful multimedia capabilities to the Web..."

Because WebRTC is a term that is already used in the privacy API, and in fact is the term used by the requestor of this bug, I assumed it would be the best name for this setting, and less confusing that introducing a new term like "PeerConnection", but if you feel strongly about it I will change it to PeerConnectionEnabled.

[1] https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API#WebRTC_concepts_and_usage
Flags: needinfo?(aswan)

Comment 8

3 months ago
I was personally confused by this and the naming of the underlying preference together with the statement on MDN that the two "overlap substantially" all argue for using PeerConnection in the api visible to extensions.  But I think somebody with a deeper background in this area should weigh in.  I suggest :jib, who is familiar with both webrtc and webextensions.
Flags: needinfo?(aswan) → needinfo?(jib)
It's confusing. Historically, I believe WebRTC started out as the term for getUserMedia, and ballooned into an umbrella term for both getUserMedia + RTCPeerConnection, as well as the name of the latter spec. It seems to be growing still, to include everything in mediacapture and webrtc, including extension specs like screensharing, MediaRecorder, ImageCapture and webrtc-stats [1]. As a result, it's hard to know what people mean when they use the term without context. The term is generally avoided in APIs for that reason.

In Gecko,
 - set both media.navigator.enabled=false and media.peerconnection.enabled=false to disable getUserMedia [2].
 - set just media.peerconnection.enabled=false to disable RTCPeerConnection alone.

It's not possible to disable gUM if RTCPeerConnection is enabled. gUM was the only possible source when that was written, though I'm actually not sure if that makes sense anymore, now that we have element and canvas captureStream and Web Audio.

It's not possible to disable MediaStream, MediaStreamTrack, MediaRecorder or the captureStream APIs.

[1] https://webrtc.github.io/samples/
[2] https://dxr.mozilla.org/mozilla-central/rev/39d5cc0fda5e16c49a59d29d4ca186a5534cc88b/dom/base/Navigator.cpp#1716-1717
Flags: needinfo?(jib)

Comment 10

3 months ago
I've lost of track of the original source of the request, but my vote is that we use PeerConnection in the name of the setting exposed to extensions, so that we avoid propagating confusion about exactly what the term "webrtc" encompasses.
(Assignee)

Comment 11

3 months ago
(In reply to Andrew Swan [:aswan] from comment #10)
> I've lost of track of the original source of the request, but my vote is
> that we use PeerConnection in the name of the setting exposed to extensions,
> so that we avoid propagating confusion about exactly what the term "webrtc"
> encompasses.

Sounds good, and thanks for the info, jib.
Comment hidden (mozreview-request)
(Assignee)

Comment 13

3 months ago
The patch has been updated with the name change.

Comment 14

3 months ago
mozreview-review
Comment on attachment 8870853 [details]
Bug 1364975 - Allow WebExtensions to disable WebRTC,

https://reviewboard.mozilla.org/r/142414/#review148434
Attachment #8870853 - Flags: review?(aswan) → review+
(Assignee)

Updated

3 months ago
Keywords: dev-doc-needed

Comment 15

3 months ago
Pushed by bsilverberg@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e62d60b214d1
Allow WebExtensions to disable WebRTC, r=aswan

Comment 16

3 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/e62d60b214d1
Status: NEW → RESOLVED
Last Resolved: 3 months ago
status-firefox55: --- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
I've updated https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/privacy/network

Please let me know if this covers it.
Flags: needinfo?(bob.silverberg)
(Assignee)

Comment 18

2 months ago
(In reply to Will Bamberg [:wbamberg] from comment #17)
> I've updated
> https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/privacy/network
> 
> Please let me know if this covers it.

Looks good, thanks Will.
Flags: needinfo?(bob.silverberg)
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.