All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.htmlunit.javascript.JavaScriptEngine Maven / Gradle / Ivy

Go to download

XLT (Xceptance LoadTest) is an extensive load and performance test tool developed and maintained by Xceptance.

There is a newer version: 8.4.1
Show newest version
/*
 * Copyright (c) 2002-2023 Gargoyle Software Inc.
 * Copyright (c) 2005-2023 Xceptance Software Technologies GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.htmlunit.javascript;

import static org.htmlunit.BrowserVersionFeatures.JS_API_FETCH;
import static org.htmlunit.BrowserVersionFeatures.JS_API_PROXY;
import static org.htmlunit.BrowserVersionFeatures.JS_ARRAY_FROM;
import static org.htmlunit.BrowserVersionFeatures.JS_CONSOLE_TIMESTAMP;
import static org.htmlunit.BrowserVersionFeatures.JS_ERROR_CAPTURE_STACK_TRACE;
import static org.htmlunit.BrowserVersionFeatures.JS_ERROR_STACK_TRACE_LIMIT;
import static org.htmlunit.BrowserVersionFeatures.JS_GLOBAL_THIS;
import static org.htmlunit.BrowserVersionFeatures.JS_INTL_NAMED_OBJECT;
import static org.htmlunit.BrowserVersionFeatures.JS_OBJECT_GET_OWN_PROPERTY_SYMBOLS;
import static org.htmlunit.BrowserVersionFeatures.JS_PROMISE;
import static org.htmlunit.BrowserVersionFeatures.JS_REFLECT;
import static org.htmlunit.BrowserVersionFeatures.JS_SYMBOL;
import static org.htmlunit.BrowserVersionFeatures.JS_WINDOW_ACTIVEXOBJECT_HIDDEN;
import static org.htmlunit.BrowserVersionFeatures.JS_WINDOW_INSTALL_TRIGGER_NULL;
import static org.htmlunit.BrowserVersionFeatures.STRING_INCLUDES;
import static org.htmlunit.BrowserVersionFeatures.STRING_REPEAT;
import static org.htmlunit.BrowserVersionFeatures.STRING_STARTS_ENDS_WITH;
import static org.htmlunit.BrowserVersionFeatures.STRING_TRIM_LEFT_RIGHT;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.htmlunit.BrowserVersion;
import org.htmlunit.Page;
import org.htmlunit.ScriptException;
import org.htmlunit.WebAssert;
import org.htmlunit.WebClient;
import org.htmlunit.WebWindow;
import org.htmlunit.html.DomNode;
import org.htmlunit.html.HtmlPage;
import org.htmlunit.javascript.background.BackgroundJavaScriptFactory;
import org.htmlunit.javascript.background.JavaScriptExecutor;
import org.htmlunit.javascript.configuration.ClassConfiguration;
import org.htmlunit.javascript.configuration.ClassConfiguration.ConstantInfo;
import org.htmlunit.javascript.configuration.ClassConfiguration.PropertyInfo;
import org.htmlunit.javascript.configuration.JavaScriptConfiguration;
import org.htmlunit.javascript.host.ActiveXObject;
import org.htmlunit.javascript.host.ConsoleCustom;
import org.htmlunit.javascript.host.DateCustom;
import org.htmlunit.javascript.host.NumberCustom;
import org.htmlunit.javascript.host.Reflect;
import org.htmlunit.javascript.host.URLSearchParams;
import org.htmlunit.javascript.host.Window;
import org.htmlunit.javascript.host.intl.Intl;
import org.htmlunit.javascript.host.xml.FormData;
import org.htmlunit.javascript.polyfill.Polyfill;

import org.htmlunit.corejs.javascript.BaseFunction;
import org.htmlunit.corejs.javascript.Callable;
import org.htmlunit.corejs.javascript.Context;
import org.htmlunit.corejs.javascript.ContextAction;
import org.htmlunit.corejs.javascript.Function;
import org.htmlunit.corejs.javascript.FunctionObject;
import org.htmlunit.corejs.javascript.IdFunctionObject;
import org.htmlunit.corejs.javascript.NativeConsole;
import org.htmlunit.corejs.javascript.RhinoException;
import org.htmlunit.corejs.javascript.Script;
import org.htmlunit.corejs.javascript.ScriptRuntime;
import org.htmlunit.corejs.javascript.Scriptable;
import org.htmlunit.corejs.javascript.ScriptableObject;
import org.htmlunit.corejs.javascript.StackStyle;
import org.htmlunit.corejs.javascript.Symbol;
import org.htmlunit.corejs.javascript.UniqueTag;

/**
 * A wrapper for the Rhino JavaScript engine
 * that provides browser specific features.
 *
 * 

Like all classes in this package, this class is not intended for direct use * and may change without notice.

* * @author Mike Bowler * @author Chen Jun * @author David K. Taylor * @author Chris Erskine * @author Ben Curren * @author David D. Kilzer * @author Marc Guillemot * @author Daniel Gredler * @author Ahmed Ashour * @author Amit Manjhi * @author Ronald Brill * @author Frank Danek * @see * Rhino and Java Browser */ public class JavaScriptEngine implements AbstractJavaScriptEngine