[webkit-dev] Question about JavaScriptCore's JSEvaluateScript function.

Zhe Su james.su at gmail.com
Sun Mar 1 22:14:29 PST 2009


Hi,
  Recently, I'm writing an application which uses JavaScriptCore to execute
javascript code. I just encountered a problem when using JSEvaluateScript
function to evaluate a piece of script. When executing the script, some
callbacks provided by my code will be called, but I found that the context
received by callbacks are different than the context I created and passed to
JSEvaluateScript function.

Attached is a test program.
Below is the output of this program on my system (ubuntu 8.04 64bit with
latest webkit svn):

Create context 0x7faf5d567e88, global object 0x7faf5d530000
InitializeCallback(ctx=0x7faf5d567e88, obj=0x7faf5d532400)
HasPropertyCallback(ctx=0x7faf50c4b048, obj=0x7faf5d532400, prop=prototype)
CallAsConstructorCallback(ctx=0x7faf50c4b0c0, obj=0x7faf5d532400)
InitializeCallback(ctx=0x7faf50c4b0c0, obj=0x7faf5d532440)
SetPropertyCallback(ctx=0x7faf50c4b048, obj=0x7faf5d532440, prop=prop1)
HasPropertyCallback(ctx=0x7faf50c4b048, obj=0x7faf5d532440, prop=prop1)
FinalizeCallback(obj=0x7faf5d532400)
FinalizeCallback(obj=0x7faf5d532440)

You can see that, the callback functions received several different context
pointers comparing to the one created at first beginning.

Is it an intend behavior or a bug of webkit? And how can I avoid or
workaround this problem?

Thanks a lot.

James Su
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090302/89636b3a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jsevaluate-test.cc
Type: text/x-c++src
Size: 3869 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090302/89636b3a/attachment.bin>


More information about the webkit-dev mailing list