# HG changeset patch # User Atul Varma # Date 1273478216 25200 # Node ID 0b00162939ae51296c7be5b412dfe4d051ddc40f # Parent c4181cc0771d40640942eade9c0df98d466d29df Fixed to work w/ latest Pydermonkey tip. diff -r c4181cc0771d -r 0b00162939ae docs.txt --- 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. diff -r c4181cc0771d -r 0b00162939ae pydertron.py --- 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]