* Remove global defineLibraryScope() function.
This commit is contained in:
parent
401d14d9eb
commit
e18c085317
1 changed files with 1 additions and 30 deletions
|
@ -73,7 +73,7 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
|
|||
"encodeXml", "encodeForm", "stripTags", "formatParagraphs",
|
||||
"getXmlDocument", "getHtmlDocument", "seal",
|
||||
"getDBConnection", "getURL", "write", "writeln",
|
||||
"serialize", "deserialize", "defineLibraryScope",
|
||||
"serialize", "deserialize",
|
||||
"wrapJavaMap", "unwrapJavaMap", "toJava"
|
||||
};
|
||||
|
||||
|
@ -367,35 +367,6 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a global object, optionally initializing it with standard
|
||||
* JavaScript objects. This can be used for script libraries that want
|
||||
* to extend standard JavaScript functionality, but leave the original
|
||||
* prototypes alone.
|
||||
*
|
||||
* @param name the name of the new scope
|
||||
*/
|
||||
public void defineLibraryScope(final String name, boolean initStandardObjects) {
|
||||
Object obj = get(name, this);
|
||||
if (obj != NOT_FOUND) {
|
||||
// put the property again to fool PropertyRecorder
|
||||
// into believing it has been renewed
|
||||
put(name, this, obj);
|
||||
return;
|
||||
}
|
||||
ScriptableObject scope = new NativeObject() {
|
||||
public String getClassName() {
|
||||
return name;
|
||||
}
|
||||
};
|
||||
scope.setPrototype(ScriptableObject.getObjectPrototype(this));
|
||||
if (initStandardObjects) {
|
||||
Context cx = Context.getCurrentContext();
|
||||
cx.initStandardObjects(scope, false);
|
||||
}
|
||||
put(name, this, scope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a java.util.Map so that it looks and behaves like a native JS object
|
||||
* @param obj a map
|
||||
|
|
Loading…
Add table
Reference in a new issue