Skip to content

[πŸ› Bug]: Delete named cookie deletes all cookiesΒ #14876

@nvborisenko

Description

@nvborisenko

What happened?

12 years old issue of null cookie name.

How can we reproduce the issue?

using var driver = new FirefoxDriver();

driver.Url = "https://google.com";

Console.WriteLine(driver.Manage().Cookies.AllCookies.Count);

driver.Manage().Cookies.DeleteCookieNamed(null);

Console.WriteLine("Deleted some cookie");

Console.WriteLine(driver.Manage().Cookies.AllCookies.Count);
2
Deleted some cookie
0

Relevant log output

23:51:41.636 DEBUG HttpCommandExecutor: Executing command: []: newSession {"capabilities":{"firstMatch":[{"browserName":"firefox","moz:firefoxOptions":{"binary":"C:\\Program Files\\Mozilla Firefox\\firefox.exe","prefs":{"remote.active-protocols":3}}}]}}
23:51:41.642 TRACE HttpCommandExecutor: >> POST RequestUri: http://localhost:59253/session, Content: System.Net.Http.ByteArrayContent, Headers: 2
{"capabilities":{"firstMatch":[{"browserName":"firefox","moz:firefoxOptions":{"binary":"C:\\Program Files\\Mozilla Firefox\\firefox.exe","prefs":{"remote.active-protocols":3}}}]}}
1733691103700   mozrunner::runner       INFO    Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "-no-remote" "-profile" "C:\\Users\\Nick\\AppData\\Local\\Temp\\rust_mozprofilebv8PPM"
Read port: 59260
23:51:45.648 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: OK, Content: System.Net.Http.HttpConnectionResponseContent, Headers: 2
23:51:45.652 DEBUG HttpCommandExecutor: Response: (b112c4de-b81a-42ee-a2da-5e2cfe5b44e3 Success: System.Collections.Generic.Dictionary`2[System.String,System.Object])
23:51:45.657 DEBUG HttpCommandExecutor: Executing command: [b112c4de-b81a-42ee-a2da-5e2cfe5b44e3]: get {"url":"https://google.com"}
23:51:45.659 TRACE HttpCommandExecutor: >> POST RequestUri: http://localhost:59253/session/b112c4de-b81a-42ee-a2da-5e2cfe5b44e3/url, Content: System.Net.Http.ByteArrayContent, Headers: 2
{"url":"https://google.com"}
23:51:46.590 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: OK, Content: System.Net.Http.HttpConnectionResponseContent, Headers: 2
23:51:46.590 DEBUG HttpCommandExecutor: Response: ( Success: )
23:51:46.591 DEBUG HttpCommandExecutor: Executing command: [b112c4de-b81a-42ee-a2da-5e2cfe5b44e3]: getCookies {}
23:51:46.592 TRACE HttpCommandExecutor: >> GET RequestUri: http://localhost:59253/session/b112c4de-b81a-42ee-a2da-5e2cfe5b44e3/cookie, Content: null, Headers: 3
23:51:46.594 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: OK, Content: System.Net.Http.HttpConnectionResponseContent, Headers: 2
23:51:46.595 DEBUG HttpCommandExecutor: Response: ( Success: System.Object[])
2
23:51:46.605 DEBUG HttpCommandExecutor: Executing command: [b112c4de-b81a-42ee-a2da-5e2cfe5b44e3]: deleteCookie {"name":null}
23:51:46.606 TRACE HttpCommandExecutor: >> DELETE RequestUri: http://localhost:59253/session/b112c4de-b81a-42ee-a2da-5e2cfe5b44e3/cookie/, Content: null, Headers: 2
23:51:46.609 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: OK, Content: System.Net.Http.HttpConnectionResponseContent, Headers: 2
23:51:46.610 DEBUG HttpCommandExecutor: Response: ( Success: )
Deleted some cookie
23:51:46.610 DEBUG HttpCommandExecutor: Executing command: [b112c4de-b81a-42ee-a2da-5e2cfe5b44e3]: getCookies {}
23:51:46.610 TRACE HttpCommandExecutor: >> GET RequestUri: http://localhost:59253/session/b112c4de-b81a-42ee-a2da-5e2cfe5b44e3/cookie, Content: null, Headers: 3
23:51:46.612 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: OK, Content: System.Net.Http.HttpConnectionResponseContent, Headers: 2
23:51:46.612 DEBUG HttpCommandExecutor: Response: ( Success: System.Object[])
0
23:51:46.613 DEBUG HttpCommandExecutor: Executing command: [b112c4de-b81a-42ee-a2da-5e2cfe5b44e3]: quit {}
23:51:46.613 TRACE HttpCommandExecutor: >> DELETE RequestUri: http://localhost:59253/session/b112c4de-b81a-42ee-a2da-5e2cfe5b44e3, Content: null, Headers: 2
23:51:47.353 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: OK, Content: System.Net.Http.HttpConnectionResponseContent, Headers: 2
23:51:47.353 DEBUG HttpCommandExecutor: Response: ( Success: )

Operating System

Win 11

Selenium version

4.27

What are the browser(s) and version(s) where you see this issue?

Firefox

What are the browser driver(s) and version(s) where you see this issue?

any

Are you using Selenium Grid?

no

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions