feat: [#1864] Implement Cookie Store API#2040
Open
TrevorBurnham wants to merge 1 commit intocapricorn86:masterfrom
Open
feat: [#1864] Implement Cookie Store API#2040TrevorBurnham wants to merge 1 commit intocapricorn86:masterfrom
TrevorBurnham wants to merge 1 commit intocapricorn86:masterfrom
Conversation
|
Was this done an LLM? Who on earth writes such pull request descriptions? |
Contributor
Author
|
Yes, I used Claude Opus 4.5. |
|
Just out of interest, with https://github.com/copilot and Claude Opus 4.5 chosen? |
Contributor
Author
|
In this case I believe I used Kiro, the agentic IDE created by AWS (my employer). Outside of work, though, I mostly use Claude Code. I find GitHub Copilot very useful for answering questions about repos, but rarely use it to generate code. |
b3cf81e to
fb29634
Compare
- Add CookieStore class with get(), getAll(), set(), delete() methods - Add ICookieStoreGetOptions, ICookieStoreSetOptions, ICookieStoreItem interfaces - Expose cookieStore property on window - Export CookieStore class from window - Add comprehensive test suite (22 tests) - Integrate with existing cookie infrastructure (CookieContainer)
fb29634 to
0392f16
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #1864 and #1893
Summary
Implements the Cookie Store API, providing a modern, Promise-based interface for managing cookies. Full integration with the existing
CookieContainerinfrastructure — cookies set viacookieStoreare visible viadocument.cookieand vice versa.Changes
New Files
packages/happy-dom/src/cookie-store/CookieStore.ts— Main implementation withget(),getAll(),set(),delete()methodspackages/happy-dom/src/cookie-store/ICookieStoreGetOptions.ts— Options forget()/getAll()packages/happy-dom/src/cookie-store/ICookieStoreSetOptions.ts— Options forset()packages/happy-dom/src/cookie-store/ICookieStoreDeleteOptions.ts— Options fordelete()(spec-correct subset:name,domain,path,partitionedonly)packages/happy-dom/src/cookie-store/ICookieStoreItem.ts— Cookie item returned byget()/getAll()packages/happy-dom/src/event/events/CookieChangeEvent.ts—CookieChangeEventwithchangedanddeletedarrayspackages/happy-dom/src/event/events/ICookieChangeEventInit.ts— Init interface forCookieChangeEventpackages/happy-dom/test/cookie-store/CookieStore.test.ts— Test suite (24 tests)Modified Files
packages/happy-dom/src/PropertySymbol.ts— AddedcookieStoresymbolpackages/happy-dom/src/window/BrowserWindow.ts— AddedCookieStoreandCookieChangeEventimports, properties, getters, and class exportspackages/happy-dom/src/index.ts— Added exports forCookieStore,CookieChangeEvent, and all interfacesAPI
Spec Compliance
[SecureContext]:secureflag is always set totruesameSiteis'strict'per specvaluedefaults to''when omitted from the options objectdelete()accepts its own options type (ICookieStoreDeleteOptions) withoutvalue,expires, orsameSitegetAll()withurloption validates same-origin and throwsSecurityErroron cross-origin URLsexpiresaccepts bothnumber(Unix ms) andDateobjectschangeevent dispatchesCookieChangeEventwithchanged/deletedarrays onset()anddelete()Limitations
changeevent only fires for mutations viaCookieStoremethods, not for cookies set viadocument.cookie(would require adding an observer mechanism toCookieContainer)