Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Delete named cookie deletes all cookies #14876

Closed
nvborisenko opened this issue Dec 8, 2024 · 4 comments · May be fixed by #14883
Closed

[🐛 Bug]: Delete named cookie deletes all cookies #14876

nvborisenko opened this issue Dec 8, 2024 · 4 comments · May be fixed by #14883

Comments

@nvborisenko
Copy link
Member

nvborisenko commented Dec 8, 2024

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

Copy link

github-actions bot commented Dec 8, 2024

@nvborisenko, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@Paarth-Kashyap
Copy link

im interested in this, can you tell me a little more?

@nvborisenko
Copy link
Member Author

Dependent on #14884

@nvborisenko
Copy link
Member Author

Implicitly fixed by #14874 via not allowing null name on client side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants