Title: [92707] trunk/Tools
- Revision
- 92707
- Author
- [email protected]
- Date
- 2011-08-09 14:17:42 -0700 (Tue, 09 Aug 2011)
Log Message
Enable CORS for garden-o-matic
https://bugs.webkit.org/show_bug.cgi?id=65936
Reviewed by Dimitri Glazkov.
This patch will allow the hosted instance of garden-o-matic to
communicate with the local server.
* Scripts/webkitpy/tool/servers/gardeningserver.py:
* Scripts/webkitpy/tool/servers/reflectionhandler.py:
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (92706 => 92707)
--- trunk/Tools/ChangeLog 2011-08-09 20:46:17 UTC (rev 92706)
+++ trunk/Tools/ChangeLog 2011-08-09 21:17:42 UTC (rev 92707)
@@ -1,5 +1,18 @@
2011-08-09 Adam Barth <[email protected]>
+ Enable CORS for garden-o-matic
+ https://bugs.webkit.org/show_bug.cgi?id=65936
+
+ Reviewed by Dimitri Glazkov.
+
+ This patch will allow the hosted instance of garden-o-matic to
+ communicate with the local server.
+
+ * Scripts/webkitpy/tool/servers/gardeningserver.py:
+ * Scripts/webkitpy/tool/servers/reflectionhandler.py:
+
+2011-08-09 Adam Barth <[email protected]>
+
Upgrade jquery in TestFailures
https://bugs.webkit.org/show_bug.cgi?id=65935
Modified: trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py (92706 => 92707)
--- trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py 2011-08-09 20:46:17 UTC (rev 92706)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py 2011-08-09 21:17:42 UTC (rev 92707)
@@ -103,6 +103,8 @@
"public_html",
"TestFailures")
+ allow_cross_origin_requests = True
+
def _run_webkit_patch(self, args):
return self.server.tool.executive.run_command([self.server.tool.path()] + args, cwd=self.server.tool.scm().checkout_root)
Modified: trunk/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py (92706 => 92707)
--- trunk/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py 2011-08-09 20:46:17 UTC (rev 92706)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py 2011-08-09 21:17:42 UTC (rev 92707)
@@ -55,6 +55,11 @@
STATIC_FILE_NAMES = None
STATIC_FILE_DIRECTORY = None
+ # Setting this flag to True causes the server to send
+ # Access-Control-Allow-Origin: *
+ # with every response.
+ allow_cross_origin_requests = False
+
def do_GET(self):
self._handle_request()
@@ -100,14 +105,20 @@
# otherwise there's a deadlock
threading.Thread(target=lambda: self.server.shutdown()).start()
+ def _send_access_control_header(self):
+ if self.allow_cross_origin_requests:
+ self.send_header('Access-Control-Allow-Origin', '*')
+
def _serve_text(self, text):
self.send_response(200)
+ self._send_access_control_header()
self.send_header("Content-type", "text/plain")
self.end_headers()
self.wfile.write(text)
def _serve_json(self, json_object):
self.send_response(200)
+ self._send_access_control_header()
self.send_header('Content-type', 'application/json')
self.end_headers()
json.dump(json_object, self.wfile)
@@ -118,6 +129,7 @@
return
with codecs.open(file_path, "rb") as static_file:
self.send_response(200)
+ self._send_access_control_header()
self.send_header("Content-Length", os.path.getsize(file_path))
mime_type, encoding = mimetypes.guess_type(file_path)
if mime_type:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes