[Webkit-unassigned] [Bug 184907] New: JSC needs to provide a basic handle api

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 23 22:53:09 PDT 2018


            Bug ID: 184907
           Summary: JSC needs to provide a basic handle api
           Product: WebKit
           Version: Other
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: oliver at apple.com

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)

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180424/2dcac039/attachment.html>

More information about the webkit-unassigned mailing list