Closed GoogleCodeExporter closed 8 years ago
Original comment by flier...@gmail.com
on 3 Feb 2011 at 11:01
I will check it a few day later, because I'm in a short vacation with limited
Internet access :)
Original comment by flier...@gmail.com
on 3 Feb 2011 at 11:02
Ok after looking into it more it seems my suggestion in Issue 61 was wrong.
This article has a pretty good description of whats going on:
http://javascriptweblog.wordpress.com/2010/08/16/understanding-undefined-and-pre
venting-referenceerrors/
From what I gather:
<global object>.foo // undefined
foo // reference error
typeof(foo) // undefined
foo.x // reference error
I have a global object defined in PyV8 and I have a __getattr__ method on it,
how is it possible to return either undefined or raise a reference error
depending on how it was called?
Original comment by ATM1...@gmail.com
on 5 Feb 2011 at 4:16
I found this to be a related issue:
import PyV8
class Global(PyV8.JSClass):
def __init__(self):
self.s = self
def write(self, val):
print val
with PyV8.JSContext(Global()) as ctx:
ctx.eval("""
write(String)
write(s.String)
""")
Output being:
function String() { [native code] }
Traceback (most recent call last):
File "window2.py", line 15, in <module>
""")
ReferenceError: ReferenceError: String ( @ 3 : 15 ) ->
write(s.String)
I found this in the ecma 262 spec:
10.1.5 Global Object
There is a unique global object (15.1), which is created before control enters
any execution context.
Initially the global object has the following properties:
• Built-in objects such as Math, String, Date, parseInt, etc. These have
attributes { DontEnum }.
• Additional host defined properties. This may include a property whose
value is the global object
itself; for example, in the HTML document object model the window property of
the global object is
the global object itself.
As control enters execution contexts, and as ECMAScript code is executed,
additional properties may be
added to the global object and the initial properties may be changed
Original comment by ATM1...@gmail.com
on 9 Feb 2011 at 9:41
Fixed, please verify it with SVN trunk code after r337
Thanks for your sharing, the blog is great :)
Original comment by flier...@gmail.com
on 13 Feb 2011 at 1:36
Original comment by flier...@gmail.com
on 13 Feb 2011 at 1:36
This works great. Thank you.
Original comment by ATM1...@gmail.com
on 14 Feb 2011 at 4:06
Original comment by flier...@gmail.com
on 15 Feb 2011 at 2:07
Original issue reported on code.google.com by
mbc8...@gmail.com
on 3 Feb 2011 at 10:53