Demonstration of C1Pjs loading and running *without* a web server

file:///pcjs/configs/c1p/machines/8kb/large/debugger/demo.html (your root directory may vary)
This commit is contained in:
Jeff Parsons 2014-10-29 16:41:32 -07:00 committed by jeffpar
commit f2e092e57c
10 changed files with 408 additions and 317 deletions

View file

@ -180,10 +180,14 @@ web.loadResource = function(sURL, fAsync, data, componentNotify, fnNotify, pNoti
* pending, any debugging activity means most of them simply get dropped on floor, so what may actually be
* happening are mis-notifications rather than redundant notifications.
*
xmlHTTP.onreadystatechange = undefined;
* xmlHTTP.onreadystatechange = undefined;
*/
sURLData = xmlHTTP.responseText;
if (xmlHTTP.status == 200) {
/*
* The normal "success" case is an HTTP status code of 200, but when testing with files loaded
* from the local file system (ie, when using the "file:" protocol), we have to be a bit more "flexible".
*/
if (xmlHTTP.status == 200 || !xmlHTTP.status && sURLData.length && web.getHostProtocol() == "file:") {
Component.log("xmlHTTP.onreadystatechange(" + sURL + "): returned " + sURLData.length + " bytes");
}
else {
@ -284,6 +288,16 @@ web.getHostURL = function()
return (window? window.location.href : null);
};
/**
* getHostProtocol()
*
* @return {string}
*/
web.getHostProtocol = function()
{
return (window? window.location.protocol : "file:");
};
/**
* getUserAgent()
*