[pypy-svn] r31743 - pypy/dist/pypy/translator/js

fijal at codespeak.net fijal at codespeak.net
Sun Aug 27 19:18:37 CEST 2006


Author: fijal
Date: Sun Aug 27 19:18:35 2006
New Revision: 31743

Modified:
   pypy/dist/pypy/translator/js/commproxy.py
Log:
Fixed race conditions when not using Mochikit.


Modified: pypy/dist/pypy/translator/js/commproxy.py
==============================================================================
--- pypy/dist/pypy/translator/js/commproxy.py	(original)
+++ pypy/dist/pypy/translator/js/commproxy.py	Sun Aug 27 19:18:35 2006
@@ -9,7 +9,7 @@
 METHOD_BODY = """
 %(class)s.prototype.%(method)s = function ( %(args)s ) {
     var data,str;
-    x = new XMLHttpRequest();
+    var x = new XMLHttpRequest();
     data = %(data)s;
     str = ""
     for(i in data) {
@@ -25,7 +25,7 @@
     //logDebug('%(call)s'+str);
     x.open("GET", '%(call)s' + str, true);
     //x.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
-    x.onreadystatechange = function () { %(real_callback)s(callback) };
+    x.onreadystatechange = function () { %(real_callback)s(x, callback) };
     //x.setRequestHeader("Connection", "close");
     //x.send(data);
     x.send(null);
@@ -33,7 +33,7 @@
 """
 
 CALLBACK_BODY = """
-function %(real_callback)s (cb) {
+function %(real_callback)s (x, cb) {
    var d;
    if (x.readyState == 4) {
       if (x.responseText) {



More information about the Pypy-commit mailing list