Title: [90416] trunk/Tools
Revision
90416
Author
[email protected]
Date
2011-07-05 16:56:41 -0700 (Tue, 05 Jul 2011)

Log Message

2011-07-05  Adam Barth  <[email protected]>

        TestResultServer should support callback parameter for JSON
        https://bugs.webkit.org/show_bug.cgi?id=63961

        Reviewed by Ojan Vafai.

        This makes using jQuery.ajax so much more pleasant.

        * TestResultServer/handlers/testfilehandler.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (90415 => 90416)


--- trunk/Tools/ChangeLog	2011-07-05 23:55:45 UTC (rev 90415)
+++ trunk/Tools/ChangeLog	2011-07-05 23:56:41 UTC (rev 90416)
@@ -1,3 +1,14 @@
+2011-07-05  Adam Barth  <[email protected]>
+
+        TestResultServer should support callback parameter for JSON
+        https://bugs.webkit.org/show_bug.cgi?id=63961
+
+        Reviewed by Ojan Vafai.
+
+        This makes using jQuery.ajax so much more pleasant.
+
+        * TestResultServer/handlers/testfilehandler.py:
+
 2011-07-05  Eric Seidel  <[email protected]>
 
         buildbot needs to understand whether NRWT exited early after having too many failures

Modified: trunk/Tools/TestResultServer/handlers/testfilehandler.py (90415 => 90416)


--- trunk/Tools/TestResultServer/handlers/testfilehandler.py	2011-07-05 23:55:45 UTC (rev 90415)
+++ trunk/Tools/TestResultServer/handlers/testfilehandler.py	2011-07-05 23:56:41 UTC (rev 90416)
@@ -27,6 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import logging
+import re
 import urllib
 
 from google.appengine.api import users
@@ -45,6 +46,7 @@
 PARAM_TEST_TYPE = "testtype"
 PARAM_INCREMENTAL = "incremental"
 PARAM_TEST_LIST_JSON = "testlistjson"
+PARAM_CALLBACK = "callback"
 
 
 class DeleteFile(webapp.RequestHandler):
@@ -139,6 +141,7 @@
         name = self.request.get(PARAM_NAME)
         dir = self.request.get(PARAM_DIR)
         test_list_json = self.request.get(PARAM_TEST_LIST_JSON)
+        callback_name = self.request.get(PARAM_CALLBACK)
 
         logging.debug(
             "Getting files, master %s, builder: %s, test_type: %s, name: %s.",
@@ -155,8 +158,11 @@
         else:
             json = self._get_file_content(master, builder, test_type, name)
 
+        if callback_name and re.search(r"^[A-Za-z_]+$", callback_name):
+            json = re.sub(r"^[A-Za-z_]+[(]", callback_name + "(", json)
+
         if json:
-            self.response.headers["Content-Type"] = "text/plain; charset=utf-8"
+            self.response.headers["Content-Type"] = "application/json"
             self.response.out.write(json)
         else:
             self.error(404)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to