Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2814)

Unified Diff: sky/framework/xmlhttprequest.sky

Issue 688413005: Convert the directory listing to run on top of the platform (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/framework/xmlhttprequest.sky
diff --git a/sky/framework/xmlhttprequest.sky b/sky/framework/xmlhttprequest.sky
index 724c9d2842d35694c3b67e80e8918a212d9fe4b8..34caefc21e2d9de95bbc2298d1600e2ac1d5c971 100644
--- a/sky/framework/xmlhttprequest.sky
+++ b/sky/framework/xmlhttprequest.sky
@@ -10,6 +10,7 @@ function XMLHttpRequest() {
this.request_ = null;
this.loader_ = null;
this.responseText = null;
+ this.headers_ = new Map();
};
XMLHttpRequest.prototype.onload = function() { };
@@ -20,9 +21,20 @@ XMLHttpRequest.prototype.open = function(method, url) {
this.request_.url = url;
this.request_.method = method;
this.request_.auto_follow_redirects = true;
+ this.headers_.clear();
+};
+
+XMLHttpRequest.prototype.setRequestHeader = function(header, value) {
+ this.headers_.set(header, value);
};
XMLHttpRequest.prototype.send = function() {
+ var requestHeaders = [];
+ this.headers_.forEach(function(value, key) {
+ requestHeaders.push(key + ': ' + value);
+ });
+ this.request_.headers = requestHeaders;
+
// FIXME: Factor this into the JS bindings.
var pipe = new core.createMessagePipe();
this.networkService_.createURLLoader(pipe.handle1);

Powered by Google App Engine
This is Rietveld 408576698