Java Utililty Methods Javascript Mozilla Library

List of utility methods to do Javascript Mozilla Library

Description

The list of methods to do Javascript Mozilla Library are organized into topic(s).

Method

ObjectgetStaticProperty(Scriptable mixin, String name)

Replies the static property with name name or Scriptable#NOT_FOUND , if no such property exists.

Object property = mixin.get(name, mixin);
if (property != Scriptable.NOT_FOUND && property instanceof Scriptable) {
    if (isStaticProperty((Scriptable) property)) {
        return (Scriptable) property;
return Scriptable.NOT_FOUND;
StringgetStringArgument(Object[] args, int pos, boolean allowNull)
Get an argument as string
if (pos >= args.length || args[pos] == null || args[pos] == Undefined.instance) {
    if (allowNull)
        return null;
    throw new IllegalArgumentException("Argument " + (pos + 1) + " must not be null");
return ScriptRuntime.toString(args[pos].toString());
StringgetStringValue(AstNode element)
get String Value
if (element instanceof StringLiteral)
    return ((StringLiteral) element).getValue();
if (element instanceof KeywordLiteral)
    return ((KeywordLiteral) element).toSource();
if (element instanceof Name)
    return ((Name) element).getIdentifier();
return "";
String[]getXhtmlLinks(Object xhtml)
get Xhtml Links
if (xhtml instanceof Scriptable) {
    Scriptable sxhtml = (Scriptable) xhtml;
    String classname = sxhtml.getClassName().toLowerCase();
    if ("xml".equals(classname) || "xmllist".equals(classname)) {
        final String XHTML_LINKS_EVAL = "xhtml..*.@href + xhtml..*.@src";
        Context cx = Context.getCurrentContext();
        ImporterTopLevel itl = new ImporterTopLevel(cx);
        itl.put("xhtml", itl, sxhtml);
...
voidgrabContextFactoryGlobalSetter()
grab Context Factory Global Setter
if (globalSetter == null) {
    globalSetter = ContextFactory.getGlobalSetter();
booleanisContained(AstNode mayAncestor, AstNode filial)
is Contained
AstNode node = filial;
while (node != null) {
    if (node.equals(mayAncestor))
        return true;
    node = node.getParent();
return false;
booleanisDefined(final Object object)
Returns whether or not the object is defined.
return object != null && object != Scriptable.NOT_FOUND && object != Undefined.instance;
booleanisName(AstNode node, String value)
Returns whether an AST node is a Name with the specified value.
return node instanceof Name && value.equals(((Name) node).getIdentifier());
booleanisNullNativeObject(Object val)
is Null Native Object
if (val instanceof UniqueTag) {
    if (UniqueTag.NOT_FOUND.equals(val)) {
        return true;
    } else if (UniqueTag.NULL_VALUE.equals(val)) {
        return true;
} else if (val instanceof Undefined) {
    return true;
...
booleanisPrototypeNameNode(AstNode node)
is Prototype Name Node
return node instanceof Name && "prototype".equals(((Name) node).getIdentifier());