OLD | NEW |
---|---|
1 // This goes before everything else to keep console message line number invarian t. | 1 // This goes before everything else to keep console message line number invarian t. |
2 var lastXHRIndex = 0; | 2 var lastXHRIndex = 0; |
3 function xhrLoadedCallback() | 3 function xhrLoadedCallback() |
4 { | 4 { |
5 // We need to make sure the console message text is unique so that we don't end up with repeat count update only. | 5 // We need to make sure the console message text is unique so that we don't end up with repeat count update only. |
6 console.log("XHR loaded: " + (++lastXHRIndex)); | 6 console.log("XHR loaded: " + (++lastXHRIndex)); |
7 } | 7 } |
8 | 8 |
9 var initialize_NetworkTest = function() { | 9 var initialize_NetworkTest = function() { |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 var xhr = new XMLHttpRequest(); | 84 var xhr = new XMLHttpRequest(); |
85 xhr.responseType = type; | 85 xhr.responseType = type; |
86 xhr.onreadystatechange = function() | 86 xhr.onreadystatechange = function() |
87 { | 87 { |
88 if (xhr.readyState === XMLHttpRequest.DONE) { | 88 if (xhr.readyState === XMLHttpRequest.DONE) { |
89 if (typeof(callback) === "function") | 89 if (typeof(callback) === "function") |
90 callback(); | 90 callback(); |
91 } | 91 } |
92 } | 92 } |
93 xhr.open(method, url, async, user, password); | 93 xhr.open(method, url, async, user, password); |
94 xhr.withCredentials = withCredentials; | 94 if (async) |
tyoshino (SeeGerritForStatus)
2014/06/17 02:19:49
I think we should catch bad combination of argumen
tyoshino (SeeGerritForStatus)
2014/06/19 08:31:13
Reminder. (it's ok to skip it as it was drive-by c
| |
95 xhr.withCredentials = withCredentials; | |
95 for (var i = 0; i < headers.length; ++i) | 96 for (var i = 0; i < headers.length; ++i) |
96 xhr.setRequestHeader(headers[i][0], headers[i][1]); | 97 xhr.setRequestHeader(headers[i][0], headers[i][1]); |
97 xhr.send(payload); | 98 xhr.send(payload); |
98 } | 99 } |
99 | 100 |
100 function makeXHRForJSONArguments(jsonArgs) | 101 function makeXHRForJSONArguments(jsonArgs) |
101 { | 102 { |
102 var args = JSON.parse(jsonArgs); | 103 var args = JSON.parse(jsonArgs); |
103 makeXHR(args.method, args.url, args.async, args.user, args.password, args.he aders || [], args.withCredentials, args.payload, args.type, xhrLoadedCallback); | 104 makeXHR(args.method, args.url, args.async, args.user, args.password, args.he aders || [], args.withCredentials, args.payload, args.type, xhrLoadedCallback); |
104 } | 105 } |
105 | 106 |
106 | 107 |
107 function resetInspectorResourcesData() | 108 function resetInspectorResourcesData() |
108 { | 109 { |
109 if (!window.internals) | 110 if (!window.internals) |
110 return false; | 111 return false; |
111 | 112 |
112 internals.setInspectorResourcesDataSizeLimits(10 * 1000 * 1000, 1000 * 1000) ; | 113 internals.setInspectorResourcesDataSizeLimits(10 * 1000 * 1000, 1000 * 1000) ; |
113 return true; | 114 return true; |
114 } | 115 } |
115 | 116 |
OLD | NEW |