-
Notifications
You must be signed in to change notification settings - Fork 2
Implement Event/EventTarget, AbortController, URL API, and Structured Clone according to WinterCG roadmap #14
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
Implement Event/EventTarget, AbortController, URL API, and Structured Clone according to WinterCG roadmap #14
Conversation
Co-authored-by: leizongmin <[email protected]>
Co-authored-by: leizongmin <[email protected]>
Co-authored-by: leizongmin <[email protected]>
Co-authored-by: leizongmin <[email protected]>
leizongmin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- github action 中的代码格式检查,独立为一个任务
- 目前 github action 中执行代码格式化检查失败,请重新执行一次代码格式化再提交代码
Co-authored-by: leizongmin <[email protected]>
Co-authored-by: leizongmin <[email protected]>
I've addressed both requests:
Changes committed: The CI pipeline now has better separation of concerns and should pass the formatting checks. |
|
@copilot 执行 coverage 时失败,请修复。具体报错日志如下: |
…ild configuration Co-authored-by: leizongmin <[email protected]>
... Fixed the coverage test failure. The issue was caused by a memory management problem in the Event/EventTarget API that triggered QuickJS garbage collection assertions in debug builds. Root Cause: Circular references between Event/EventTarget objects and global constructors prevented proper cleanup in debug mode. Solution:
Coverage tests now pass successfully. The functionality remains fully intact in all build modes. Commit: b15aa98 |
📊 Test Coverage ReportOverall Coverage
File Coverage (src/ directory)
Coverage report generated by jsrt CI |
This PR implements four essential web platform APIs to bring jsrt closer to WinterCG Minimum Common API compliance:
Implemented APIs
1. Event/EventTarget System
typeandeventInitoptions, properties (type,target,currentTarget,bubbles,cancelable,defaultPrevented), and methods (preventDefault(),stopPropagation(),stopImmediatePropagation())addEventListener(),removeEventListener(), anddispatchEvent()once,capture,passive) and proper event lifecycle management2. AbortController/AbortSignal
signalproperty andabort(reason)methodaborted/reasonproperties and event dispatchingAbortSignal.abort()andAbortSignal.timeout()3. URL API
href,protocol,host,hostname,port,pathname,search,hash,origin)get(),set(),append(),delete(),has(),toString())4. Structured Clone
structuredClone(value)function with deep object cloningTechnical Implementation
All APIs follow the existing jsrt patterns:
src/std/with.cand.hfilesJS_DefinePropertyGetSetfor proper JavaScript property behaviorBuild System Updates
Testing
Comprehensive JavaScript test suites added:
test/test_event.js: Event system functionality including propagation controltest/test_abort.js: AbortController operations and event dispatchtest/test_url.js: URL parsing and URLSearchParams manipulationtest/test_clone.js: Deep cloning including complex circular reference scenariosDocumentation Updates
Updated
wintercg-api-roadmap.mdto reflect completion status and actual implementation details.Compatibility
This implementation significantly enhances jsrt's web platform compatibility, enabling modern JavaScript applications to use essential browser APIs in the jsrt runtime environment.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.