From 57f1127b8e4663e420a34e5ab5d90ca4d3665925 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen <allan.jensen@qt.io> Date: Mon, 17 Jul 2017 17:32:37 +0200 Subject: [PATCH] Support command-line argument --force-webrtc-ip-handling-policy This command-line argument makes it possibly to block exposure of internal IP addresses when WebRTC access hasn't been granted, using --force-webrtc-ip-handling-policy=default_public_interface_only Task-number: QTBUG-57505 Change-Id: I0cddd1b20e0814811894204cb31e0c463a75f7be Reviewed-by: Kai Koehne <kai.koehne@qt.io> --- src/core/web_contents_adapter.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 93e8674bd..a788b9679 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -73,6 +73,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/favicon_status.h" #include "content/public/common/content_constants.h" +#include "content/public/common/content_switches.h" #include <content/public/common/drop_data.h> #include "content/public/common/page_state.h" #include "content/public/common/page_zoom.h" @@ -419,6 +420,11 @@ void WebContentsAdapter::initialize(WebContentsAdapterClient *adapterClient) rendererPrefs->caret_blink_interval = 0.5 * static_cast<double>(qtCursorFlashTime) / 1000; rendererPrefs->user_agent_override = d->browserContextAdapter->httpUserAgent().toStdString(); rendererPrefs->accept_languages = d->browserContextAdapter->httpAcceptLanguageWithoutQualities().toStdString(); +#if defined(ENABLE_WEBRTC) + base::CommandLine* commandLine = base::CommandLine::ForCurrentProcess(); + if (commandLine->HasSwitch(switches::kForceWebRtcIPHandlingPolicy)) + rendererPrefs->webrtc_ip_handling_policy = commandLine->GetSwitchValueASCII(switches::kForceWebRtcIPHandlingPolicy); +#endif d->webContents->GetRenderViewHost()->SyncRendererPrefs(); // Create and attach observers to the WebContents. -- GitLab