upgrade rhino to 1.7R3, delete es5-shim, use latest JS version

This commit is contained in:
Jan Sabbe 2011-08-26 20:54:55 +02:00
parent 280122cee3
commit e85ac3fe1d
5 changed files with 6 additions and 20 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@ eclipsecompiled
.classpath
.project
.settings
*.iml
.idea

View File

@ -11,9 +11,9 @@
<dependencies>
<dependency>
<groupId>rhino</groupId>
<artifactId>js</artifactId>
<version>1.7R2</version>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7R3</version>
</dependency>
<dependency>
<groupId>junit</groupId>

View File

@ -108,9 +108,6 @@ public class RhinoContext {
}
public void loadEnv(String jsDir) {
// TODO ensure rhino 1.7R3 instead of R2 -> geen shim nodig + paths
// gedoe in orde zetten hier
load(jsDir + "/lib/es5-shim-0.0.4.min.js");
load(jsDir + "/lib/env.rhino.1.2.js");
load(jsDir + "/lib/env.utils.js");
load(jsDir + "/envJsOptions.js");
@ -125,7 +122,7 @@ public class RhinoContext {
private Context createJavascriptContext() {
Context jsContext = ContextFactory.getGlobal().enterContext();
jsContext.setOptimizationLevel(-1);
jsContext.setLanguageVersion(Context.VERSION_1_5); // TODO 1.8 plx
jsContext.setLanguageVersion(Context.VERSION_1_8);
jsContext.setErrorReporter(new ChainedErrorReporter(jsContext.getErrorReporter()));
return jsContext;
}

View File

@ -1,13 +0,0 @@
(function(){var j=Object.prototype.hasOwnProperty;if(!Array.isArray)Array.isArray=function(a){return Object.prototype.toString.call(a)=="[object Array]"};if(!Array.prototype.forEach)Array.prototype.forEach=function(a,c){for(var b=this.length>>>0,d=0;d<b;d++)d in this&&a.call(c,this[d],d,this)};if(!Array.prototype.map)Array.prototype.map=function(a,c){var b=this.length>>>0;if(typeof a!="function")throw new TypeError;for(var d=Array(b),e=0;e<b;e++)if(e in this)d[e]=a.call(c,this[e],e,this);return d};
if(!Array.prototype.filter)Array.prototype.filter=function(a,c){for(var b=[],d=0;d<this.length;d++)a.call(c,this[d])&&b.push(this[d]);return b};if(!Array.prototype.every)Array.prototype.every=function(a,c){for(var b=0;b<this.length;b++)if(!a.call(c,this[b]))return false;return true};if(!Array.prototype.some)Array.prototype.some=function(a,c){for(var b=0;b<this.length;b++)if(a.call(c,this[b]))return true;return false};if(!Array.prototype.reduce)Array.prototype.reduce=function(a){var c=this.length>>>
0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var b=0;if(arguments.length>=2)var d=arguments[1];else{do{if(b in this){d=this[b++];break}if(++b>=c)throw new TypeError;}while(1)}for(;b<c;b++)if(b in this)d=a.call(null,d,this[b],b,this);return d};if(!Array.prototype.reduceRight)Array.prototype.reduceRight=function(a){var c=this.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;c=c-1;if(arguments.length>=
2)var b=arguments[1];else{do{if(c in this){b=this[c--];break}if(--c<0)throw new TypeError;}while(1)}for(;c>=0;c--)if(c in this)b=a.call(null,b,this[c],c,this);return b};if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a,c){var b=this.length;if(!b)return-1;var d=c||0;if(d>=b)return-1;if(d<0)d+=b;for(;d<b;d++)if(j.call(this,d))if(a===this[d])return d;return-1};if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(a,c){var b=this.length;if(!b)return-1;var d=c||b;if(d<0)d+=
b;for(d=Math.min(d,b-1);d>=0;d--)if(j.call(this,d))if(a===this[d])return d;return-1};if(!Object.getPrototypeOf)Object.getPrototypeOf=function(a){return a.__proto__||a.constructor.prototype};if(!Object.getOwnPropertyDescriptor)Object.getOwnPropertyDescriptor=function(){return{}};if(!Object.getOwnPropertyNames)Object.getOwnPropertyNames=function(a){return Object.keys(a)};if(!Object.create)Object.create=function(a,c){var b;if(a===null)b={__proto__:null};else{if(typeof a!="object")throw new TypeError("typeof prototype["+
typeof a+"] != 'object'");b=function(){};b.prototype=a;b=new b}typeof c!=="undefined"&&Object.defineProperties(b,c);return b};if(!Object.defineProperty)Object.defineProperty=function(a,c,b){if(typeof b=="object"&&a.__defineGetter__){if(j.call(b,"value")){if(!a.__lookupGetter__(c)&&!a.__lookupSetter__(c))a[c]=b.value;if(j.call(b,"get")||j.call(b,"set"))throw new TypeError("Object doesn't support this action");}else typeof b.get=="function"&&a.__defineGetter__(c,b.get);typeof b.set=="function"&&a.__defineSetter__(c,
b.set)}return a};if(!Object.defineProperties)Object.defineProperties=function(a,c){for(var b in c)j.call(c,b)&&Object.defineProperty(a,b,c[b]);return a};if(!Object.seal)Object.seal=function(a){return a};if(!Object.freeze)Object.freeze=function(a){return a};try{Object.freeze(function(){})}catch(u){Object.freeze=function(a){return function(c){return typeof c=="function"?c:a(c)}}(Object.freeze)}if(!Object.preventExtensions)Object.preventExtensions=function(a){return a};if(!Object.isSealed)Object.isSealed=
function(){return false};if(!Object.isFrozen)Object.isFrozen=function(){return false};if(!Object.isExtensible)Object.isExtensible=function(){return true};if(!Object.keys){var m=true,n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],p=n.length,q;for(q in{toString:null})m=false;Object.keys=function(a){if(typeof a!=="object"&&typeof a!=="function"||a===null)throw new TypeError("Object.keys called on a non-object");var c=[],b;for(b in a)j.call(a,
b)&&c.push(b);if(m)for(b=0;b<p;b++){var d=n[b];j.call(a,d)&&c.push(d)}return c}}if(!Date.prototype.toISOString)Date.prototype.toISOString=function(){return this.getFullYear()+"-"+(this.getMonth()+1)+"-"+this.getDate()+"T"+this.getHours()+":"+this.getMinutes()+":"+this.getSeconds()+"Z"};if(!Date.now)Date.now=function(){return(new Date).getTime()};if(!Date.prototype.toJSON)Date.prototype.toJSON=function(){if(typeof this.toISOString!="function")throw new TypeError;return this.toISOString()};if(isNaN(Date.parse("T00:00")))Date=
function(a){var c=function(e,f,h,g,k,o,r){var i=arguments.length;if(this instanceof a){i=i===1&&String(e)===e?new a(c.parse(e)):i>=7?new a(e,f,h,g,k,o,r):i>=6?new a(e,f,h,g,k,o):i>=5?new a(e,f,h,g,k):i>=4?new a(e,f,h,g):i>=3?new a(e,f,h):i>=2?new a(e,f):i>=1?new a(e):new a;i.constructor=c;return i}return a.apply(this,arguments)},b=RegExp("^(?:((?:[+-]\\d\\d)?\\d\\d\\d\\d)(?:-(\\d\\d)(?:-(\\d\\d))?)?)?(?:T(\\d\\d):(\\d\\d)(?::(\\d\\d)(?:\\.(\\d\\d\\d))?)?)?(?:Z|([+-])(\\d\\d):(\\d\\d))?$"),d;for(d in a)c[d]=
a[d];c.now=a.now;c.UTC=a.UTC;c.prototype=a.prototype;c.prototype.constructor=c;c.parse=function(e){var f=b.exec(e);if(f){f.shift();for(var h=f[0]===undefined,g=0;g<10;g++)if(g!==7){f[g]=+(f[g]||(g<3?1:0));g===1&&f[g]--}if(h)return((f[3]*60+f[4])*60+f[5])*1E3+f[6];h=(f[8]*60+f[9])*60*1E3;if(f[6]==="-")h=-h;return a.UTC.apply(this,f.slice(0,7))+h}return a.parse.apply(this,arguments)};return c}(Date);var l=Array.prototype.slice;if(!Function.prototype.bind)Function.prototype.bind=function(a){var c=this;
if(typeof c.apply!="function"||typeof c.call!="function")return new TypeError;var b=l.call(arguments),d=function(){if(this instanceof d){var e=Object.create(c.prototype);c.apply(e,b.concat(l.call(arguments)));return e}else return c.call.apply(c,b.concat(l.call(arguments)))};d.bound=c;d.boundTo=a;d.boundArgs=b;d.length=typeof c=="function"?Math.max(c.length-b.length,0):0;return d};if(!String.prototype.trim){var s=/^\s\s*/,t=/\s\s*$/;String.prototype.trim=function(){return String(this).replace(s,"").replace(t,
"")}}})();