Fix bug in ScriptableObject that make classes with jsGet_ but not jsFunction_ work improperly.
Also update Foo example to conform to new defineClass API. git-svn-id: svn://10.0.0.236/trunk@38406 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
ca33cfa3da
commit
ac3c06b6c9
@ -96,7 +96,7 @@ public class Foo extends ScriptableObject {
|
||||
*
|
||||
* Resets the counter to 0.
|
||||
*/
|
||||
public void resetCounter() {
|
||||
public void jsFunction_resetCounter() {
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ public class Foo extends ScriptableObject {
|
||||
* If "setCounter" had been defined in this class, the runtime would
|
||||
* call the setter when the property is assigned to.
|
||||
*/
|
||||
public int getCounter() {
|
||||
public int jsGet_counter() {
|
||||
return counter++;
|
||||
}
|
||||
|
||||
@ -128,8 +128,8 @@ public class Foo extends ScriptableObject {
|
||||
* thread is not associated with a Context
|
||||
* @see org.mozilla.javascript.ScriptableObject#getTopLevelScope
|
||||
*/
|
||||
public static Object varargs(Context cx, Scriptable thisObj,
|
||||
Object[] args, Function funObj)
|
||||
public static Object jsFunction_varargs(Context cx, Scriptable thisObj,
|
||||
Object[] args, Function funObj)
|
||||
{
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append("this = ");
|
||||
|
||||
@ -787,6 +787,12 @@ public abstract class ScriptableObject implements Scriptable {
|
||||
prefix = functionPrefix;
|
||||
else if (name.startsWith(staticFunctionPrefix))
|
||||
prefix = staticFunctionPrefix;
|
||||
else if (name.startsWith(propertyPrefix))
|
||||
prefix = propertyPrefix;
|
||||
else if (name.startsWith(getterPrefix))
|
||||
prefix = getterPrefix;
|
||||
else if (name.startsWith(setterPrefix))
|
||||
prefix = setterPrefix;
|
||||
if (prefix != null) {
|
||||
hasPrefix = true;
|
||||
name = name.substring(prefix.length());
|
||||
|
||||
@ -787,6 +787,12 @@ public abstract class ScriptableObject implements Scriptable {
|
||||
prefix = functionPrefix;
|
||||
else if (name.startsWith(staticFunctionPrefix))
|
||||
prefix = staticFunctionPrefix;
|
||||
else if (name.startsWith(propertyPrefix))
|
||||
prefix = propertyPrefix;
|
||||
else if (name.startsWith(getterPrefix))
|
||||
prefix = getterPrefix;
|
||||
else if (name.startsWith(setterPrefix))
|
||||
prefix = setterPrefix;
|
||||
if (prefix != null) {
|
||||
hasPrefix = true;
|
||||
name = name.substring(prefix.length());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user