Fix jsonp callback code to add the callback if json content
authorojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 20 Nov 2011 02:09:19 +0000 (02:09 +0000)
committerojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 20 Nov 2011 02:09:19 +0000 (02:09 +0000)
is not jsonp.
* TestResultServer/handlers/testfilehandler.py:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@100865 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/TestResultServer/handlers/testfilehandler.py

index 47d931e34fa9f6e26ce942c0d98beb0016e280cc..03799d054d1de153c3fa9c367e6903417faa87be 100644 (file)
@@ -1,3 +1,9 @@
+2011-11-19  Ojan Vafai  <ojan@chromium.org>
+
+        Fix jsonp callback code to add the callback if json content
+        is not jsonp.
+        * TestResultServer/handlers/testfilehandler.py:
+
 2011-11-19  Alice Boxhall  <aboxhall@chromium.org>
 
         Modify dashboard_base.js to optionally accept version 4 results json.
index 391f323980ac42cb6f56e21c7f86b87cda7e4735..16c16b3e8564b1eb50d018a718519d03b4763d94 100644 (file)
@@ -52,7 +52,10 @@ PARAM_CALLBACK = "callback"
 
 def _replace_jsonp_callback(json, callback_name):
     if callback_name and re.search(r"^[A-Za-z0-9_]+$", callback_name):
-        json = re.sub(r"^[A-Za-z0-9_]+[(]", callback_name + "(", json)
+        if re.search(r"^[A-Za-z0-9_]+[(]", json):
+            return re.sub(r"^[A-Za-z0-9_]+[(]", callback_name + "(", json)
+        return callback_name + "(" + json + ")"
+
     return json