Skip to content

Commit 8619209

Browse files
Update projects to use latest WebView2 SDK 1.0.2164-prerelease (#220)
* Updates for Win32, WPF and WinForms sample apps from 120.0.2164.0 * Updated package version for Win32, WPF and WinForms sample apps to 1.0.2164-prerelease --------- Co-authored-by: WebView2 Github Bot <[email protected]>
1 parent a72e8b5 commit 8619209

File tree

10 files changed

+30
-52
lines changed

10 files changed

+30
-52
lines changed

SampleApps/WebView2APISample/ProcessComponent.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ ProcessComponent::ProcessComponent(AppWindow* appWindow)
5353
// needed.
5454
ScheduleReloadIfSelectedByUser(
5555
L"Browser render process exited unexpectedly. Reload page?",
56-
L"Web page unresponsive");
56+
L"Render process exited");
5757
}
5858
// Check the runtime event args implements the newer interface.
5959
auto args2 = args.try_query<ICoreWebView2ProcessFailedEventArgs2>();
@@ -100,17 +100,27 @@ ProcessComponent::ProcessComponent(AppWindow* appWindow)
100100
COREWEBVIEW2_PROCESS_FAILED_REASON reason;
101101
wil::unique_cotaskmem_string processDescription;
102102
int exitCode;
103+
wil::unique_cotaskmem_string failedModule;
103104

104105
CHECK_FAILURE(args2->get_Reason(&reason));
105106
CHECK_FAILURE(args2->get_ProcessDescription(&processDescription));
106107
CHECK_FAILURE(args2->get_ExitCode(&exitCode));
107108

109+
auto argFailedModule =
110+
args.try_query<ICoreWebView2ExperimentalProcessFailedEventArgs>();
111+
if (argFailedModule)
112+
{
113+
CHECK_FAILURE(
114+
argFailedModule->get_FailureSourceModulePath(&failedModule));
115+
}
116+
108117
std::wstringstream message;
109118
message << L"Kind: " << ProcessFailedKindToString(kind) << L"\n"
110119
<< L"Reason: " << ProcessFailedReasonToString(reason) << L"\n"
111120
<< L"Exit code: " << exitCode << L"\n"
112-
<< L"Process description: " << processDescription.get()
113-
<< std::endl;
121+
<< L"Process description: " << processDescription.get() << std::endl
122+
<< (failedModule ? L"Failed module: " : L"")
123+
<< (failedModule ? failedModule.get() : L"");
114124
m_appWindow->AsyncMessageBox( std::move(message.str()), L"Child process failed");
115125
}
116126
return S_OK;

SampleApps/WebView2APISample/ScriptComponent.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ bool ScriptComponent::HandleWindowMessage(
172172
}
173173
return false;
174174
}
175-
176175
void ScriptComponent::AddBrowserExtension()
177176
{
178177

SampleApps/WebView2APISample/ScriptComponent.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class ScriptComponent : public ComponentBase
5151
void AddBrowserExtension();
5252
void RemoveOrDisableBrowserExtension(const bool remove);
5353
~ScriptComponent() override;
54-
5554
void HandleIFrames();
5655
std::wstring IFramesToString();
5756
std::vector<wil::com_ptr<ICoreWebView2Frame>> m_frames;

SampleApps/WebView2APISample/WebView2APISample.vcxproj

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@
126126
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
127127
<Optimization>Disabled</Optimization>
128128
<LanguageStandard>stdcpp17</LanguageStandard>
129-
<MultiProcessorCompilation>true</MultiProcessorCompilation>
130-
</ClCompile>
129+
<MultiProcessorCompilation>true</MultiProcessorCompilation>
130+
</ClCompile>
131131
<Link>
132132
<TargetMachine>MachineX86</TargetMachine>
133133
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -145,8 +145,8 @@
145145
<WarningLevel>Level3</WarningLevel>
146146
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
147147
<LanguageStandard>stdcpp17</LanguageStandard>
148-
<MultiProcessorCompilation>true</MultiProcessorCompilation>
149-
</ClCompile>
148+
<MultiProcessorCompilation>true</MultiProcessorCompilation>
149+
</ClCompile>
150150
<Link>
151151
<TargetMachine>MachineX86</TargetMachine>
152152
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -162,8 +162,8 @@
162162
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
163163
<LanguageStandard>stdcpp17</LanguageStandard>
164164
<PreprocessorDefinitions>USE_WEBVIEW2_WIN10;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
165-
<MultiProcessorCompilation>true</MultiProcessorCompilation>
166-
</ClCompile>
165+
<MultiProcessorCompilation>true</MultiProcessorCompilation>
166+
</ClCompile>
167167
<Link>
168168
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;shlwapi.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;urlmon.lib;Gdiplus.lib;%(AdditionalDependencies)</AdditionalDependencies>
169169
<AdditionalOptions>onecoreuap.lib %(AdditionalOptions)</AdditionalOptions>
@@ -174,8 +174,8 @@
174174
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
175175
<LanguageStandard>stdcpp17</LanguageStandard>
176176
<PreprocessorDefinitions>USE_WEBVIEW2_WIN10;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
177-
<MultiProcessorCompilation>true</MultiProcessorCompilation>
178-
</ClCompile>
177+
<MultiProcessorCompilation>true</MultiProcessorCompilation>
178+
</ClCompile>
179179
<Link>
180180
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;shlwapi.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;urlmon.lib;Gdiplus.lib;%(AdditionalDependencies)</AdditionalDependencies>
181181
<LinkTimeCodeGeneration>
@@ -188,8 +188,8 @@
188188
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
189189
<LanguageStandard>stdcpp17</LanguageStandard>
190190
<PreprocessorDefinitions>USE_WEBVIEW2_WIN10;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
191-
<MultiProcessorCompilation>true</MultiProcessorCompilation>
192-
</ClCompile>
191+
<MultiProcessorCompilation>true</MultiProcessorCompilation>
192+
</ClCompile>
193193
<Link>
194194
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;shlwapi.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;urlmon.lib;Gdiplus.lib;%(AdditionalDependencies)</AdditionalDependencies>
195195
<AdditionalOptions>onecoreuap.lib %(AdditionalOptions)</AdditionalOptions>
@@ -201,7 +201,7 @@
201201
<LanguageStandard>stdcpp17</LanguageStandard>
202202
<PreprocessorDefinitions>USE_WEBVIEW2_WIN10;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
203203
<MultiProcessorCompilation>true</MultiProcessorCompilation>
204-
</ClCompile>
204+
</ClCompile>
205205
<Link>
206206
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;shlwapi.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;urlmon.lib;Gdiplus.lib;%(AdditionalDependencies)</AdditionalDependencies>
207207
<AdditionalOptions>onecoreuap.lib %(AdditionalOptions)</AdditionalOptions>
@@ -425,13 +425,13 @@
425425
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
426426
<ImportGroup Label="ExtensionTargets">
427427
<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')" />
428-
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.2106-prerelease\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.2106-prerelease\build\native\Microsoft.Web.WebView2.targets')" />
428+
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.2164-prerelease\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.2164-prerelease\build\native\Microsoft.Web.WebView2.targets')" />
429429
</ImportGroup>
430430
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
431431
<PropertyGroup>
432432
<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>
433433
</PropertyGroup>
434434
<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'))" />
435-
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.2106-prerelease\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.2106-prerelease\build\native\Microsoft.Web.WebView2.targets'))" />
435+
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.2164-prerelease\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.2164-prerelease\build\native\Microsoft.Web.WebView2.targets'))" />
436436
</Target>
437437
</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.2106-prerelease" targetFramework="native" />
3+
<package id="Microsoft.Web.WebView2" version="1.0.2164-prerelease" targetFramework="native" />
44
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220201.1" targetFramework="native" />
55
</packages>

SampleApps/WebView2WindowsFormsBrowser/WebView2WindowsFormsBrowser.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<PlatformTarget>AnyCPU</PlatformTarget>
2626
</PropertyGroup>
2727
<ItemGroup>
28-
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2106-prerelease" />
28+
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2164-prerelease" />
2929
</ItemGroup>
3030
<ItemGroup>
3131
<Folder Include="assets\" />

SampleApps/WebView2WpfBrowser/WebView2WpfBrowser.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
</Content>
6262
</ItemGroup>
6363
<ItemGroup>
64-
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2106-prerelease" />
64+
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2164-prerelease" />
6565
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
6666
</ItemGroup>
6767
</Project>

SampleApps/webview2_sample_uwp/Html/ScenarioTypeScriptDebugIndex.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function onHeaderClick() {
22
console.log("onHeaderClick+");
33
const header = document.getElementById('header');
4-
document.getElementById('HeaderSpace').innerHTML = header.innerHTML;
4+
document.getElementById('HeaderSpace').textContent = header.textContent;
55
console.log("onHeaderClick-");
66
}
77

SampleApps/webview2_sample_uwp/Pages/Browser.xaml.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@
1010
using System.Diagnostics;
1111
using System.IO;
1212
using webview2_sample_uwp;
13-
#if USE_WEBVIEW2_SMOKETEST
14-
using Windows.Storage;
15-
#endif
1613
using Windows.UI.Xaml;
1714
using Windows.UI.Xaml.Controls;
1815
using Windows.UI.Xaml.Input;
19-
2016
namespace WebView2_UWP.Pages
2117
{
2218
public sealed partial class Browser : BasePage
@@ -36,22 +32,11 @@ public Browser()
3632
WebView2.Source = new Uri(AddressBar.Text);
3733
}
3834

39-
#if USE_WEBVIEW2_SMOKETEST
40-
private async void WebView2_CoreWebView2Initialized(WebView2 sender, CoreWebView2InitializedEventArgs args)
41-
#else
4235
private void WebView2_CoreWebView2Initialized(WebView2 sender, CoreWebView2InitializedEventArgs args)
43-
#endif
4436
{
4537
if (args.Exception != null)
4638
{
4739
StatusUpdate($"Error initializing WebView2: {args.Exception.Message}");
48-
49-
#if USE_WEBVIEW2_SMOKETEST
50-
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
51-
StorageFile file = await localFolder.CreateFileAsync(@"Failure.txt", CreationCollisionOption.FailIfExists);
52-
await FileIO.WriteTextAsync(file, args.Exception.ToString());
53-
Environment.Exit(1);
54-
#endif
5540
}
5641
else
5742
{
@@ -152,11 +137,7 @@ private void WebView2_NavigationStarting(WebView2 sender, CoreWebView2Navigation
152137
CancelButton.IsEnabled = true;
153138
}
154139

155-
#if USE_WEBVIEW2_SMOKETEST
156-
private async void WebView2_NavigationCompleted(WebView2 sender, CoreWebView2NavigationCompletedEventArgs args)
157-
#else
158140
private void WebView2_NavigationCompleted(WebView2 sender, CoreWebView2NavigationCompletedEventArgs args)
159-
#endif
160141
{
161142
StatusUpdate("Navigation complete");
162143

@@ -165,12 +146,6 @@ private void WebView2_NavigationCompleted(WebView2 sender, CoreWebView2Navigatio
165146

166147
// Update the address bar with the full URL that was navigated to.
167148
AddressBar.Text = sender.Source.ToString();
168-
169-
#if USE_WEBVIEW2_SMOKETEST
170-
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
171-
await localFolder.CreateFileAsync(@"Success.txt", CreationCollisionOption.FailIfExists);
172-
Environment.Exit(0);
173-
#endif
174149
}
175150

176151
private bool TryCreateUri(String potentialUri, out Uri result)

SampleApps/webview2_sample_uwp/Settings.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@ public Settings()
4848
_localSettings[SettingsVersionKey] = SettingsVersion;
4949
}
5050

51-
#if USE_WEBVIEW2_SMOKETEST
52-
var webViewExecutableFolder = ApplicationData.Current.LocalFolder.Path + "\\EdgeBin";
53-
Environment.SetEnvironmentVariable(WebViewExecutableFolderEnvKey, webViewExecutableFolder);
54-
#else
5551
InitializeEnvSetting(WebViewExecutableFolderKey, WebViewExecutableFolderEnvKey);
56-
#endif
5752
InitializeEnvSetting(WebViewUserDataFolderKey, WebViewUserDataFolderEnvKey);
5853
InitializeEnvSetting(WebViewReleaseChannelPrefKey, WebViewReleaseChannelPrefEnvKey);
5954
InitializeEnvSetting(WebViewAdditionalArgumentsKey, WebViewAdditionalArgumentsEnvKey);

0 commit comments

Comments
 (0)