Use hasOwnProperty() when checking file specification object (prevents problems when Object.prototype has been modified). Resolves issue #352.

This commit is contained in:
Davide P. Cervone 2012-11-27 14:36:53 -05:00
parent d2bbe75499
commit 9f1f495fb7
2 changed files with 14 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -30,7 +30,7 @@ if (!window.MathJax) {window.MathJax= {}}
if (!MathJax.Hub) { // skip if already loaded
MathJax.version = "2.1";
MathJax.fileversion = "2.1";
MathJax.fileversion = "2.1.1";
/**********************************************************/
@ -650,8 +650,10 @@ MathJax.fileversion = "2.1";
//
Require: function (file,callback) {
callback = BASE.Callback(callback); var type;
if (file instanceof Object) {for (var i in file) {}; type = i.toUpperCase(); file = file[i]}
else {type = file.split(/\./).pop().toUpperCase()}
if (file instanceof Object) {
for (var i in file)
{if (file.hasOwnProperty(i)) {type = i.toUpperCase(); file = file[i]}}
} else {type = file.split(/\./).pop().toUpperCase()}
file = this.fileURL(file);
// FIXME: check that URL is OK
if (this.loaded[file]) {
@ -669,8 +671,10 @@ MathJax.fileversion = "2.1";
//
Load: function (file,callback) {
callback = BASE.Callback(callback); var type;
if (file instanceof Object) {for (var i in file) {}; type = i.toUpperCase(); file = file[i]}
else {type = file.split(/\./).pop().toUpperCase()}
if (file instanceof Object) {
for (var i in file)
{if (file.hasOwnProperty(i)) {type = i.toUpperCase(); file = file[i]}}
} else {type = file.split(/\./).pop().toUpperCase()}
file = this.fileURL(file);
if (this.loading[file]) {
this.addHook(file,callback);
@ -688,7 +692,8 @@ MathJax.fileversion = "2.1";
//
LoadHook: function (file,callback,priority) {
callback = BASE.Callback(callback);
if (file instanceof Object) {for (var i in file) {file = file[i]}}
if (file instanceof Object)
{for (var i in file) {if (file.hasOwnProperty(i)) {file = file[i]}}}
file = this.fileURL(file);
if (this.loaded[file]) {callback(this.loaded[file])}
else {this.addHook(file,callback,priority)}