Commits on Feb 16, 2011
  1. Make this build on 10.6

    I had to do some hackery to get this building on 10.6 with Homebrew. I
    mostly hacked together a fake nspr.pc and dropped it in [1] so that
    the pkgconfig stuff in would work. There's a copy of this
    file in the "extra" directory in this repo. I also added a patch
    for the va_copy like MacPorts does.
    If anyone would like to tear out the embedded copy of Spidermonkey
    that this package ships with and update the build system to use
    either what Homebrew installs or is found in the xulrunner package
    on Ubuntu, that would be awesome.
    [1] /usr/local/lib/pkgconfig/nspr.c
    committed Feb 15, 2011
Commits on Oct 5, 2010
  1. @lericson
  2. @lericson
  3. @lericson

    Allow toggling strict mode

    lericson committed Oct 5, 2010
  4. @lericson
  5. @lericson

    Allow setting the filename and lineno in execute()

    This should not only make tracebacks better, but also allow Python
    to open the JavaScript file so as to show the correct line (of
    course, given the filename can be found.)
    lericson committed Oct 5, 2010
Commits on Jul 18, 2009
  1. Removed cruft in the source directory.

    Fixed with a pointer from Roberto.
    committed Jul 18, 2009
Commits on Jul 7, 2009
Commits on Jun 28, 2009
  1. Pushing fix for [#21] to PyPI

    committed Jun 28, 2009
Commits on Jun 26, 2009
  1. Fix segfaults when large numbers of contexts.

    Turns out that I had an error in my logic about how to reference count
    the python context object. I removed references to it from Python
    objects that are wrapped in the JavaScript VM. I'm more than 50% certain that
    this is correct as when the Python context dies, it'll destroy the
    JSContext* and along with it all references to Python objects that need
    refernces to the Context.
    [#21 state:resolved]
    committed Jun 26, 2009
Commits on Jun 14, 2009
  1. Filter Python access with a function.

    JavaScript requests for data from the Python VM can now be filtered by
    specifying an access callback function on the Context instance. See the
    README or tests for API usage.
    Thanks to Richard Boulton for the initial patch.
    committed Jun 14, 2009
Commits on Jun 4, 2009
Commits on May 26, 2009
  1. Fixes broken memory limit test.

    Keiji Costantini reported the test as failing on Gentoo on amd64. I imagine the
    64 bit might've had something to do with memory requirements for start up as it
    seems just enough to get a working context on my 32 bit machine. I upped the
    limit and memory usage of the test. Thanks Keiji.
    Paul Davis committed May 26, 2009
Commits on May 25, 2009
  1. [#17] Fix context properties when value is `null`.

    Thanks to Spahl for the report, patch, and test, and general awesomeness
    at being so thorough.
    [#17 state:resolved]
    committed May 25, 2009
Commits on May 18, 2009
  1. Fix integer property lookups.

        >>> rt = spidermonkey.Runtime()
        >>> cx = rt.new_context()
        >>> cx.add_global("bang", [2, "got me!"])
        >>> assert cx.execute("bang[1];") == "got me!"
    Thanks to spahl for the report and fix.
    [#16 state:resolved]
    Paul Davis committed May 18, 2009
Commits on May 17, 2009
  1. Fixes global handling of "function foo() {}"

    JavaScript acts a bit odd in this case in that the body of 'foo' is passed to
    JS_Class.add_property but not JS_Class.set_property. For now I added an add_prop
    method that special cases when the passed in value is a function and delegates
    to set_prop.
    While I was at it, I went ahead and added support for deleting global properties
    as well. If your global handler has __delitem__ defined, it will now get called
    for the JavaScript statement "delete foo;"
    Thanks to Riccardo Pelizzi for the bug report.
    committed May 17, 2009
Commits on May 16, 2009
  1. Updated the README for pkg-config dependancy.

    Thanks to Mike West
    committed May 16, 2009
  2. Fix for time limit constraints.

    The root bug I think has to do with conversions between integral types. I
    changed the Context.max_time method to be a bit less clever which will hopefully
    fix things. I also updated the test_exceeds_time to fail more gracefully as per
    Thanks to Mike West
    [#15 state:open]
    committed May 16, 2009
Commits on May 14, 2009
  1. Test for invalid octal.

    I added a test that catches the JSError generated by invalid octal. Ricardo, can
    you confirm whether this test passes or fails? You can run the tests like such:
        $ python test
    [#12 state:open]
    Paul Davis committed May 14, 2009
Commits on May 12, 2009
  1. Updated the README. Thanks Mark Lee.

    Paul Davis committed May 11, 2009
  2. Updates to the build system.

    Linking against the library works, but importing spidermonkey kills the Python
    VM because of an unresolved symbol. Can't figure out if this is just OS X's
    build of libmozjs or if I'm missing a flag.
    Paul Davis committed May 11, 2009
Commits on May 11, 2009
  1. Minor fixes.

    Forgot to comment out a hack for OS X.
    Missed a pointer cast to avoid compiler warnings.
    Thanks to spahl for both.
    Paul Davis committed May 11, 2009
  2. Version number bump.

    Paul Davis committed May 11, 2009
  3. Change exception types for resource exhaustion.

    Out of memory is now signaled by a MemoryError
    Too much CPU time is reported as a SystemError
    I'm going to punt on the issue with specifying memory usage limits on contexts
    when it really refernces the runtime. I don't see a good way to implement it
    without quite a bit of work. It'll never be specifiable per context, only the
    api might change to avoid confusion.
    [#12 state:resolved]
    Paul Davis committed May 11, 2009
  4. API for limiting resource usage.

    You can now enforce crude resource usage limits for scripts executing in the JS
    VM. Its not overly granular and has some caveats, but it appears to work.
    To limit the time a script can run:
        >>> rt = spidermonkey.Runtime()
        >>> cx = rt.new_context()
        >>> cx.max_time(5) # Specified in seconds, returns the previous value.
        >>> cx.execute("while(true) {}")
    To limit the amount of memory is similar:
        >>> rt = spidermonkey.Runtime()
        >>> cx = rt.new_context()
        >>> cx.max_memory(10000) # Specified in bytes, returns the previous value.
        >>> cx.execute("var f = []; var b = 100000; while(b-- > 0) f.push(b*0.9)")
    At the moment this looks like its limiting resources per context when in reality
    its per runtime. So if you limit to usage on a context, and some other script in
    the context is running above that limit, the limited context will fail.
    You can also get the current values without setting:
        >>> cx.max_time(10)
        >>> cx.max_time()
        >>> cx.max_memory(10000)
        >>> cx.max_memory()
    Some minor tweaks to make the memory limit specified on the Runtime and to
    improve the reported errors to follow shortly.
    Paul Davis committed May 11, 2009
Commits on May 10, 2009
  1. Support for global property handlers.

    If you want to be able to global properties using some sort of active logic you
    can now pass an object that has __getitem__ and __setitem__ defined to
    Runtime.new_context(). Something like:
        >>> rt = spidermonkey.Runtime()
        >>> cx = rt.new_context({"foo": "bar"})
        >>> cx.execute("foo;")
    [#9 state:resolved]
    Paul Davis committed May 10, 2009
  2. Add JS_[Begin|End]Request semantics.

    This should wrap entries into the JS VM in JS_BeginRequest/JS_EndRequest calls.
    I've added a debug flag to build spidermonkey in debug mode so that
    calls into the VM requiring a request fail on an assert. To build in debug mode
    you can do:
        python --debug $(ACTION)
    I basically went through and added the calls where I thought they should go and
    then turned on the debug build to get the ones I missed. Its quite possible I
    still have some edge cases missing their required calls.
    [#2 state:resolved]
    Paul Davis committed May 10, 2009
  3. Removing cruft debugging statements.

    Paul Davis committed May 9, 2009
  4. 'for each' iteration support in JavaScript.

    Added the 'for each(var v in obj)' semantics to iteration.
    [#1 state:resolved]
    Paul Davis committed May 9, 2009
  5. Update for building on FreeBSD

    Thanks sk89q for the patch.
    [#13 state:resolved]
    Paul Davis committed May 9, 2009
  6. Merge branch 'jsiters'

    Paul Davis committed May 9, 2009
  7. Iteration over JavaSript objects in Python.

    You can now do the 'for val in obj' syntax when obj is a wrapped JavaScript
    Thanks Mark Lee for the patch showing how to do this for arrays.
    [#10 state:resolved]
    Paul Davis committed May 9, 2009
  8. Initial JS iteration of Python objects.

    This passes the basic tests. I need to add a check to detect if we're doing 'for
    v in obj' vs 'for each (v in obj)' iteration as they behave differently in
    Paul Davis committed with Paul Davis May 9, 2009