Java Code Examples for jdk.nashorn.internal.objects.Global#initBuiltinObjects()

The following examples show how to use jdk.nashorn.internal.objects.Global#initBuiltinObjects() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Context.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize given global scope object.
 *
 * @param global the global
 * @param engine the associated ScriptEngine instance, can be null
 * @return the initialized global scope object.
 */
public Global initGlobal(final Global global, final ScriptEngine engine) {
    // Need only minimal global object, if we are just compiling.
    if (!env._compile_only) {
        final Global oldGlobal = Context.getGlobal();
        try {
            Context.setGlobal(global);
            // initialize global scope with builtin global objects
            global.initBuiltinObjects(engine);
        } finally {
            Context.setGlobal(oldGlobal);
        }
    }

    return global;
}
 
Example 2
Source File: Context.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize given global scope object.
 *
 * @param global the global
 * @param engine the associated ScriptEngine instance, can be null
 * @param ctxt the initial ScriptContext, can be null
 * @return the initialized global scope object.
 */
public Global initGlobal(final Global global, final ScriptEngine engine, final ScriptContext ctxt) {
    // Need only minimal global object, if we are just compiling.
    if (!env._compile_only) {
        final Global oldGlobal = Context.getGlobal();
        try {
            Context.setGlobal(global);
            // initialize global scope with builtin global objects
            global.initBuiltinObjects(engine, ctxt);
        } finally {
            Context.setGlobal(oldGlobal);
        }
    }

    return global;
}
 
Example 3
Source File: Context.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize given global scope object.
 *
 * @param global the global
 * @param engine the associated ScriptEngine instance, can be null
 * @return the initialized global scope object.
 */
public Global initGlobal(final Global global, final ScriptEngine engine) {
    // Need only minimal global object, if we are just compiling.
    if (!env._compile_only) {
        final Global oldGlobal = Context.getGlobal();
        try {
            Context.setGlobal(global);
            // initialize global scope with builtin global objects
            global.initBuiltinObjects(engine);
        } finally {
            Context.setGlobal(oldGlobal);
        }
    }

    return global;
}
 
Example 4
Source File: Context.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize given global scope object.
 *
 * @param global the global
 * @param engine the associated ScriptEngine instance, can be null
 * @return the initialized global scope object.
 */
public Global initGlobal(final Global global, final ScriptEngine engine) {
    // Need only minimal global object, if we are just compiling.
    if (!env._compile_only) {
        final Global oldGlobal = Context.getGlobal();
        try {
            Context.setGlobal(global);
            // initialize global scope with builtin global objects
            global.initBuiltinObjects(engine);
        } finally {
            Context.setGlobal(oldGlobal);
        }
    }

    return global;
}
 
Example 5
Source File: Context.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize given global scope object.
 *
 * @param global the global
 * @param engine the associated ScriptEngine instance, can be null
 * @return the initialized global scope object.
 */
public Global initGlobal(final Global global, final ScriptEngine engine) {
    // Need only minimal global object, if we are just compiling.
    if (!env._compile_only) {
        final Global oldGlobal = Context.getGlobal();
        try {
            Context.setGlobal(global);
            // initialize global scope with builtin global objects
            global.initBuiltinObjects(engine);
        } finally {
            Context.setGlobal(oldGlobal);
        }
    }

    return global;
}
 
Example 6
Source File: Context.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize given global scope object.
 *
 * @param global the global
 * @param engine the associated ScriptEngine instance, can be null
 * @return the initialized global scope object.
 */
public Global initGlobal(final Global global, final ScriptEngine engine) {
    // Need only minimal global object, if we are just compiling.
    if (!env._compile_only) {
        final Global oldGlobal = Context.getGlobal();
        try {
            Context.setGlobal(global);
            // initialize global scope with builtin global objects
            global.initBuiltinObjects(engine);
        } finally {
            Context.setGlobal(oldGlobal);
        }
    }

    return global;
}
 
Example 7
Source File: Context.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize given global scope object.
 *
 * @param global the global
 * @param engine the associated ScriptEngine instance, can be null
 * @return the initialized global scope object.
 */
public Global initGlobal(final Global global, final ScriptEngine engine) {
    // Need only minimal global object, if we are just compiling.
    if (!env._compile_only) {
        final Global oldGlobal = Context.getGlobal();
        try {
            Context.setGlobal(global);
            // initialize global scope with builtin global objects
            global.initBuiltinObjects(engine);
        } finally {
            Context.setGlobal(oldGlobal);
        }
    }

    return global;
}