Package org.htmlunit.corejs.javascript
Class NativeProxy
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.corejs.javascript.NativeProxy
-
- All Implemented Interfaces:
java.io.Serializable,Callable,ConstProperties,Constructable,DebuggableObject,Scriptable,SymbolScriptable
final class NativeProxy extends ScriptableObject implements Callable, Constructable
This class implements the Proxy object.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classNativeProxy.Revoker-
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
ScriptableObject.KeyComparator
-
-
Field Summary
Fields Modifier and Type Field Description private ScriptablehandlerObjprivate static java.lang.StringPROXY_TAGprivate static longserialVersionUIDprivate ScriptableObjecttargetObjprivate static java.lang.StringTRAP_APPLYprivate static java.lang.StringTRAP_CONSTRUCTprivate static java.lang.StringTRAP_DEFINE_PROPERTYprivate static java.lang.StringTRAP_DELETE_PROPERTYprivate static java.lang.StringTRAP_GETprivate static java.lang.StringTRAP_GET_OWN_PROPERTY_DESCRIPTORprivate static java.lang.StringTRAP_GET_PROTOTYPE_OFprivate static java.lang.StringTRAP_HASprivate static java.lang.StringTRAP_IS_EXTENSIBLEprivate static java.lang.StringTRAP_OWN_KEYSprivate static java.lang.StringTRAP_PREVENT_EXTENSIONSprivate static java.lang.StringTRAP_SETprivate static java.lang.StringTRAP_SET_PROTOTYPE_OFprivate java.lang.StringtypeOf-
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
-
Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
-
-
Constructor Summary
Constructors Modifier Constructor Description privateNativeProxy(ScriptableObject target, Scriptable handler)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectcall(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslistprivate java.lang.ObjectcallTrap(Callable trap, java.lang.Object[] args)Scriptableconstruct(Context cx, Scriptable scope, java.lang.Object[] args)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-construct-argumentslist-newtargetprivate static NativeProxyconstructor(Context cx, Scriptable scope, java.lang.Object[] args)booleandefineOwnProperty(Context cx, java.lang.Object id, ScriptableObject desc)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-descvoiddelete(int index)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-pvoiddelete(java.lang.String name)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-pvoiddelete(Symbol key)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-pjava.lang.Objectget(int index, Scriptable start)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiverjava.lang.Objectget(java.lang.String name, Scriptable start)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiverjava.lang.Objectget(Symbol key, Scriptable start)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiverjava.lang.StringgetClassName()Return the name of the class.(package private) java.lang.Object[]getIds(boolean getNonEnumerable, boolean getSymbols)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeysprotected ScriptableObjectgetOwnPropertyDescriptor(Context cx, java.lang.Object id)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-pScriptablegetPrototype()see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof(package private) ScriptableObjectgetTargetThrowIfRevoked()private CallablegetTrap(java.lang.String trapName)java.lang.StringgetTypeOf()Gets the value that will be returned by calling the typeof operator on this object.booleanhas(int index, Scriptable start)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-pbooleanhas(java.lang.String name, Scriptable start)https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-pbooleanhas(Symbol key, Scriptable start)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-pstatic voidinit(Context cx, Scriptable scope, boolean sealed)booleanisExtensible()see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-isextensiblebooleanpreventExtensions()see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-preventextensionsvoidput(int index, Scriptable start, java.lang.Object value)https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receivervoidput(java.lang.String name, Scriptable start, java.lang.Object value)https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receivervoidput(Symbol key, Scriptable start, java.lang.Object value)https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiverprivate static java.lang.Objectrevocable(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)voidsetPrototype(Scriptable prototype)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-vprivate voidsetPrototypeDirect(Scriptable prototype)-
Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
addLazilyInitializedValue, applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildClassCtor, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, checkValidAttributes, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getBase, getBase, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, putConst, putConstProperty, putImpl, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, size
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
PROXY_TAG
private static final java.lang.String PROXY_TAG
- See Also:
- Constant Field Values
-
TRAP_GET_PROTOTYPE_OF
private static final java.lang.String TRAP_GET_PROTOTYPE_OF
- See Also:
- Constant Field Values
-
TRAP_SET_PROTOTYPE_OF
private static final java.lang.String TRAP_SET_PROTOTYPE_OF
- See Also:
- Constant Field Values
-
TRAP_IS_EXTENSIBLE
private static final java.lang.String TRAP_IS_EXTENSIBLE
- See Also:
- Constant Field Values
-
TRAP_PREVENT_EXTENSIONS
private static final java.lang.String TRAP_PREVENT_EXTENSIONS
- See Also:
- Constant Field Values
-
TRAP_GET_OWN_PROPERTY_DESCRIPTOR
private static final java.lang.String TRAP_GET_OWN_PROPERTY_DESCRIPTOR
- See Also:
- Constant Field Values
-
TRAP_DEFINE_PROPERTY
private static final java.lang.String TRAP_DEFINE_PROPERTY
- See Also:
- Constant Field Values
-
TRAP_HAS
private static final java.lang.String TRAP_HAS
- See Also:
- Constant Field Values
-
TRAP_GET
private static final java.lang.String TRAP_GET
- See Also:
- Constant Field Values
-
TRAP_SET
private static final java.lang.String TRAP_SET
- See Also:
- Constant Field Values
-
TRAP_DELETE_PROPERTY
private static final java.lang.String TRAP_DELETE_PROPERTY
- See Also:
- Constant Field Values
-
TRAP_OWN_KEYS
private static final java.lang.String TRAP_OWN_KEYS
- See Also:
- Constant Field Values
-
TRAP_APPLY
private static final java.lang.String TRAP_APPLY
- See Also:
- Constant Field Values
-
TRAP_CONSTRUCT
private static final java.lang.String TRAP_CONSTRUCT
- See Also:
- Constant Field Values
-
targetObj
private ScriptableObject targetObj
-
handlerObj
private Scriptable handlerObj
-
typeOf
private final java.lang.String typeOf
-
-
Constructor Detail
-
NativeProxy
private NativeProxy(ScriptableObject target, Scriptable handler)
-
-
Method Detail
-
init
public static void init(Context cx, Scriptable scope, boolean sealed)
-
getClassName
public java.lang.String getClassName()
Description copied from class:ScriptableObjectReturn the name of the class.This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.
- Specified by:
getClassNamein interfaceScriptable- Specified by:
getClassNamein classScriptableObject
-
construct
public Scriptable construct(Context cx, Scriptable scope, java.lang.Object[] args)
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-construct-argumentslist-newtarget- Specified by:
constructin interfaceConstructable- Parameters:
cx- the current Context for this threadscope- an enclosing scope of the caller except when the function is called from a closure.args- the array of arguments- Returns:
- the allocated object
-
has
public boolean has(java.lang.String name, Scriptable start)https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p- Specified by:
hasin interfaceScriptable- Overrides:
hasin classScriptableObject- Parameters:
name- the name of the propertystart- the object in which the lookup began- Returns:
- true if and only if the property was found in the object
- See Also:
Scriptable.get(String, Scriptable),ScriptableObject.getProperty(Scriptable, String)
-
has
public boolean has(int index, Scriptable start)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p- Specified by:
hasin interfaceScriptable- Overrides:
hasin classScriptableObject- Parameters:
index- the numeric index for the propertystart- the object in which the lookup began- Returns:
- true if and only if the property was found in the object
- See Also:
Scriptable.get(int, Scriptable),ScriptableObject.getProperty(Scriptable, int)
-
has
public boolean has(Symbol key, Scriptable start)
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p- Specified by:
hasin interfaceSymbolScriptable- Overrides:
hasin classScriptableObject
-
getIds
java.lang.Object[] getIds(boolean getNonEnumerable, boolean getSymbols)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys- Overrides:
getIdsin classScriptableObject
-
get
public java.lang.Object get(java.lang.String name, Scriptable start)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver- Specified by:
getin interfaceScriptable- Overrides:
getin classScriptableObject- Parameters:
name- the name of the propertystart- the object in which the lookup began- Returns:
- the value of the property (may be null), or NOT_FOUND
- See Also:
Context.getUndefinedValue()
-
get
public java.lang.Object get(int index, Scriptable start)see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver- Specified by:
getin interfaceScriptable- Overrides:
getin classScriptableObject- Parameters:
index- the numeric index for the propertystart- the object in which the lookup began- Returns:
- the value of the property (may be null), or NOT_FOUND
- See Also:
Scriptable.get(String,Scriptable)
-
get
public java.lang.Object get(Symbol key, Scriptable start)
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver- Specified by:
getin interfaceSymbolScriptable- Overrides:
getin classScriptableObject
-
put
public void put(java.lang.String name, Scriptable start, java.lang.Object value)https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver- Specified by:
putin interfaceScriptable- Overrides:
putin classScriptableObject- Parameters:
name- the name of the propertystart- the object whose property is being setvalue- value to set the property to- See Also:
Scriptable.has(String, Scriptable),Scriptable.get(String, Scriptable),ScriptableObject.putProperty(Scriptable, String, Object),Context.toObject(Object, Scriptable)
-
put
public void put(int index, Scriptable start, java.lang.Object value)https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver- Specified by:
putin interfaceScriptable- Overrides:
putin classScriptableObject- Parameters:
index- the numeric index for the propertystart- the object whose property is being setvalue- value to set the property to- See Also:
Scriptable.has(int, Scriptable),Scriptable.get(int, Scriptable),ScriptableObject.putProperty(Scriptable, int, Object),Context.toObject(Object, Scriptable)
-
put
public void put(Symbol key, Scriptable start, java.lang.Object value)
https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver- Specified by:
putin interfaceSymbolScriptable- Overrides:
putin classScriptableObject
-
delete
public void delete(java.lang.String name)
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p- Specified by:
deletein interfaceScriptable- Overrides:
deletein classScriptableObject- Parameters:
name- the name of the property- See Also:
Scriptable.get(String, Scriptable),ScriptableObject.deleteProperty(Scriptable, String)
-
delete
public void delete(int index)
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p- Specified by:
deletein interfaceScriptable- Overrides:
deletein classScriptableObject- Parameters:
index- the numeric index for the property- See Also:
Scriptable.get(int, Scriptable),ScriptableObject.deleteProperty(Scriptable, int)
-
delete
public void delete(Symbol key)
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p- Specified by:
deletein interfaceSymbolScriptable- Overrides:
deletein classScriptableObject
-
getOwnPropertyDescriptor
protected ScriptableObject getOwnPropertyDescriptor(Context cx, java.lang.Object id)
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p- Overrides:
getOwnPropertyDescriptorin classScriptableObject
-
defineOwnProperty
public boolean defineOwnProperty(Context cx, java.lang.Object id, ScriptableObject desc)
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc- Overrides:
defineOwnPropertyin classScriptableObject- Parameters:
cx- the current Contextid- the name/index of the propertydesc- the new property descriptor, as described in 8.6.1
-
isExtensible
public boolean isExtensible()
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-isextensible- Overrides:
isExtensiblein classScriptableObject
-
preventExtensions
public boolean preventExtensions()
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-preventextensions- Overrides:
preventExtensionsin classScriptableObject
-
getTypeOf
public java.lang.String getTypeOf()
Description copied from class:ScriptableObjectGets the value that will be returned by calling the typeof operator on this object.- Overrides:
getTypeOfin classScriptableObject- Returns:
- default is "object" unless
ScriptableObject.avoidObjectDetection()istruein which case it returns "undefined"
-
getPrototype
public Scriptable getPrototype()
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof- Specified by:
getPrototypein interfaceScriptable- Overrides:
getPrototypein classScriptableObject- Returns:
- the prototype
-
setPrototypeDirect
private void setPrototypeDirect(Scriptable prototype)
-
setPrototype
public void setPrototype(Scriptable prototype)
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v- Specified by:
setPrototypein interfaceScriptable- Overrides:
setPrototypein classScriptableObject- Parameters:
prototype- the prototype to set
-
call
public java.lang.Object call(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
see https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist
-
constructor
private static NativeProxy constructor(Context cx, Scriptable scope, java.lang.Object[] args)
-
revocable
private static java.lang.Object revocable(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
getTrap
private Callable getTrap(java.lang.String trapName)
-
callTrap
private java.lang.Object callTrap(Callable trap, java.lang.Object[] args)
-
getTargetThrowIfRevoked
ScriptableObject getTargetThrowIfRevoked()
-
-