RoamUniverse / pyv8

Automatically exported from code.google.com/p/pyv8
0 stars 0 forks source link

multiple native JSExtensions #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. register two different native JSExtension

---
firstSrc = "native function hello();"
firstPy = JSExtension("hello/python", firstSrc, lambda firstfunc: lambda 
name: "[HELLO] [" + name + "]", register=False)
firstPy.register()

secondSrc = "native function test();"
secondPy = JSExtension("test/python", secondSrc, lambda secondfunc: lambda 
name: "[TEST] [" + name + "]", register=False)
secondPy.register()

with JSContext(extensions=['test/python', 'hello/python']) as ctx: 
    res = ctx.eval("hello('flier')")

print 'RES:  '+ res

---

What is the expected output? What do you see instead?
RES:  [HELLO] [flier]

instead i get

---
Traceback (most recent call last):
  File "testjs.py", line 20, in <module>
    with JSContext(extensions=['test/python', 'hello/python']) as ctx:
  File "C:\Python26\lib\site-packages\PyV8.py", line 411, in __init__
    _PyV8.JSContext.__init__(self, obj, extensions)
PyV8.JSError: JSError: <v8::Context::New()> Cannot find required extension

---

What version of the product are you using? On what operating system?
the build attached here: http://code.google.com/p/pyv8/issues/detail?
id=12&can=1&q=__doc__#c2

OS: win 7 x86 32 bit

Please provide any additional information below.
registering two _javascript_ extensions works

Original issue reported on code.google.com by dimo...@gmail.com on 25 Dec 2009 at 10:23

GoogleCodeExporter commented 9 years ago

Original comment by flier...@gmail.com on 26 Dec 2009 at 3:25

GoogleCodeExporter commented 9 years ago
The root cause it I used a wrong pointer to the extension name, which cause 
only the last 
name could be found by v8

Please check out the source code from SVN after revision #176 or use the 
private build in 
attachment to verify it

Thanks

Original comment by flier...@gmail.com on 27 Dec 2009 at 2:22

Attachments:

GoogleCodeExporter commented 9 years ago
now it works perfectly :)

thanks 

Original comment by dimo...@gmail.com on 27 Dec 2009 at 11:57