Fail more gracefully on pre-IE9 browsers (still room for improvement though)
This commit is contained in:
parent
d8debb5e3c
commit
fcb7c32909
6 changed files with 43 additions and 9 deletions
|
|
@ -541,8 +541,8 @@ C1PVideo.init = function()
|
|||
* "autocapitalize" work here.
|
||||
*/
|
||||
var eCanvas = window.document.createElement("canvas");
|
||||
if (eCanvas === undefined) {
|
||||
eVideo.innerHTML = "<br/>Missing <canvas> support; try a new web browser.";
|
||||
if (eCanvas === undefined || !eCanvas.getContext) {
|
||||
eVideo.innerHTML = "<br/>Missing <canvas> support. Please try a newer web browser.";
|
||||
return;
|
||||
}
|
||||
eCanvas.setAttribute("class", C1PJSCLASS + "-canvas");
|
||||
|
|
|
|||
|
|
@ -163,6 +163,10 @@ var aMachineFileTypes = {
|
|||
'body': [".js"]
|
||||
};
|
||||
|
||||
/*
|
||||
* Since we have a small server-side optimization that assumes any directory entry without an extension is
|
||||
* a directory, this is a list of known exceptions (ie, entries that are NOT directories despite no extension).
|
||||
*/
|
||||
var asNonDirectories = [
|
||||
"COPYING",
|
||||
"LICENSE",
|
||||
|
|
@ -170,6 +174,9 @@ var asNonDirectories = [
|
|||
"makefile"
|
||||
];
|
||||
|
||||
/*
|
||||
* A list of plain-text file types that we want the server to serve up with mime-type "text/plain".
|
||||
*/
|
||||
var asExtsPlainText = [
|
||||
"65v",
|
||||
"bas",
|
||||
|
|
@ -201,6 +208,7 @@ var asFilesNonListed = [
|
|||
"package.json",
|
||||
"server.js",
|
||||
"index.html",
|
||||
"notes.md",
|
||||
"README.md",
|
||||
"robots.txt",
|
||||
"machine.xml",
|
||||
|
|
|
|||
|
|
@ -1648,7 +1648,7 @@ if (DEBUGGER) {
|
|||
var aEnable = this.parseCommand(sEnable.replace("keys","key").replace("kbd","keyboard"));
|
||||
if (aEnable.length) {
|
||||
for (var m in Debugger.MESSAGES) {
|
||||
if (aEnable.indexOf(m) >= 0) {
|
||||
if (usr.indexOf(aEnable, m) >= 0) {
|
||||
this.bitsMessage |= Debugger.MESSAGES[m];
|
||||
this.println(m + " messages enabled");
|
||||
}
|
||||
|
|
@ -1683,7 +1683,7 @@ if (DEBUGGER) {
|
|||
* @return {number}
|
||||
*/
|
||||
Debugger.prototype.getRegIndex = function(sReg) {
|
||||
return Debugger.REGS.indexOf(sReg.toUpperCase());
|
||||
return usr.indexOf(Debugger.REGS, sReg.toUpperCase());
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2720,8 +2720,12 @@ Video.prototype.onLoadSetFonts = function(sFontFile, sFontData, nErrorCode)
|
|||
}
|
||||
/*
|
||||
* If we're still here, then we're ready!
|
||||
*
|
||||
* UPDATE: Per issue #21, I'm issuing setReady() *only* if a valid contextScreen exists *or* a Debugger is attached.
|
||||
*
|
||||
* TODO: Consider a more general-purpose solution for deciding whether or not the user wants to run in a "headless" mode.
|
||||
*/
|
||||
this.setReady();
|
||||
if (this.contextScreen || this.dbg) this.setReady();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -5197,8 +5201,8 @@ Video.init = function()
|
|||
var parmsVideo = Component.getComponentParms(eVideo);
|
||||
|
||||
var eCanvas = window.document.createElement("canvas");
|
||||
if (eCanvas === undefined) {
|
||||
eVideo.innerHTML = "<br/>Missing <canvas> support; try a new web browser.";
|
||||
if (eCanvas === undefined || !eCanvas.getContext) {
|
||||
eVideo.innerHTML = "<br/>Missing <canvas> support. Please try a newer web browser.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ Component.log = function(s, type)
|
|||
Component.msStart = usr.getTime();
|
||||
}
|
||||
msElapsed = usr.getTime() - Component.msStart;
|
||||
console.log(msElapsed + "ms: " + sMsg.replace(/\n/g, " "));
|
||||
if (window && window.console) console.log(msElapsed + "ms: " + sMsg.replace(/\n/g, " "));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -658,7 +658,7 @@ Component.prototype = {
|
|||
}
|
||||
control.value += s + "\n";
|
||||
control.scrollTop = control.scrollHeight;
|
||||
if (DEBUG) console.log(s);
|
||||
if (DEBUG && window && window.console) console.log(s);
|
||||
};
|
||||
}(control));
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,6 +34,28 @@
|
|||
|
||||
var usr = {};
|
||||
|
||||
/**
|
||||
* indexOf(a, t, i)
|
||||
*
|
||||
* @param {Array} a
|
||||
* @param {*} t
|
||||
* @param {number} [i]
|
||||
* @returns {number}
|
||||
*/
|
||||
usr.indexOf = function(a, t, i)
|
||||
{
|
||||
if (Array.prototype.indexOf) {
|
||||
return a.indexOf(t, i);
|
||||
}
|
||||
i = i || 0;
|
||||
if (i < 0) i += a.length;
|
||||
if (i < 0) i = 0;
|
||||
for (var n = a.length; i < n; i++) {
|
||||
if (i in a && a[i] === t) return i;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
/**
|
||||
* binarySearch(a, v, fnCompare)
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue