protected Scriptable getScope() { final Scriptable scope = context.initStandardObjects(); return scope; }
/** * Initialize the standard objects. * * Creates instances of the standard objects and their constructors * (Object, String, Number, Date, etc.), setting up 'scope' to act * as a global object as in ECMA 15.1.<p> * * This method must be called to initialize a scope before scripts * can be evaluated in that scope.<p> * * This method does not affect the Context it is called upon. * * @return the initialized scope */ public final ScriptableObject initStandardObjects() { return initStandardObjects(null, false); }
/** * Initialize the standard objects. * * Creates instances of the standard objects and their constructors * (Object, String, Number, Date, etc.), setting up 'scope' to act * as a global object as in ECMA 15.1.<p> * * This method must be called to initialize a scope before scripts * can be evaluated in that scope.<p> * * This method does not affect the Context it is called upon. * * @param scope the scope to initialize, or null, in which case a new * object will be created to serve as the scope * @return the initialized scope. The method returns the value of the scope * argument if it is not null or newly allocated scope object which * is an instance {@link ScriptableObject}. */ public final Scriptable initStandardObjects(ScriptableObject scope) { return initStandardObjects(scope, false); }
final Context cx = ContextFactory.getGlobal().enterContext(); try { final Scriptable scope = cx.initStandardObjects(); final StringBuilder builder = new StringBuilder(); for (int i = 0; i < query.length(); i++) {
/** * Constructor. * @param browserVersion the simulated browser version * @param worker the started worker * @throws Exception in case of problem */ DedicatedWorkerGlobalScope(final Window owningWindow, final Context context, final BrowserVersion browserVersion, final Worker worker) throws Exception { context.initStandardObjects(this); final ClassConfiguration config = AbstractJavaScriptConfiguration.getClassConfiguration( DedicatedWorkerGlobalScope.class, browserVersion); final HtmlUnitScriptable prototype = JavaScriptEngine.configureClass(config, null, browserVersion); setPrototype(prototype); owningWindow_ = owningWindow; final URL currentURL = owningWindow.getWebWindow().getEnclosedPage().getUrl(); origin_ = currentURL.getProtocol() + "://" + currentURL.getHost() + ':' + currentURL.getPort(); worker_ = worker; }
final Context cx = ContextFactory.getGlobal().enterContext(); try { final Scriptable scope = cx.initStandardObjects(); final StringBuilder builder = new StringBuilder(); for (int i = 0; i < query.length(); i++) {
public void initStandardObjects(Context cx, boolean sealed) { // Assume that Context.initStandardObjects initialize JavaImporter // property lazily so the above init call is not yet called cx.initStandardObjects(this, sealed); topScopeFlag = true; // If seal is true then exportAsJSClass(cx, seal) would seal // this obj. Since this is scope as well, it would not allow // to add variables. IdFunctionObject ctor = exportAsJSClass(MAX_PROTOTYPE_ID, this, false); if (sealed) { ctor.sealObject(); } // delete "constructor" defined by exportAsJSClass so "constructor" // name would refer to Object.constructor // and not to JavaImporter.prototype.constructor. delete("constructor"); }
final Context cx = ContextFactory.getGlobal().enterContext(); try { final Scriptable scope = cx.initStandardObjects(); final StringBuilder builder = new StringBuilder(); for (int i = 0; i < query.length(); i++) {
/** * Constructor. * @param browserVersion the simulated browser version * @param worker the started worker * @throws Exception in case of problem */ DedicatedWorkerGlobalScope(final Window owningWindow, final Context context, final BrowserVersion browserVersion, final Worker worker) throws Exception { context.initStandardObjects(this); final ClassConfiguration config = AbstractJavaScriptConfiguration.getClassConfiguration( DedicatedWorkerGlobalScope.class, browserVersion); final HtmlUnitScriptable prototype = JavaScriptEngine.configureClass(config, null, browserVersion); setPrototype(prototype); owningWindow_ = owningWindow; final URL currentURL = owningWindow.getWebWindow().getEnclosedPage().getUrl(); origin_ = currentURL.getProtocol() + "://" + currentURL.getHost() + ':' + currentURL.getPort(); worker_ = worker; }
final Window window = new Window(this); final JavaScriptConfiguration jsConfig = JavaScriptConfiguration.getInstance(webClient.getBrowserVersion()); context.initStandardObjects(window);
final Window window = new Window(this); final JavaScriptConfiguration jsConfig = JavaScriptConfiguration.getInstance(webClient.getBrowserVersion()); context.initStandardObjects(window);
final Window window = new Window(this); final JavaScriptConfiguration jsConfig = JavaScriptConfiguration.getInstance(webClient.getBrowserVersion()); context.initStandardObjects(window);
context.initStandardObjects(window);
try { final ProxyAutoConfig config = new ProxyAutoConfig(); final Scriptable scope = cx.initStandardObjects();
try { final ProxyAutoConfig config = new ProxyAutoConfig(); final Scriptable scope = cx.initStandardObjects();
context.initStandardObjects(window);
try { final ProxyAutoConfig config = new ProxyAutoConfig(); final Scriptable scope = cx.initStandardObjects();
try { final ProxyAutoConfig config = new ProxyAutoConfig(); final Scriptable scope = cx.initStandardObjects();
try { final ProxyAutoConfig config = new ProxyAutoConfig(); final Scriptable scope = cx.initStandardObjects();