Skip to content

Commit 5956f34

Browse files
committed
Changed existing CreateCookie to CreateCookieWithDetails
1 parent 462e06a commit 5956f34

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

specs/CookieManagement.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ScenarioCookieManagement::ScenarioCookieManagement(AppWindow* appWindow)
5151

5252
//! [AddOrUpdateCookie]
5353
wil::com_ptr<ICoreWebView2Cookie> cookie;
54-
CHECK_FAILURE(m_cookieManager->CreateCookie(
54+
CHECK_FAILURE(m_cookieManager->CreateCookieWithDetails(
5555
name.c_str(), value.c_str(), L".bing.com", L"/", &cookie));
5656
CHECK_FAILURE(m_cookieManager->AddOrUpdateCookie(cookie.get()));
5757
reply = L"{\"CookieAddedOrUpdated\":\"Cookie added or updated successfully.\"}";
@@ -181,7 +181,7 @@ void CookieManagementCmdsCanExecute(object sender, CanExecuteRoutedEventArgs e)
181181
182182
void AddOrUpdateCookieCmdExecuted(object target, ExecutedRoutedEventArgs e)
183183
{
184-
CoreWebView2Cookie cookie = webView.CoreWebView2.CookieManager.CreateCookie("CookieName", "CookieValue", ".bing.com", "/");
184+
CoreWebView2Cookie cookie = webView.CoreWebView2.CookieManager.CreateCookieWithDetails("CookieName", "CookieValue", ".bing.com", "/");
185185
cookie.SameSite = CoreWebView2CookieSameSiteKind.None;
186186
webView.CoreWebView2.CookieManager.AddOrUpdateCookie(cookie);
187187
}
@@ -302,13 +302,19 @@ interface ICoreWebView2CookieManager : IUnknown {
302302
/// This only creates a cookie object and it is not added to the cookie
303303
/// manager until you call AddOrUpdateCookie.
304304
/// See ICoreWebView2Cookie for more details.
305-
HRESULT CreateCookie(
305+
HRESULT CreateCookieWithDetails(
306306
[in] LPCWSTR name,
307307
[in] LPCWSTR value,
308308
[in] LPCWSTR domain,
309309
[in] LPCWSTR path,
310310
[out, retval] ICoreWebView2Cookie** cookie);
311311
312+
313+
/// Creates a cookie whose params matches those of the specified cookie.
314+
HRESULT CreateCookie(
315+
[in] ICoreWebView2StagingCookie cookieParam,
316+
[out, retval] ICoreWebView2StagingCookie** cookie);
317+
312318
/// Gets a list of cookies matching the specific URI.
313319
/// You can modify the cookie objects, call
314320
/// ICoreWebView2CookieManager::AddOrUpdateCookie, and the changes
@@ -321,7 +327,7 @@ interface ICoreWebView2CookieManager : IUnknown {
321327
/// equivalent cookies if they exist.
322328
HRESULT AddOrUpdateCookie([in] ICoreWebView2Cookie* cookie);
323329
324-
/// Deletes a cookie whose params matching those of the specified cookie.
330+
/// Deletes a cookie whose params matches those of the specified cookie.
325331
HRESULT DeleteCookie([in] ICoreWebView2StagingCookie* cookie);
326332
327333
/// Deletes browser cookies with matching name and uri or domain/path pair.
@@ -395,7 +401,10 @@ namespace Microsoft.Web.WebView2.Core
395401
/// One can set other optional properties after cookie creation.
396402
/// This only creates a cookie object and it is not added to the cookie
397403
/// manager until you call AddOrUpdateCookie.
398-
CoreWebView2Cookie CreateCookie(String name, String value, String Domain, String Path);
404+
CoreWebView2Cookie CreateCookieWithDetails(String name, String value, String Domain, String Path);
405+
406+
/// Creates a cookie whose params matches those of the specified cookie.
407+
CoreWebView2Cookie CreateCookie(CoreWebView2 cookie);
399408

400409
/// Gets a list of cookies matching the specific URI.
401410
/// You can modify the cookie objects, call
@@ -407,7 +416,7 @@ namespace Microsoft.Web.WebView2.Core
407416
/// equivalent cookies if they exist.
408417
void AddOrUpdateCookie(CoreWebView2Cookie cookie);
409418

410-
/// Deletes a cookie whose params matching those of the specified cookie.
419+
/// Deletes a cookie whose params matches those of the specified cookie.
411420
void DeleteCookie(CoreWebView2Cookie cookie);
412421

413422
/// Deletes browser cookies with matching name and uri or domain/path pair.

0 commit comments

Comments
 (0)