changeset 27:0b00162939ae

Fixed to work w/ latest Pydermonkey tip.
author Atul Varma <avarma@mozilla.com>
date Mon, 10 May 2010 00:56:56 -0700
parents c4181cc0771d
children d28100e071a7
files docs.txt pydertron.py
diffstat 2 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/docs.txt	Sun Mar 21 22:11:51 2010 -0700
+++ b/docs.txt	Mon May 10 00:56:56 2010 -0700
@@ -97,7 +97,7 @@
 ----------
 
 Any exceptions raised by wrapped Python functions need to be of type
-``pydermonkey.error`` to be propagated into calling JavaScript code;
+``pydermonkey.ScriptError`` to be propagated into calling JavaScript code;
 if they're not, then for security purposes, the entire JavaScript call
 stack is unrolled.
 
--- a/pydertron.py	Sun Mar 21 22:11:51 2010 -0700
+++ b/pydertron.py	Mon May 10 00:56:56 2010 -0700
@@ -364,13 +364,13 @@
                         arglist.append(self.wrap_jsobject(arg))
                     instance = func_cx.get_object_private(this)
                     if instance is None or not isinstance(instance, pyproto):
-                        raise pydermonkey.error("Method type mismatch")
+                        raise pydermonkey.ScriptError("Method type mismatch")
 
                     # TODO: Fill in extra required params with
                     # pymonkey.undefined?  or automatically throw an
                     # exception to calling js code?
                     return self.wrap_pyobject(func(instance, *arglist))
-                except pydermonkey.error:
+                except pydermonkey.ScriptError:
                     raise
                 except Exception:
                     raise InternalError()
@@ -385,7 +385,7 @@
                     # pymonkey.undefined?  or automatically throw an
                     # exception to calling js code?
                     return self.wrap_pyobject(func(*arglist))
-                except pydermonkey.error:
+                except pydermonkey.ScriptError:
                     raise
                 except Exception:
                     raise InternalError()
@@ -550,11 +550,10 @@
 
         filename = self.fs.find_module(self.get_calling_script(), path)
         if not filename:
-            raise pydermonkey.error('Module not found: %s' % path)
+            raise pydermonkey.ScriptError('Module not found: %s' % path)
         if not filename in self.__modules:
             cx = self.cx
             module = cx.new_object(None, self.__root_proto)
-            cx.init_standard_classes(module)
             exports = cx.new_object()
             cx.define_property(module, 'exports', exports)
             self._install_globals(self.wrap_jsobject(module))
@@ -580,7 +579,7 @@
             if callback:
                 callback(self.wrap_jsobject(result))
             retval = 0
-        except pydermonkey.error, e:
+        except pydermonkey.ScriptError, e:
             params = dict(
                 stack_trace = format_stack(self.js_stack, self.fs.open),
                 error = e.args[1]