Add WebRTCIPPolicy setting to webContents and webview

Resolves #8777
Code to set and get the policy come from the muon framework code:
https://github.com/brave/muon/blob/master/atom/browser/api/atom_api_web_
contents.cc#L1324...L1343
This commit is contained in:
John Kleinschmidt 2017-03-08 09:55:59 -05:00
parent 4f817873f1
commit 1c2a78a896
7 changed files with 57 additions and 1 deletions

View file

@ -304,6 +304,13 @@ class DisableBlinkFeaturesAttribute extends WebViewAttribute {
}
}
// Attribute specifies WebRTC IP handling policy for handling IP leaking.
class WebRTCIPHandlingPolicyAttribute extends WebViewAttribute {
constructor (webViewImpl) {
super(webViewConstants.ATTRIBUTE_WEBRTCIPPOLICY, webViewImpl)
}
}
// Attribute that specifies the web preferences to be enabled.
class WebPreferencesAttribute extends WebViewAttribute {
constructor (webViewImpl) {
@ -329,6 +336,7 @@ WebViewImpl.prototype.setupWebViewAttributes = function () {
this.attributes[webViewConstants.ATTRIBUTE_GUESTINSTANCE] = new GuestInstanceAttribute(this)
this.attributes[webViewConstants.ATTRIBUTE_DISABLEGUESTRESIZE] = new BooleanAttribute(webViewConstants.ATTRIBUTE_DISABLEGUESTRESIZE, this)
this.attributes[webViewConstants.ATTRIBUTE_WEBPREFERENCES] = new WebPreferencesAttribute(this)
this.attributes[webViewConstants.ATTRIBUTE_WEBRTCIPPOLICY] = new WebRTCIPHandlingPolicyAttribute(this)
const autosizeAttributes = [webViewConstants.ATTRIBUTE_MAXHEIGHT, webViewConstants.ATTRIBUTE_MAXWIDTH, webViewConstants.ATTRIBUTE_MINHEIGHT, webViewConstants.ATTRIBUTE_MINWIDTH]
autosizeAttributes.forEach((attribute) => {