Skip to content

Commit 197b4ac

Browse files
Update projects to use latest WebView2 SDK 1.0.1829-prerelease (#188)
* Updates for Win32, WPF and WinForms sample apps from 115.0.1829.0 * Updated package version for Win32, WPF and WinForms sample apps to 1.0.1829-prerelease --------- Co-authored-by: WebView2 Github Bot <[email protected]>
1 parent eac0583 commit 197b4ac

File tree

11 files changed

+172
-11
lines changed

11 files changed

+172
-11
lines changed

SampleApps/WebView2APISample/ScenarioExtensionsManagement.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class ScenarioExtensionsManagement : public ComponentBase
4444
// assets/extensions. This extension is treated as the default extension for the
4545
// `InstallDefaultExtensions` and `OffloadDefaultExtensionsIfExtraExtensionsInstalled`
4646
// scenarios.
47-
const std::wstring m_extensionId = L"bhjomlfgkfmjffpoikcekmhcblpgefmc";
47+
const std::wstring m_extensionId = L"emncjacmognpbmnnjciakjihgcahddgc";
4848

4949
// `m_maxInstalledExtensions` is considered to be the maximum number of extensions we can
5050
// have installed, before we have the case of "too many extensions". If we have too many

SampleApps/WebView2APISample/SettingsComponent.cpp

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,14 +845,14 @@ bool SettingsComponent::HandleWindowMessage(
845845
{
846846
CHECK_FAILURE(m_settings4->put_IsPasswordAutosaveEnabled(FALSE));
847847
MessageBox(
848-
nullptr, L"Password autosave will be disabled after the next navigation.",
848+
nullptr, L"Password autosave will be disabled immediately.",
849849
L"Settings change", MB_OK);
850850
}
851851
else
852852
{
853853
CHECK_FAILURE(m_settings4->put_IsPasswordAutosaveEnabled(TRUE));
854854
MessageBox(
855-
nullptr, L"Password autosave will be enabled after the next navigation.",
855+
nullptr, L"Password autosave will be enabled immediately.",
856856
L"Settings change", MB_OK);
857857
}
858858
//! [PasswordAutosaveEnabled]
@@ -869,14 +869,14 @@ bool SettingsComponent::HandleWindowMessage(
869869
{
870870
CHECK_FAILURE(m_settings4->put_IsGeneralAutofillEnabled(FALSE));
871871
MessageBox(
872-
nullptr, L"General autofill will be disabled after the next navigation.",
872+
nullptr, L"General autofill will be disabled immediately.",
873873
L"Settings change", MB_OK);
874874
}
875875
else
876876
{
877877
CHECK_FAILURE(m_settings4->put_IsGeneralAutofillEnabled(TRUE));
878878
MessageBox(
879-
nullptr, L"General autofill will be enabled after the next navigation.",
879+
nullptr, L"General autofill will be enabled immediately.",
880880
L"Settings change", MB_OK);
881881
}
882882
//! [GeneralAutofillEnabled]
@@ -1046,6 +1046,78 @@ bool SettingsComponent::HandleWindowMessage(
10461046
//! [ToggleSmartScreen]
10471047
return true;
10481048
}
1049+
case ID_SETTINGS_PROFILE_PASSWORD_AUTOSAVE_ENABLED:
1050+
{
1051+
//! [ToggleProfilePasswordAutosaveEnabled]
1052+
// Get the profile object.
1053+
auto webView2_13 = m_webView.try_query<ICoreWebView2_13>();
1054+
CHECK_FEATURE_RETURN(webView2_13);
1055+
wil::com_ptr<ICoreWebView2Profile> webView2Profile;
1056+
CHECK_FAILURE(webView2_13->get_Profile(&webView2Profile));
1057+
CHECK_FEATURE_RETURN(webView2Profile);
1058+
auto webView2Profile6 = webView2Profile.try_query<ICoreWebView2Profile6>();
1059+
CHECK_FEATURE_RETURN(webView2Profile6);
1060+
1061+
BOOL enabled;
1062+
CHECK_FAILURE(webView2Profile6->get_IsPasswordAutosaveEnabled(&enabled));
1063+
// Set password-autosave property to the opposite value to current value.
1064+
if (enabled)
1065+
{
1066+
CHECK_FAILURE(webView2Profile6->put_IsPasswordAutosaveEnabled(FALSE));
1067+
MessageBox(
1068+
nullptr,
1069+
L"Password autosave will be disabled immediately in all "
1070+
L"WebView2 with the same profile.",
1071+
L"Profile settings change", MB_OK);
1072+
}
1073+
else
1074+
{
1075+
CHECK_FAILURE(webView2Profile6->put_IsPasswordAutosaveEnabled(TRUE));
1076+
MessageBox(
1077+
nullptr,
1078+
L"Password autosave will be enabled immediately in all "
1079+
L"WebView2 with the same profile.",
1080+
L"Profile settings change", MB_OK);
1081+
}
1082+
//! [ToggleProfilePasswordAutosaveEnabled]
1083+
return true;
1084+
}
1085+
case ID_SETTINGS_PROFILE_GENERAL_AUTOFILL_ENABLED:
1086+
{
1087+
//! [ToggleProfileGeneralAutofillEnabled]
1088+
// Get the profile object.
1089+
auto webView2_13 = m_webView.try_query<ICoreWebView2_13>();
1090+
CHECK_FEATURE_RETURN(webView2_13);
1091+
wil::com_ptr<ICoreWebView2Profile> webView2Profile;
1092+
CHECK_FAILURE(webView2_13->get_Profile(&webView2Profile));
1093+
CHECK_FEATURE_RETURN(webView2Profile);
1094+
auto webView2Profile6 = webView2Profile.try_query<ICoreWebView2Profile6>();
1095+
CHECK_FEATURE_RETURN(webView2Profile6);
1096+
1097+
BOOL enabled;
1098+
CHECK_FAILURE(webView2Profile6->get_IsGeneralAutofillEnabled(&enabled));
1099+
// Set general-autofill property to the opposite value to current value.
1100+
if (enabled)
1101+
{
1102+
CHECK_FAILURE(webView2Profile6->put_IsGeneralAutofillEnabled(FALSE));
1103+
MessageBox(
1104+
nullptr,
1105+
L"General autofill will be disabled immediately in all WebView2 with the "
1106+
L"same profile.",
1107+
L"Profile settings change", MB_OK);
1108+
}
1109+
else
1110+
{
1111+
CHECK_FAILURE(webView2Profile6->put_IsGeneralAutofillEnabled(TRUE));
1112+
MessageBox(
1113+
nullptr,
1114+
L"General autofill will be enabled immediately in all WebView2 with the "
1115+
L"same profile.",
1116+
L"Profile settings change", MB_OK);
1117+
}
1118+
//! [ToggleProfileGeneralAutofillEnabled]
1119+
return true;
1120+
}
10491121
case ID_TOGGLE_LAUNCHING_EXTERNAL_URI_SCHEME_ENABLED:
10501122
{
10511123
//! [ToggleLaunchingExternalUriScheme]
@@ -1143,6 +1215,7 @@ bool SettingsComponent::HandleWindowMessage(
11431215
// a deferral is commented out here.
11441216
// wil::com_ptr<ICoreWebView2Deferral> deferral;
11451217
// CHECK_FAILURE(args->GetDeferral(&deferral));
1218+
11461219
// m_appWindow->RunAsync(
11471220
// [deferral, showDialog]()
11481221
// {

SampleApps/WebView2APISample/WebView2APISample.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ BEGIN
137137
MENUITEM "Toggle JavaScript", IDM_TOGGLE_JAVASCRIPT
138138
MENUITEM "Toggle Password Autosave", ID_SETTINGS_PASSWORD_AUTOSAVE_ENABLED
139139
MENUITEM "Toggle Pinch Zoom Enabled", ID_SETTINGS_PINCH_ZOOM_ENABLED
140+
MENUITEM "Toggle Profile General Autofill", ID_SETTINGS_PROFILE_GENERAL_AUTOFILL_ENABLED
141+
MENUITEM "Toggle Profile Password Autosave", ID_SETTINGS_PROFILE_PASSWORD_AUTOSAVE_ENABLED
140142
MENUITEM "Toggle Profile Smart Screen", ID_SETTINGS_SMART_SCREEN_ENABLED
141143
MENUITEM "Toggle Replace Images", ID_SETTINGS_REPLACEALLIMAGES
142144
POPUP "Server Certificate Error"

SampleApps/WebView2APISample/WebView2APISample.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,13 @@
382382
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
383383
<ImportGroup Label="ExtensionTargets">
384384
<Import Project="..\packages\Microsoft.Windows.ImplementationLibrary.1.0.191107.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.191107.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
385-
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.1777-prerelease\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.1777-prerelease\build\native\Microsoft.Web.WebView2.targets')" />
385+
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.1829-prerelease\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.1829-prerelease\build\native\Microsoft.Web.WebView2.targets')" />
386386
</ImportGroup>
387387
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
388388
<PropertyGroup>
389389
<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>
390390
</PropertyGroup>
391391
<Error Condition="!Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.191107.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.ImplementationLibrary.1.0.191107.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
392-
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.1777-prerelease\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.1777-prerelease\build\native\Microsoft.Web.WebView2.targets'))" />
392+
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.1829-prerelease\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.1829-prerelease\build\native\Microsoft.Web.WebView2.targets'))" />
393393
</Target>
394394
</Project>

SampleApps/WebView2APISample/assets/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/WebView2APISample/documentation/Testing-Instructions.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ These are instructions for manually testing all the features of the WebView2 API
4949
* [Toggle builtin error page enabled](#Toggle-builtin-error-page-enabled)
5050
* [Toggle general autofill enabled](#Toggle-general-autofill-enabled)
5151
* [Toggle password autosave enabled](#Toggle-password-autosave-enabled)
52+
* [Toggle profile general autofill enabled](#Toggle-profile-general-autofill-enabled)
53+
* [Toggle profile password autosave enabled](#Toggle-profile-password-autosave-enabled)
5254
* [Toggle browser accelerator keys enabled](#Toggle-browser-accelerator-keys-enabled)
5355
* [Toggle Swipe Navigation enabled](#Toggle-Swipe-Navigation-enabled)
5456
* [Toggle SmartScreen enabled](#Toggle-SmartScreen-enabled)
@@ -694,6 +696,86 @@ Test that enables/disables password autosave
694696
28. Repeat step 9.
695697
29. Expected: There is not an additional drop down box that has been added.
696698
699+
### Toggle profile general autofill enabled
700+
701+
Test that enables/disables profile general autofill
702+
_General autofill is enabled by default._
703+
704+
1. Launch the sample app.
705+
2. Go to `Window -> Create New Window With Option`.
706+
3. Type in profile name and uncheck InPrivate, then click `OK`.
707+
4. Expected: A new app window opened with profile name in its title bar, we call this window as window1.
708+
5. In sample app, repeat step 2.
709+
6. Type in the same profile name as typed in step 3 and uncheck InPrivate, then click OK.
710+
7. Expected: A new app window opened with profile name in its title bar, we call this window as window2.
711+
8. In sample app, repeat step 2.
712+
9. Type in the same profile name as typed in step 3 but check InPrivate, then click OK.
713+
10. Expected: A new window opened with the same profile name in its title bar and the app icon should be different that can indicate it's in private mode, we call this window as window3.
714+
11. In all windows(1-3) navigate to <https://rsolomakhin.github.io/autofill/> (Use this third party site to verify).
715+
12. In window1 enter in any test information into the Profile Autofill section and click `Submit`.
716+
13. In window1 navigate to <https://rsolomakhin.github.io/autofill/>.
717+
14. In all windows(1-3) click on the Name field.
718+
15. Expected: A drop down box with the saved profile information is shown.
719+
16. In all windows(1-3) click on the box.
720+
17. Expected: The profile information is autofilled.
721+
18. In window1 go to `Settings -> Toggle Profile General Autofill`.
722+
19. Expected: Message box that says `General autofill will be disabled immediately in all WebView2 with the same profile.`.
723+
20. Click `OK` inside the popup dialog.
724+
21. In all windows(1-3) click on the Name field.
725+
22. Expected: No drop down box appears.
726+
23. Repeat step 12-14.
727+
24. Expected: No drop down box appears.
728+
25. In window1 go to `Settings -> Toggle Profile General Autofill`.
729+
26. Expected: Message box that says `General autofill will be enabled immediately in all WebView2 with the same profile.`.
730+
27. Click `OK` inside the popup dialog.
731+
28. In all windows(1-3) click on the Name field.
732+
15. Expected: A drop down box with the original saved profile information from step 12 is shown.
733+
16. In all windows(1-3) click on the box.
734+
17. Expected: The profile information is autofilled.
735+
736+
### Toggle profile password autosave enabled
737+
738+
Test that enables/disables password autosave
739+
_Password autosave is disabled by default._
740+
741+
1. Launch the sample app.
742+
2. Go to `Settings -> Toggle Profile General Autofill`.
743+
3. Expected: Message Box that says `General autofill will be disabled immediately in all WebView2 with the same profile.`.
744+
4. Go to `Window -> Create New Window With Option`.
745+
5. Type in profile name and uncheck InPrivate, then click `OK`.
746+
6. Expected: A new app window opened with profile name in its title bar, we call this window as window1.
747+
7. In sample app, repeat step 2.
748+
8. Type in the same profile name as typed in step 3 and uncheck InPrivate, then click OK.
749+
9. Expected: A new app window opened with profile name in its title bar, we call this window as window2.
750+
10. In sample app, repeat step 2.
751+
11. Type in the same profile name as typed in step 3 but check InPrivate, then click OK.
752+
12. Expected: A new window opened with the same profile name in its title bar and the app icon should be different that can indicate it's in private mode, we call this window as window3.
753+
13. In all windows(1-3) navigate to <https://rsolomakhin.github.io/autofill/> (Use this third party site to verify).
754+
14. In window1 enter in any test information into the Username/Password section and click `Submit`.
755+
15. Expected: The window1 navigates to <https://example.com/> and no save password prompt is shown.
756+
16. In window1, navigate to <https://rsolomakhin.github.io/autofill/>.
757+
17. In all windows(1-3) click on the username field.
758+
18. Expected: No drop down box appears. (note: if password information has previously been saved when the password autosave has been enabled, a drop down box will appear.)
759+
19. In window1, go to `Settings -> Toogle Profile Password Autosave`.
760+
20. Expected: Message Box that says `Password autosave will be enabled after the next navigation in all WebView2 with the same profile.`.
761+
21. Click `OK` inside the popup dialog.
762+
22. In window1 enter in any test information into the Username/Password section and click `Submit`.
763+
23. Expected: The app navigates to <https://example.com> and a save password prompt will popup.
764+
24. Click `Save`.
765+
25. In all windows(1-3) navigate to <https://rsolomakhin.github.io/autofill/>.
766+
26. Expected: In window1 see the username and password information is auto-populated.
767+
27. In all windows(1-3) click on the username field.
768+
28. Expected: A drop down box with the saved password information is shown.
769+
29. In window1 go to `Settings -> Toggle Profile Password Autosave`.
770+
30. Expected: Message Box that says `Password autosave will be disabled after the next navigation in all WebView2 with the same profile.`.
771+
31. Click `OK` inside the popup dialog.
772+
32. In window1 delete the information from the username and password fields and enter in new test information and click submit.
773+
33. Expected: No save password prompt is shown.
774+
34. In window1 navigate to <https://rsolomakhin.github.io/autofill/>.
775+
35. Expected: Only the information entered from step 22 is auto-populated.
776+
36. In all windows(1-3) click on the username field.
777+
37. Expected: There is not an additional drop down box that has been added.
778+
697779
### Toggle browser accelerator keys enabled
698780
699781
Test that enabled/disables browser accelerator keys
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.1777-prerelease" targetFramework="native" />
3+
<package id="Microsoft.Web.WebView2" version="1.0.1829-prerelease" targetFramework="native" />
44
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.191107.2" targetFramework="native" />
55
</packages>

SampleApps/WebView2APISample/resource.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@
197197
#define ID_TOGGLE_ALLOW_EXTERNAL_DROP 32792
198198
#define ID_SETTINGS_TOGGLE_POST_STATUS_BAR_ACTIVITY 32793
199199
#define ID_SETTINGS_TOGGLE_POST_FAVICON_CHANGED 32794
200+
#define ID_SETTINGS_PROFILE_GENERAL_AUTOFILL_ENABLED 32795
201+
#define ID_SETTINGS_PROFILE_PASSWORD_AUTOSAVE_ENABLED 32796
200202
#define ID_TOGGLE_CUSTOM_SERVER_CERTIFICATE_SUPPORT 32797
201203
#define ID_CLEAR_SERVER_CERTIFICATE_ERROR_ACTIONS 32798
202204
#define ID_SETTINGS_SMART_SCREEN_ENABLED 32799
@@ -206,6 +208,7 @@
206208
#define IDC_CHECK_USE_OS_REGION 32803
207209
#define ID_CUSTOM_DATA_PARTITION 32804
208210
#define IDC_STATIC -1
211+
209212
// Next default values for new objects
210213
//
211214
#ifdef APSTUDIO_INVOKED

SampleApps/WebView2WindowsFormsBrowser/WebView2WindowsFormsBrowser.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<PlatformTarget>AnyCPU</PlatformTarget>
2020
</PropertyGroup>
2121
<ItemGroup>
22-
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1777-prerelease" />
22+
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1829-prerelease" />
2323
</ItemGroup>
2424
<ItemGroup>
2525
<Folder Include="assets\" />

SampleApps/WebView2WpfBrowser/MainWindow.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,6 +2359,7 @@ private void ToggleDownloadDialog(object target, RoutedEventArgs e)
23592359
void NewWindowWithOptionsCmdExecuted(object target, ExecutedRoutedEventArgs e)
23602360
{
23612361
var dialog = new NewWindowOptionsDialog();
2362+
dialog.CreationProperties = webView.CreationProperties;
23622363
if (dialog.ShowDialog() == true)
23632364
{
23642365
new MainWindow(dialog.CreationProperties).Show();

0 commit comments

Comments
 (0)