1688 // properties.
1689 final ScriptObject regExpProto = getRegExpPrototype();
1690 regExpProto.addBoundProperties(DEFAULT_REGEXP);
1691
1692 // Error stuff
1693 initErrorObjects();
1694
1695 // java access
1696 if (! env._no_java) {
1697 initJavaAccess();
1698 }
1699
1700 if (! env._no_typed_arrays) {
1701 initTypedArray();
1702 }
1703
1704 if (env._scripting) {
1705 initScripting(env);
1706 }
1707
1708 if (Context.DEBUG && System.getSecurityManager() == null) {
1709 initDebug();
1710 }
1711
1712 copyBuiltins();
1713
1714 // initialized with strings so that typeof will work as expected.
1715 this.__FILE__ = "";
1716 this.__DIR__ = "";
1717 this.__LINE__ = 0.0;
1718
1719 // expose script (command line) arguments as "arguments" property of global
1720 final List<String> arguments = env.getArguments();
1721 final Object argsObj = wrapAsObject(arguments.toArray());
1722
1723 addOwnProperty("arguments", Attribute.NOT_ENUMERABLE, argsObj);
1724 if (env._scripting) {
1725 // synonym for "arguments" in scripting mode
1726 addOwnProperty("$ARG", Attribute.NOT_ENUMERABLE, argsObj);
1727 }
1728 }
1729
|
1688 // properties.
1689 final ScriptObject regExpProto = getRegExpPrototype();
1690 regExpProto.addBoundProperties(DEFAULT_REGEXP);
1691
1692 // Error stuff
1693 initErrorObjects();
1694
1695 // java access
1696 if (! env._no_java) {
1697 initJavaAccess();
1698 }
1699
1700 if (! env._no_typed_arrays) {
1701 initTypedArray();
1702 }
1703
1704 if (env._scripting) {
1705 initScripting(env);
1706 }
1707
1708 if (Context.DEBUG) {
1709 boolean debugOkay;
1710 final SecurityManager sm = System.getSecurityManager();
1711 if (sm != null) {
1712 try {
1713 sm.checkPermission(new RuntimePermission(Context.NASHORN_DEBUG_MODE));
1714 debugOkay = true;
1715 } catch (final SecurityException ignored) {
1716 // if no permission, don't initialize Debug object
1717 debugOkay = false;
1718 }
1719
1720 } else {
1721 debugOkay = true;
1722 }
1723
1724 if (debugOkay) {
1725 initDebug();
1726 }
1727 }
1728
1729 copyBuiltins();
1730
1731 // initialized with strings so that typeof will work as expected.
1732 this.__FILE__ = "";
1733 this.__DIR__ = "";
1734 this.__LINE__ = 0.0;
1735
1736 // expose script (command line) arguments as "arguments" property of global
1737 final List<String> arguments = env.getArguments();
1738 final Object argsObj = wrapAsObject(arguments.toArray());
1739
1740 addOwnProperty("arguments", Attribute.NOT_ENUMERABLE, argsObj);
1741 if (env._scripting) {
1742 // synonym for "arguments" in scripting mode
1743 addOwnProperty("$ARG", Attribute.NOT_ENUMERABLE, argsObj);
1744 }
1745 }
1746
|