Client-side support for the original DiskDump API is finally limping along

This commit is contained in:
Jeff Parsons 2016-02-22 17:38:57 -08:00
commit 3dd7512f4f
33 changed files with 1334 additions and 1054 deletions

View file

@ -290,12 +290,14 @@ Component.log = function(s, type)
{
if (DEBUG) {
if (s) {
var msElapsed, sMsg = (type? (type + ": ") : "") + s;
if (Component.msStart === undefined) {
Component.msStart = usr.getTime();
var sElapsed = "", sMsg = (type? (type + ": ") : "") + s;
if (typeof usr != "undefined") {
if (Component.msStart === undefined) {
Component.msStart = usr.getTime();
}
sElapsed = (usr.getTime() - Component.msStart) + "ms: ";
}
msElapsed = usr.getTime() - Component.msStart;
if (window && window.console) console.log(msElapsed + "ms: " + sMsg.replace(/\n/g, " "));
if (window && window.console) console.log(sElapsed + sMsg.replace(/\n/g, " "));
}
}
};
@ -749,6 +751,7 @@ Component.prototype = {
*
* TODO: Add a task to the build process that "asserts" there are no instances of "assertion failure" in RELEASE builds.
*
* @this {Component}
* @param {boolean} f is the expression we are asserting to be true
* @param {string} [s] is description of the assertion on failure
*/

View file

@ -175,8 +175,16 @@ web.notice = function(s, fPrintOnly, id)
*
* Request the specified resource (sURL), and once the request is complete, notify done().
*
* Also, if dataPost is set to a string, that string can be used to control the response format;
* by default, the response format is plain text, but you can specify "bytes" to request arbitrary
* binary data, which should come back as a string of bytes.
*
* TODO: The "bytes" option works by calling overrideMimeType(), which was never a best practice.
* Instead, we should implement supported response types ("text" and "arraybuffer", at a minimum)
* by setting xmlHTTP.responseType to one of those values before calling xmlHTTP.send().
*
* @param {string} sURL
* @param {Object|null} [dataPost] for a POST request (default is a GET request)
* @param {string|Object|null} [dataPost] for a POST request (default is a GET request)
* @param {boolean} [fAsync] is true for an asynchronous request
* @param {function(string,string,number)} [done]
* @return {Array|null} Array containing [sResource, nErrorCode], or null if no response yet
@ -231,7 +239,7 @@ web.getResource = function(sURL, dataPost, fAsync, done)
};
}
if (dataPost) {
if (typeof dataPost == "object") {
var sDataPost = "";
for (var p in dataPost) {
if (!dataPost.hasOwnProperty(p)) continue;
@ -246,6 +254,9 @@ web.getResource = function(sURL, dataPost, fAsync, done)
} else {
if (MAXDEBUG) web.log("web.getResource(GET " + sURL + ")");
xmlHTTP.open("GET", sURL, !!fAsync); // ensure that fAsync is a valid boolean (Internet Explorer xmlHTTP functions insist on it)
if (dataPost == "bytes") {
xmlHTTP.overrideMimeType("text/plain; charset=x-user-defined");
}
xmlHTTP.send();
}