Java Code Examples for net.sourceforge.htmlunit.corejs.javascript.Scriptable#setPrototype()
The following examples show how to use
net.sourceforge.htmlunit.corejs.javascript.Scriptable#setPrototype() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecursiveFunctionObject.java From htmlunit with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public Object call(final Context cx, final Scriptable scope, final Scriptable thisObj, final Object[] args) { final Object object = super.call(cx, scope, thisObj, args); if (object instanceof Scriptable) { final Scriptable result = (Scriptable) object; if (result.getPrototype() == null) { final Scriptable proto = getClassPrototype(); if (result != proto) { result.setPrototype(proto); } } if (result.getParentScope() == null) { final Scriptable parent = getParentScope(); if (result != parent) { result.setParentScope(parent); } } } return object; }
Example 2
Source File: RecursiveFunctionObject.java From HtmlUnit-Android with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public Object call(final Context cx, final Scriptable scope, final Scriptable thisObj, final Object[] args) { final Object object = super.call(cx, scope, thisObj, args); if (object instanceof Scriptable) { final Scriptable result = (Scriptable) object; if (result.getPrototype() == null) { final Scriptable proto = getClassPrototype(); if (result != proto) { result.setPrototype(proto); } } if (result.getParentScope() == null) { final Scriptable parent = getParentScope(); if (result != parent) { result.setParentScope(parent); } } } return object; }
Example 3
Source File: URLSearchParams.java From HtmlUnit-Android with Apache License 2.0 | 4 votes |
private static void setIteratorPrototype(final Scriptable scriptable) { if (ITERATOR_PROTOTYPE_ == null) { ITERATOR_PROTOTYPE_ = new com.gargoylesoftware.htmlunit.javascript.host.Iterator(ITERATOR_NAME, null); } scriptable.setPrototype(ITERATOR_PROTOTYPE_); }
Example 4
Source File: Map.java From HtmlUnit-Android with Apache License 2.0 | 4 votes |
private static void setIteratorPrototype(final Scriptable scriptable) { if (ITERATOR_PROTOTYPE_ == null) { ITERATOR_PROTOTYPE_ = new Iterator(MAP_ITERATOR_NAME, null); } scriptable.setPrototype(ITERATOR_PROTOTYPE_); }
Example 5
Source File: Set.java From HtmlUnit-Android with Apache License 2.0 | 4 votes |
private static void setIteratorPrototype(final Scriptable scriptable) { if (ITERATOR_PROTOTYPE_ == null) { ITERATOR_PROTOTYPE_ = new Iterator(SET_ITERATOR_NAME, null); } scriptable.setPrototype(ITERATOR_PROTOTYPE_); }
Example 6
Source File: NodeList.java From HtmlUnit-Android with Apache License 2.0 | 4 votes |
private static void setIteratorPrototype(final Scriptable scriptable) { if (ITERATOR_PROTOTYPE_ == null) { ITERATOR_PROTOTYPE_ = new Iterator(ITERATOR_NAME, null); } scriptable.setPrototype(ITERATOR_PROTOTYPE_); }