()
| 41 | } |
| 42 | |
| 43 | private void initialize() { |
| 44 | |
| 45 | defineReadOnlyGlobalProperty("__throwTypeError", new ThrowTypeError(this), false); |
| 46 | |
| 47 | // ---------------------------------------- |
| 48 | // Built-in types |
| 49 | // ---------------------------------------- |
| 50 | |
| 51 | registerBuiltinType("Object", new BuiltinObject(this)); |
| 52 | |
| 53 | this.objectPrototype = getPrototypeFor("Object"); |
| 54 | this.object.setPrototype(this.objectPrototype); |
| 55 | |
| 56 | registerBuiltinType("Function", new BuiltinFunction(this)); |
| 57 | registerBuiltinType("Boolean", new BuiltinBoolean(this)); |
| 58 | registerBuiltinType("Number", new BuiltinNumber(this)); |
| 59 | registerBuiltinType("Array", new BuiltinArray(this)); |
| 60 | registerBuiltinType("String", new BuiltinString(this)); |
| 61 | registerBuiltinType("RegExp", new BuiltinRegExp(this)); |
| 62 | registerBuiltinType("Date", new BuiltinDate(this)); |
| 63 | registerBuiltinType("Error", new BuiltinError(this)); |
| 64 | registerBuiltinType("ReferenceError", new BuiltinReferenceError(this)); |
| 65 | registerBuiltinType("RangeError", new BuiltinRangeError(this)); |
| 66 | registerBuiltinType("SyntaxError", new BuiltinSyntaxError(this)); |
| 67 | registerBuiltinType("TypeError", new BuiltinTypeError(this)); |
| 68 | registerBuiltinType("URIError", new BuiltinURIError(this)); |
| 69 | registerBuiltinType("EvalError", new BuiltinEvalError(this)); |
| 70 | |
| 71 | if (this.runtime.getConfig().isRhinoCompatible()) { |
| 72 | registerBuiltinType("JSAdapter", new JSAdapter(this)); |
| 73 | } |
| 74 | |
| 75 | if(this.runtime.getConfig().isV8Compatible()) { |
| 76 | defineNonEnumerableProperty(this, "__v8StackGetter", new V8StackGetter(this)); |
| 77 | } |
| 78 | |
| 79 | initializeBuiltinTypes(); |
| 80 | |
| 81 | // ---------------------------------------- |
| 82 | // Built-in global functions |
| 83 | // ---------------------------------------- |
| 84 | |
| 85 | defineReadOnlyGlobalProperty("undefined", Types.UNDEFINED, false); |
| 86 | |
| 87 | defineGlobalProperty("parseFloat", new ParseFloat(this), true); |
| 88 | defineGlobalProperty("parseInt", new ParseInt(this), true); |
| 89 | defineGlobalProperty("eval", new Eval(this), true); |
| 90 | defineGlobalProperty("isNaN", new IsNaN(this), true); |
| 91 | defineGlobalProperty("isFinite", new IsFinite(this), true); |
| 92 | |
| 93 | defineGlobalProperty("encodeURI", new EncodeUri(this), true); |
| 94 | defineGlobalProperty("decodeURI", new DecodeUri(this), true); |
| 95 | defineGlobalProperty("encodeURIComponent", new EncodeUriComponent(this), true); |
| 96 | defineGlobalProperty("decodeURIComponent", new DecodeUriComponent(this), true); |
| 97 | |
| 98 | if (this.runtime.getConfig().isCommonJSCompatible()) { |
| 99 | defineGlobalProperty("require", new Require(this), true); |
| 100 | } |
no test coverage detected