Bug 41662

Summary: [Qt] QScriptEngine should have an API for wrapping a C function
Product: WebKit Reporter: Kent Hansen <kent.hansen>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Enhancement CC: cmarcelo, jedrzej.nowacki
Priority: P2 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Bug Depends on: 42174, 42242    
Bug Blocks: 31863    

Description Kent Hansen 2010-07-06 01:45:54 PDT
See http://doc.trolltech.com/latest/qscriptengine.html#newFunction

This provides functionality similar to JSObjectMakeFunctionWithCallback() and JSObjectMakeConstructor() in the JSC C API.
Implementing this feature also requires implementing the QScriptContext class (see http://doc.trolltech.com/latest/qscriptcontext.html), which provides the arguments, callee and this-object for a particular invocation of the function.

In QtScript, the same type of callback is used for both normal functions and constructors; QScriptContext::isCalledAsConstructor() can be used to query whether the function was called as a constructor (e.g. as operand to "new").
Comment 1 Caio Marcelo de Oliveira Filho 2010-07-08 01:00:09 PDT
I'm working on this one, but have no permissions to set the "Assigned To" field.
Comment 2 Caio Marcelo de Oliveira Filho 2010-07-13 09:52:19 PDT
Following Jedrzej suggestion, I'm going to split this in smaller tasks (bugs), and make them all depend on this bug.

What I want is to split up the QScriptContext parts from the "callback" support (bug 42174), since the former may need some extensions on the JSC C API.
Comment 3 Jędrzej Nowacki 2011-07-07 07:52:11 PDT
Porting QtScript API over JSC C API will not be continued.