Changeset 90416 in webkit


Ignore:
Timestamp:
Jul 5, 2011 4:56:41 PM (13 years ago)
Author:
abarth@webkit.org
Message:

2011-07-05 Adam Barth <abarth@webkit.org>

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:
Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r90413 r90416  
     12011-07-05  Adam Barth  <abarth@webkit.org>
     2
     3        TestResultServer should support callback parameter for JSON
     4        https://bugs.webkit.org/show_bug.cgi?id=63961
     5
     6        Reviewed by Ojan Vafai.
     7
     8        This makes using jQuery.ajax so much more pleasant.
     9
     10        * TestResultServer/handlers/testfilehandler.py:
     11
    1122011-07-05  Eric Seidel  <eric@webkit.org>
    213
  • trunk/Tools/TestResultServer/handlers/testfilehandler.py

    r73409 r90416  
    2828
    2929import logging
     30import re
    3031import urllib
    3132
     
    4647PARAM_INCREMENTAL = "incremental"
    4748PARAM_TEST_LIST_JSON = "testlistjson"
     49PARAM_CALLBACK = "callback"
    4850
    4951
     
    140142        dir = self.request.get(PARAM_DIR)
    141143        test_list_json = self.request.get(PARAM_TEST_LIST_JSON)
     144        callback_name = self.request.get(PARAM_CALLBACK)
    142145
    143146        logging.debug(
     
    156159            json = self._get_file_content(master, builder, test_type, name)
    157160
     161        if callback_name and re.search(r"^[A-Za-z_]+$", callback_name):
     162            json = re.sub(r"^[A-Za-z_]+[(]", callback_name + "(", json)
     163
    158164        if json:
    159             self.response.headers["Content-Type"] = "text/plain; charset=utf-8"
     165            self.response.headers["Content-Type"] = "application/json"
    160166            self.response.out.write(json)
    161167        else:
Note: See TracChangeset for help on using the changeset viewer.