1 38 package com.gargoylesoftware.htmlunit.javascript.host; 39 40 import org.mozilla.javascript.Context; 41 import org.mozilla.javascript.Function; 42 import org.mozilla.javascript.Scriptable; 43 44 61 class ScoperFunctionObject implements Function { 62 private final Function wrapped_; 63 private final Scriptable scope_; 64 65 70 public ScoperFunctionObject(Function wrapped, final Scriptable scope) { 71 wrapped_ = wrapped; 72 scope_ = scope; 73 } 74 75 76 public Object call( 77 final Context cx, final Scriptable scope, final Scriptable thisObj, 78 final Object [] args) { 79 return wrapped_.call(cx, scope, thisObj, args); 80 } 81 82 83 public Scriptable construct(final Context cx, final Scriptable scope, final Object [] args) { 84 final Scriptable o = wrapped_.construct(cx, scope, args); 85 o.setParentScope(scope_); 86 87 return o; 88 } 89 90 91 public void delete(final int index) { 92 wrapped_.delete(index); 93 } 94 95 96 public void delete(final String name) { 97 wrapped_.delete(name); 98 } 99 100 101 public boolean equals(final Object obj) { 102 return wrapped_.equals(obj); 103 } 104 105 106 public Object get(final int index, final Scriptable start) { 107 return wrapped_.get(index, start); 108 } 109 110 111 public Object get(final String name, final Scriptable start) { 112 return wrapped_.get(name, start); 113 } 114 115 116 public String getClassName() { 117 return wrapped_.getClassName(); 118 } 119 120 121 public Object getDefaultValue(final Class hint) { 122 return wrapped_.getDefaultValue(hint); 123 } 124 125 126 public Object [] getIds() { 127 return wrapped_.getIds(); 128 } 129 130 131 public Scriptable getParentScope() { 132 return wrapped_.getParentScope(); 133 } 134 135 136 public Scriptable getPrototype() { 137 return wrapped_.getPrototype(); 138 } 139 140 141 public boolean has(final int index, final Scriptable start) { 142 return wrapped_.has(index, start); 143 } 144 145 146 public boolean has(final String name, final Scriptable start) { 147 return wrapped_.has(name, start); 148 } 149 150 151 public int hashCode() { 152 return wrapped_.hashCode(); 153 } 154 155 156 public boolean hasInstance(final Scriptable instance) { 157 return wrapped_.hasInstance(instance); 158 } 159 160 161 public void put(final int index, final Scriptable start, final Object value) { 162 wrapped_.put(index, start, value); 163 } 164 165 166 public void put(final String name, final Scriptable start, final Object value) { 167 wrapped_.put(name, start, value); 168 } 169 170 171 public void setParentScope(final Scriptable parent) { 172 wrapped_.setParentScope(parent); 173 } 174 175 176 public void setPrototype(final Scriptable prototype) { 177 wrapped_.setPrototype(prototype); 178 } 179 180 181 public String toString() { 182 return wrapped_.toString(); 183 } 184 } 185 | Popular Tags |