use of net.sourceforge.htmlunit.corejs.javascript.NativeJavaObject in project htmlunit by HtmlUnit.
the class HTMLObjectElement method get.
/**
* {@inheritDoc}
*/
@Override
public Object get(final String name, final Scriptable start) {
// ourself
if (wrappedActiveX_ instanceof NativeJavaObject) {
final NativeJavaObject obj = (NativeJavaObject) wrappedActiveX_;
final Object result = obj.get(name, start);
if (Scriptable.NOT_FOUND != result) {
return result;
}
return super.get(name, start);
}
if (wrappedActiveX_ != null) {
return wrappedActiveX_.get(name, start);
}
return super.get(name, start);
}
use of net.sourceforge.htmlunit.corejs.javascript.NativeJavaObject in project teavm by konsoletyper.
the class HtmlUnitRunStrategy method runTest.
@Override
public void runTest(TestRun run) throws IOException {
if (++runs == 50) {
runs = 0;
cleanUp();
init();
}
try {
page.set(webClient.get().getPage("about:blank"));
} catch (IOException e) {
throw new RuntimeException(e);
}
HtmlPage pageRef = page.get();
pageRef.executeJavaScript(readFile(new File(run.getBaseDirectory(), run.getFileName())));
boolean decodeStack = Boolean.parseBoolean(System.getProperty(TeaVMTestRunner.JS_DECODE_STACK, "true"));
File debugFile = decodeStack ? new File(run.getBaseDirectory(), run.getFileName() + ".teavmdbg") : null;
RhinoResultParser resultParser = new RhinoResultParser(debugFile);
AsyncResult asyncResult = new AsyncResult();
Function function = (Function) page.get().executeJavaScript(readResource("teavm-htmlunit-adapter.js")).getJavaScriptResult();
Object[] args = new Object[] { run.getArgument(), decodeStack ? createStackDecoderFunction(resultParser) : null, new NativeJavaObject(function, asyncResult, AsyncResult.class) };
pageRef.executeJavaScriptFunction(function, function, args, page.get());
resultParser.parseResult((Scriptable) asyncResult.getResult(), run.getCallback());
}
Aggregations