Skip to content

Commit beef1ea

Browse files
authored
Merge pull request #288 from MicrosoftEdge/smoketest/1.0.3712-testing
Smoketest/1.0.3712 testing
2 parents 33a5a3e + cbb0edb commit beef1ea

14 files changed

+196
-16
lines changed

SampleApps/WebView2APISample/AppWindow.cpp

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include "ScenarioVirtualHostMappingForPopUpWindow.h"
6363
#include "ScenarioVirtualHostMappingForSW.h"
6464
#include "ScenarioWebMessage.h"
65+
#include "ScenarioWebRtcUdpPortConfiguration.h"
6566
#include "ScenarioWebViewEventMonitor.h"
6667
#include "ScenarioWindowControlsOverlay.h"
6768
#include "ScriptComponent.h"
@@ -531,6 +532,11 @@ bool AppWindow::ExecuteWebViewCommands(WPARAM wParam, LPARAM lParam)
531532
NewComponent<ScenarioWebMessage>(this);
532533
return true;
533534
}
535+
case IDM_SCENARIO_WEBRTC_UDP_PORT_CONFIGURATION:
536+
{
537+
NewComponent<ScenarioWebRtcUdpPortConfiguration>(this);
538+
return true;
539+
}
534540
case IDM_SCENARIO_ADD_HOST_OBJECT:
535541
{
536542
NewComponent<ScenarioAddHostObject>(this);
@@ -597,6 +603,21 @@ bool AppWindow::ExecuteWebViewCommands(WPARAM wParam, LPARAM lParam)
597603
NewComponent<ScenarioExtensionsManagement>(this, true);
598604
return true;
599605
}
606+
case IDM_SCENARIO_DRAG_DROP_OVERRIDE:
607+
{
608+
if (m_dcompDevice || m_wincompCompositor)
609+
{
610+
NewComponent<ScenarioDragDropOverride>(this);
611+
}
612+
else
613+
{
614+
MessageBox(
615+
m_mainWindow,
616+
L"Drag and Drop Override is only supported in visual hosting mode",
617+
L"Drag and Drop Override", MB_OK);
618+
}
619+
return true;
620+
}
600621
case IDM_SCENARIO_CUSTOM_SCHEME:
601622
{
602623
NewComponent<ScenarioCustomScheme>(this);
@@ -1777,7 +1798,7 @@ void AppWindow::InitializeWebView()
17771798
args.append(
17781799
L"--enable-features=ThirdPartyStoragePartitioning,PartitionedCookies,"
17791800
L"msPageInteractionManagerWebview2");
1780-
auto options = Microsoft::WRL::Make<CoreWebView2EnvironmentOptions>();
1801+
auto options = Microsoft::WRL::Make<CoreWebView2ExperimentalEnvironmentOptions>();
17811802
options->put_AdditionalBrowserArguments(args.c_str());
17821803
CHECK_FAILURE(
17831804
options->put_AllowSingleSignOnUsingOSPrimaryAccount(m_AADSSOEnabled ? TRUE : FALSE));
@@ -1833,6 +1854,24 @@ void AppWindow::InitializeWebView()
18331854
CHECK_FAILURE(options8->put_ScrollBarStyle(style));
18341855
}
18351856

1857+
Microsoft::WRL::ComPtr<ICoreWebView2ExperimentalEnvironmentOptions> optionsExperimental;
1858+
if (options.As(&optionsExperimental) == S_OK)
1859+
{
1860+
// Configure port ranges for WebRTC UDP traffic to work within enterprise firewalls
1861+
// Set UDP port range (example: 50000-55000 for enterprise environments)
1862+
const INT32 udpMin = 50000, udpMax = 55000;
1863+
1864+
CHECK_FAILURE(optionsExperimental->SetAllowedPortRange(
1865+
COREWEBVIEW2_ALLOWED_PORT_RANGE_SCOPE_WEB_RTC,
1866+
COREWEBVIEW2_TRANSPORT_PROTOCOL_KIND_UDP, udpMin, udpMax));
1867+
1868+
// Get the configured port range
1869+
CHECK_FAILURE(optionsExperimental->GetEffectiveAllowedPortRange(
1870+
COREWEBVIEW2_ALLOWED_PORT_RANGE_SCOPE_WEB_RTC,
1871+
COREWEBVIEW2_TRANSPORT_PROTOCOL_KIND_UDP, &m_udpPortRange.minPort,
1872+
&m_udpPortRange.maxPort));
1873+
}
1874+
18361875
HRESULT hr = CreateCoreWebView2EnvironmentWithOptions(
18371876
subFolder, m_userDataFolder.c_str(), options.Get(),
18381877
Callback<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>(

SampleApps/WebView2APISample/AppWindow.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ struct SamplePrintSettings
8989
std::wstring FooterUri = L"";
9090
};
9191

92+
// Port range configuration
93+
struct PortRangeConfig
94+
{
95+
INT32 minPort = 0;
96+
INT32 maxPort = 0;
97+
};
98+
9299
class AppWindow
93100
{
94101
public:
@@ -172,6 +179,12 @@ class AppWindow
172179
{
173180
return m_webviewOption;
174181
}
182+
183+
const PortRangeConfig& GetUdpPortRange() const
184+
{
185+
return m_udpPortRange;
186+
}
187+
175188
private:
176189
static PCWSTR GetWindowClass();
177190

@@ -290,6 +303,7 @@ class AppWindow
290303

291304
bool m_CustomCrashReportingEnabled = false;
292305
bool m_TrackingPreventionEnabled = true;
306+
PortRangeConfig m_udpPortRange;
293307
private:
294308
// Fullscreen related code
295309
RECT m_previousWindowRect;

SampleApps/WebView2APISample/ScenarioDragDropOverride.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ ScenarioDragDropOverride::ScenarioDragDropOverride(AppWindow* appWindow)
2626
return;
2727
}
2828

29-
m_compControllerExperimental6 =
30-
compController.try_query<ICoreWebView2ExperimentalCompositionController6>();
31-
if (!m_compControllerExperimental6)
29+
m_compController5 = compController.try_query<ICoreWebView2CompositionController5>();
30+
if (!m_compController5)
3231
{
3332
return;
3433
}
@@ -70,11 +69,11 @@ ScenarioDragDropOverride::ScenarioDragDropOverride(AppWindow* appWindow)
7069
//! [DragStarting]
7170
// Using DragStarting to simply make a synchronous DoDragDrop call instead of
7271
// having WebView2 do it.
73-
CHECK_FAILURE(m_compControllerExperimental6->add_DragStarting(
74-
Callback<ICoreWebView2ExperimentalDragStartingEventHandler>(
72+
CHECK_FAILURE(m_compController5->add_DragStarting(
73+
Callback<ICoreWebView2DragStartingEventHandler>(
7574
[this](
7675
ICoreWebView2CompositionController* sender,
77-
ICoreWebView2ExperimentalDragStartingEventArgs* args)
76+
ICoreWebView2DragStartingEventArgs* args)
7877
{
7978
if (m_dragOverrideMode != DragOverrideMode::OVERRIDE)
8079
{
@@ -126,9 +125,9 @@ ScenarioDragDropOverride::ScenarioDragDropOverride(AppWindow* appWindow)
126125

127126
ScenarioDragDropOverride::~ScenarioDragDropOverride()
128127
{
129-
if (m_compControllerExperimental6)
128+
if (m_compController5)
130129
{
131-
CHECK_FAILURE(m_compControllerExperimental6->remove_DragStarting(m_dragStartingToken));
130+
CHECK_FAILURE(m_compController5->remove_DragStarting(m_dragStartingToken));
132131
}
133132
CHECK_FAILURE(m_webView->remove_WebMessageReceived(m_webMessageReceivedToken));
134133
CHECK_FAILURE(m_webView->remove_ContentLoading(m_contentLoadingToken));

SampleApps/WebView2APISample/ScenarioDragDropOverride.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ScenarioDragDropOverride : public ComponentBase
5555
AppWindow* m_appWindow = nullptr;
5656
std::wstring m_sampleUri;
5757
wil::com_ptr<ICoreWebView2> m_webView = nullptr;
58-
wil::com_ptr<ICoreWebView2ExperimentalCompositionController6> m_compControllerExperimental6;
58+
wil::com_ptr<ICoreWebView2CompositionController5> m_compController5;
5959
wil::com_ptr<IDropSource> m_dropSource;
6060
DragOverrideMode m_dragOverrideMode = DragOverrideMode::DEFAULT;
6161
};
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright (C) Microsoft Corporation. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "stdafx.h"
6+
7+
#include "CheckFailure.h"
8+
#include "TextInputDialog.h"
9+
10+
#include "ScenarioWebRtcUdpPortConfiguration.h"
11+
12+
using namespace Microsoft::WRL;
13+
14+
static constexpr WCHAR c_samplePath[] = L"ScenarioWebRtcUdpPortConfiguration.html";
15+
16+
ScenarioWebRtcUdpPortConfiguration::ScenarioWebRtcUdpPortConfiguration(AppWindow* appWindow)
17+
: m_appWindow(appWindow), m_webView(appWindow->GetWebView())
18+
{
19+
// Demonstrates how to configure a custom WebRTC UDP port range using the
20+
// new ICoreWebView2WebRtcPortConfiguration exposed via
21+
// ICoreWebView2ExperimentalEnvironmentOptions.
22+
23+
// Navigate to a demo page that will trigger WebRTC usage.
24+
m_sampleUri = m_appWindow->GetLocalUri(c_samplePath);
25+
CHECK_FAILURE(m_webView->Navigate(m_sampleUri.c_str()));
26+
27+
// If we navigate away from the demo page, turn off this scenario.
28+
CHECK_FAILURE(m_webView->add_ContentLoading(
29+
Callback<ICoreWebView2ContentLoadingEventHandler>(
30+
[this](ICoreWebView2* sender, ICoreWebView2ContentLoadingEventArgs* /*args*/)
31+
-> HRESULT
32+
{
33+
wil::unique_cotaskmem_string uri;
34+
CHECK_FAILURE(sender->get_Source(&uri));
35+
if (uri.get() != m_sampleUri)
36+
{
37+
m_appWindow->DeleteComponent(this);
38+
}
39+
return S_OK;
40+
})
41+
.Get(),
42+
&m_contentLoadingToken));
43+
}
44+
45+
ScenarioWebRtcUdpPortConfiguration::~ScenarioWebRtcUdpPortConfiguration()
46+
{
47+
CHECK_FAILURE(m_webView->remove_ContentLoading(m_contentLoadingToken));
48+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (C) Microsoft Corporation. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "stdafx.h"
6+
7+
#include "AppWindow.h"
8+
#include "ComponentBase.h"
9+
10+
// Demonstrates configuring WebRTC UDP port ranges via WebView2 environment options.
11+
class ScenarioWebRtcUdpPortConfiguration : public ComponentBase
12+
{
13+
public:
14+
ScenarioWebRtcUdpPortConfiguration(AppWindow* appWindow);
15+
~ScenarioWebRtcUdpPortConfiguration() override;
16+
17+
private:
18+
AppWindow* m_appWindow = nullptr;
19+
wil::com_ptr<ICoreWebView2> m_webView;
20+
EventRegistrationToken m_contentLoadingToken = {};
21+
std::wstring m_sampleUri;
22+
};

SampleApps/WebView2APISample/WebView2APISample.rc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ BEGIN
268268
MENUITEM "Service worker WebResourceRequested", IDM_SCENARIO_SERVICE_WORKER_WRR
269269
MENUITEM "Shared worker WebResourceRequested", IDM_SCENARIO_SHARED_WORKER
270270
END
271+
MENUITEM "WebRTC UDP Port Configuration", IDM_SCENARIO_WEBRTC_UDP_PORT_CONFIGURATION
271272
POPUP "Custom Download Experience"
272273
BEGIN
273274
MENUITEM "Use Deferred Download Dialog", IDM_SCENARIO_USE_DEFERRED_DOWNLOAD
@@ -301,6 +302,7 @@ BEGIN
301302
MENUITEM "Web Messaging", IDM_SCENARIO_POST_WEB_MESSAGE
302303
MENUITEM "WebView Event Monitor", IDM_SCENARIO_WEB_VIEW_EVENT_MONITOR
303304
MENUITEM "WebView Window Controls Overlay", IDM_SCENARIO_WINDOW_CONTROLS_OVERLAY
305+
304306
MENUITEM "Dropped file path", IDM_SCENARIO_DROPPED_FILE_PATH
305307
POPUP "Save As"
306308
BEGIN
@@ -328,6 +330,7 @@ BEGIN
328330
MENUITEM "Listen to new Shared Worker Creations", IDM_SCENARIO_SHARED_WORKER_MANAGER
329331
MENUITEM "Get Shared Workers", IDM_SCENARIO_GET_SHARED_WORKERS
330332
END
333+
MENUITEM "Drag Drop Override", IDM_SCENARIO_DRAG_DROP_OVERRIDE
331334
POPUP "Start Find"
332335
BEGIN
333336
MENUITEM "Start Find on Page Dialog", IDM_START_FIND

SampleApps/WebView2APISample/WebView2APISample.vcxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@
261261
<ClInclude Include="ScenarioVirtualHostMappingForPopUpWindow.h" />
262262
<ClInclude Include="ScenarioVirtualHostMappingForSW.h" />
263263
<ClInclude Include="ScenarioWebMessage.h" />
264+
<ClInclude Include="ScenarioWebRtcUdpPortConfiguration.h" />
264265
<ClInclude Include="ScenarioWebViewEventMonitor.h" />
265266
<ClInclude Include="ScenarioWindowControlsOverlay.h" />
266267
<ClInclude Include="ScriptComponent.h" />
@@ -324,6 +325,7 @@
324325
<ClCompile Include="ScenarioVirtualHostMappingForPopUpWindow.cpp" />
325326
<ClCompile Include="ScenarioVirtualHostMappingForSW.cpp" />
326327
<ClCompile Include="ScenarioWebMessage.cpp" />
328+
<ClCompile Include="ScenarioWebRtcUdpPortConfiguration.cpp" />
327329
<ClCompile Include="ScenarioWebViewEventMonitor.cpp" />
328330
<ClCompile Include="ScenarioWindowControlsOverlay.cpp" />
329331
<ClCompile Include="ScriptComponent.cpp" />
@@ -530,13 +532,13 @@
530532
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
531533
<ImportGroup Label="ExtensionTargets">
532534
<Import Project="..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
533-
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.3650-prerelease\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.3650-prerelease\build\native\Microsoft.Web.WebView2.targets')" />
535+
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.3712-prerelease\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.3712-prerelease\build\native\Microsoft.Web.WebView2.targets')" />
534536
</ImportGroup>
535537
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
536538
<PropertyGroup>
537539
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
538540
</PropertyGroup>
539541
<Error Condition="!Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
540-
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.3650-prerelease\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.3650-prerelease\build\native\Microsoft.Web.WebView2.targets'))" />
542+
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.3712-prerelease\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.3712-prerelease\build\native\Microsoft.Web.WebView2.targets'))" />
541543
</Target>
542544
</Project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Web.WebView2" version="1.0.3650-prerelease" targetFramework="native" />
3+
<package id="Microsoft.Web.WebView2" version="1.0.3712-prerelease" targetFramework="native" />
44
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220201.1" targetFramework="native" />
55
</packages>

SampleApps/WebView2APISample/resource.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
#define IDM_SCENARIO_GET_SERVICE_WORKER_REGISTERED_FOR_SCOPE 2054
201201
#define IDM_SCENARIO_GET_SHARED_WORKERS 2055
202202
#define IDM_SCENARIO_WINDOW_CONTROLS_OVERLAY 2057
203+
#define IDM_SCENARIO_DRAG_DROP_OVERRIDE 2058
203204
#define IDC_FIND_TERM 2059
204205
#define IDC_IS_CASE_SENSITIVE 2060
205206
#define IDC_SHOULD_MATCH_WHOLE_WORD 2061
@@ -217,6 +218,7 @@
217218
#define IDM_CREATION_MODE_HOST_INPUT_PROCESSING 3006
218219
#define IDM_SCENARIO_DEDICATED_WORKER_POST_MESSAGE 3009
219220
#define IDM_SCENARIO_SERVICE_WORKER_POST_MESSAGE 3010
221+
#define IDM_SCENARIO_WEBRTC_UDP_PORT_CONFIGURATION 3011
220222
#define ID_BLOCKEDSITES 32773
221223
#define ID_SETTINGS_NAVIGATETOSTRING 32774
222224
#define ID_ADD_INITIALIZE_SCRIPT 32775

0 commit comments

Comments
 (0)