org.mozilla.javascript.ScriptableObject.setParentScope()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 JavaScript  
字(6.3k)|赞(0)|评价(0)|浏览(184)

本文整理了Java中org.mozilla.javascript.ScriptableObject.setParentScope()方法的一些代码示例,展示了ScriptableObject.setParentScope()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScriptableObject.setParentScope()方法的具体详情如下:
包路径:org.mozilla.javascript.ScriptableObject
类名称:ScriptableObject
方法名:setParentScope

ScriptableObject.setParentScope介绍

[英]Sets the parent (enclosing) scope of the object.
[中]设置对象的父(封闭)范围。

代码示例

代码示例来源:origin: org.kohsuke.httpunit/httpunit

/**
 * get the Window
 * @return the window
 */
public DomWindow getWindow() {
  // if there is now window yet
 if (_window == null) {
   // create a window for this document
   _window = new DomWindow( this );
  setParentScope( _window );
 }
 return _window;
}

代码示例来源:origin: org.kohsuke.httpunit/httpunit

/**
 * initialize JavaScript for the given ScriptEngine
 * @parent - the Script Engine to use
 * @scriptable - the scriptable object to do the initialization for
 */
void initialize( JavaScriptEngine parent, ScriptableDelegate scriptable )
    throws SAXException, PropertyException, JavaScriptException, NotAFunctionException {
  _scriptable = scriptable;
  _scriptable.setScriptEngine( this );
  _parent = parent;
  if (parent != null) setParentScope( parent );
}

代码示例来源:origin: org.kohsuke.httpunit/httpunit

/**
 * initialize the name space
 * @param owner
 * @param namespaceURI
 * @param qualifiedName
 */
protected void initialize( DocumentImpl owner, String namespaceURI, String qualifiedName ) {
  initialize( owner );
  _tagName = qualifiedName;
  _namespaceUri = namespaceURI;
  if (qualifiedName.indexOf(':') < 0) {
    _localName = qualifiedName;
  } else {
    _localName = qualifiedName.substring( qualifiedName.indexOf(':') + 1 );
  }
  setParentScope(owner); 
}

代码示例来源:origin: org.hibnet/webpipes-rhino

protected ScriptableObject createLocalScope(Context context) {
  ScriptableObject scope = (ScriptableObject) context.newObject(globalScope);
  scope.setPrototype(null);
  scope.setParentScope(globalScope);
  return scope;
}

代码示例来源:origin: geogebra/geogebra

public static void setBuiltinProtoAndParent(ScriptableObject object,
                      Scriptable scope,
                      TopLevel.Builtins type)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  object.setParentScope(scope);
  object.setPrototype(TopLevel.getBuiltinPrototype(scope, type));
}

代码示例来源:origin: io.apigee/rhino

public static void setBuiltinProtoAndParent(ScriptableObject object,
                      Scriptable scope,
                      TopLevel.Builtins type)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  object.setParentScope(scope);
  object.setPrototype(TopLevel.getBuiltinPrototype(scope, type));
}

代码示例来源:origin: ro.isdc.wro4j/rhino

public static void setBuiltinProtoAndParent(ScriptableObject object,
                      Scriptable scope,
                      TopLevel.Builtins type)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  object.setParentScope(scope);
  object.setPrototype(TopLevel.getBuiltinPrototype(scope, type));
}

代码示例来源:origin: com.github.tntim96/rhino

public static void setBuiltinProtoAndParent(ScriptableObject object,
                      Scriptable scope,
                      TopLevel.Builtins type)
{
  scope = ScriptableObject.getTopLevelScope(scope);
  object.setParentScope(scope);
  object.setPrototype(TopLevel.getBuiltinPrototype(scope, type));
}

代码示例来源:origin: io.apigee/rhino

public static void setObjectProtoAndParent(ScriptableObject object,
                      Scriptable scope)
{
  // Compared with function it always sets the scope to top scope
  scope = ScriptableObject.getTopLevelScope(scope);
  object.setParentScope(scope);
  Scriptable proto
    = ScriptableObject.getClassPrototype(scope, object.getClassName());
  object.setPrototype(proto);
}

代码示例来源:origin: rhino/js

public static void setObjectProtoAndParent(ScriptableObject object,
                      Scriptable scope)
{
  // Compared with function it always sets the scope to top scope
  scope = ScriptableObject.getTopLevelScope(scope);
  object.setParentScope(scope);
  Scriptable proto
    = ScriptableObject.getClassPrototype(scope, object.getClassName());
  object.setPrototype(proto);
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

public static void setObjectProtoAndParent(ScriptableObject object,
                      Scriptable scope)
{
  // Compared with function it always sets the scope to top scope
  scope = ScriptableObject.getTopLevelScope(scope);
  object.setParentScope(scope);
  Scriptable proto
    = ScriptableObject.getClassPrototype(scope, object.getClassName());
  object.setPrototype(proto);
}

代码示例来源:origin: org.kohsuke.httpunit/httpunit

/**
 * 
 * @return the onload event
 */
public Function getOnloadEvent() {
  if (getParentScope() == null && getOwnerDocument() instanceof Scriptable)
    setParentScope( (Scriptable) getOwnerDocument() );
  return _onLoad.getHandler();
}

代码示例来源:origin: geogebra/geogebra

public static void setObjectProtoAndParent(ScriptableObject object,
                      Scriptable scope)
{
  // Compared with function it always sets the scope to top scope
  scope = ScriptableObject.getTopLevelScope(scope);
  object.setParentScope(scope);
  Scriptable proto
    = ScriptableObject.getClassPrototype(scope, object.getClassName());
  object.setPrototype(proto);
}

代码示例来源:origin: com.github.tntim96/rhino

public static void setObjectProtoAndParent(ScriptableObject object,
                      Scriptable scope)
{
  // Compared with function it always sets the scope to top scope
  scope = ScriptableObject.getTopLevelScope(scope);
  object.setParentScope(scope);
  Scriptable proto
    = ScriptableObject.getClassPrototype(scope, object.getClassName());
  object.setPrototype(proto);
}

代码示例来源:origin: ro.isdc.wro4j/rhino

public static void setObjectProtoAndParent(ScriptableObject object,
                      Scriptable scope)
{
  // Compared with function it always sets the scope to top scope
  scope = ScriptableObject.getTopLevelScope(scope);
  object.setParentScope(scope);
  Scriptable proto
    = ScriptableObject.getClassPrototype(scope, object.getClassName());
  object.setPrototype(proto);
}

代码示例来源:origin: org.seasar.mayaa/mayaa

pageScope.setParentScope(parent);
if (variables != null) {
  RhinoUtil.enter();

代码示例来源:origin: io.apigee/rhino

wrapper.setParentScope(scope);
wrapper.setPrototype(ScriptableObject.getObjectPrototype(scope));
wrapper.defineProperty("", value, 0);

代码示例来源:origin: ro.isdc.wro4j/rhino

wrapper.setParentScope(scope);
wrapper.setPrototype(ScriptableObject.getObjectPrototype(scope));
wrapper.defineProperty("", value, 0);

代码示例来源:origin: biz.gabrys.lesscss/compiler

compileScope.setParentScope(null);
compileScope.setPrototype(scope);

代码示例来源:origin: Alfresco/alfresco-repository

private ScriptableObject getScope() 
{
  // Create a scope for the value conversion. This scope will be an empty scope exposing basic Object and Function, sufficient for value-conversion.
  // In case no context is active for the current thread, we can safely enter end exit one to get hold of a scope
  ScriptableObject scope;
  Context ctx = Context.getCurrentContext();
  boolean closeContext = false;
  if (ctx == null) 
  {
    ctx = Context.enter();
    closeContext = true;
  }
  scope = ctx.initStandardObjects();
  scope.setParentScope(null);
  if (closeContext) 
  {
    Context.exit();
  }
  return scope;
}

相关文章

微信公众号

ScriptableObject类方法