scope = ScriptableObject.getTopLevelScope(scope);
// Do not go through Context.javaToJS as this would again
// end up here in wrapCustom for a native object.
// Just wrap it as an ExtendedJavaObject.
return ctor.construct(cx, scope, new Object[] {
new ExtendedJavaObject(scope, javaObj, javaObj.getClass(),
false)
});
}
}
return new ExtendedJavaObject(scope, javaObj, staticType, true);
}