(url, type, callback, errback)
| 6652 | } |
| 6653 | |
| 6654 | function doXHR(url, type, callback, errback) { |
| 6655 | var xhr = getXMLHttpRequest(); |
| 6656 | var async = isFileProtocol ? less.fileAsync : less.async; |
| 6657 | |
| 6658 | if (typeof(xhr.overrideMimeType) === 'function') { |
| 6659 | xhr.overrideMimeType('text/css'); |
| 6660 | } |
| 6661 | log("XHR: Getting '" + url + "'", logLevel.info); |
| 6662 | xhr.open('GET', url, async); |
| 6663 | xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5'); |
| 6664 | xhr.send(null); |
| 6665 | |
| 6666 | function handleResponse(xhr, callback, errback) { |
| 6667 | if (xhr.status >= 200 && xhr.status < 300) { |
| 6668 | callback(xhr.responseText, |
| 6669 | xhr.getResponseHeader("Last-Modified")); |
| 6670 | } else if (typeof(errback) === 'function') { |
| 6671 | errback(xhr.status, url); |
| 6672 | } |
| 6673 | } |
| 6674 | |
| 6675 | if (isFileProtocol && !less.fileAsync) { |
| 6676 | if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) { |
| 6677 | callback(xhr.responseText); |
| 6678 | } else { |
| 6679 | errback(xhr.status, url); |
| 6680 | } |
| 6681 | } else if (async) { |
| 6682 | xhr.onreadystatechange = function () { |
| 6683 | if (xhr.readyState == 4) { |
| 6684 | handleResponse(xhr, callback, errback); |
| 6685 | } |
| 6686 | }; |
| 6687 | } else { |
| 6688 | handleResponse(xhr, callback, errback); |
| 6689 | } |
| 6690 | } |
| 6691 | |
| 6692 | function loadFile(originalHref, currentFileInfo, callback, env, newVars) { |
| 6693 |
no test coverage detected