WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
184907
JSC needs to provide a basic handle api
https://bugs.webkit.org/show_bug.cgi?id=184907
Summary
JSC needs to provide a basic handle api
Oliver Hunt
Reported
2018-04-23 22:53:09 PDT
I'm trying to write an "interesting" js program and it keeps being frustrating to try and manage lifetime in the C API. The problems that I keep hitting is that JSValueProtect/Unprotect require a context argument, that means a smart pointer has to carry both the value and context references. The other problem is weak and conditional ownership. I think an API along the lines of typedef JSHandleRef JSHandleRef JSHandleMake(JSContextRef) JSHandleRef JSHandleMakeWeak(JSContextRef, nullable JSWeakCallback) // Note the lack of a context here -- I believe that is completely achievable. void JSHandleRetain(JSHandleRef) void JSHandleRelease(JSHandleRef) // While it would be nice to just have a "get slot" style api, I think that would // result in ABI heartbreak down the road JSValueRef JSHandleGetValue(JSHandleRef) void JSHandleSetValue(JSHandleRef, JSValueRef)
Attachments
Add attachment
proposed patch, testcase, etc.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug