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

Unified Diff: client/dom/templates/html/frog/factoryprovider_XMLHttpRequest.darttemplate

Issue 9464002: Implement automatically generated constructors for frog and dartium dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rerun script Created 8 years, 10 months 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: client/dom/templates/html/frog/factoryprovider_XMLHttpRequest.darttemplate
diff --git a/client/dom/templates/html/frog/factoryprovider_XMLHttpRequest.darttemplate b/client/dom/templates/html/frog/factoryprovider_XMLHttpRequest.darttemplate
new file mode 100644
index 0000000000000000000000000000000000000000..be37cee744de6a804ea8df3e1c6c2e1010f3a7d0
--- /dev/null
+++ b/client/dom/templates/html/frog/factoryprovider_XMLHttpRequest.darttemplate
@@ -0,0 +1,26 @@
+
+class _XMLHttpRequestFactoryProvider {
+ factory XMLHttpRequest() native 'return new XMLHttpRequest();';
+
+ factory XMLHttpRequest.getTEMPNAME(String url,
+ onSuccess(XMLHttpRequest request)) {
+ final request = new XMLHttpRequest();
+ request.open('GET', url, true);
+
+ // TODO(terry): Validate after client login added if necessary to forward
+ // cookies to server.
+ request.withCredentials = true;
+
+ // Status 0 is for local XHR request.
+ request.on.readyStateChange.add((e) {
+ if (request.readyState == XMLHttpRequest.DONE &&
+ (request.status == 200 || request.status == 0)) {
+ onSuccess(request);
+ }
+ });
+
+ request.send();
+
+ return request;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698