From 45e66dd4d3972bcd833f504c49ec8ba8c8c803df Mon Sep 17 00:00:00 2001 From: "norris%netscape.com" Date: Thu, 3 Jun 1999 23:38:47 +0000 Subject: [PATCH] LC3 support: make Java arrays have Array.prototype as a prototype. --- .../org/mozilla/javascript/NativeJavaArray.java | 16 ++++++++++++++++ .../org/mozilla/javascript/NativeJavaArray.java | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/js/rhino/org/mozilla/javascript/NativeJavaArray.java b/js/rhino/org/mozilla/javascript/NativeJavaArray.java index 702fe146b20..099842e527b 100644 --- a/js/rhino/org/mozilla/javascript/NativeJavaArray.java +++ b/js/rhino/org/mozilla/javascript/NativeJavaArray.java @@ -52,6 +52,21 @@ public class NativeJavaArray extends NativeJavaObject { this.array = array; this.length = Array.getLength(array); this.cls = cl.getComponentType(); + setPrototype(ScriptableObject.getClassPrototype(scope, "Array")); + } + + /** + * Returns the prototype of the object. + */ + public Scriptable getPrototype() { + return prototype; + } + + /** + * Sets the prototype of the object. + */ + public void setPrototype(Scriptable m) { + prototype = m; } public boolean has(String id, Scriptable start) { @@ -118,4 +133,5 @@ public class NativeJavaArray extends NativeJavaObject { Object array; int length; Class cls; + Scriptable prototype; } diff --git a/js/rhino/src/org/mozilla/javascript/NativeJavaArray.java b/js/rhino/src/org/mozilla/javascript/NativeJavaArray.java index 702fe146b20..099842e527b 100644 --- a/js/rhino/src/org/mozilla/javascript/NativeJavaArray.java +++ b/js/rhino/src/org/mozilla/javascript/NativeJavaArray.java @@ -52,6 +52,21 @@ public class NativeJavaArray extends NativeJavaObject { this.array = array; this.length = Array.getLength(array); this.cls = cl.getComponentType(); + setPrototype(ScriptableObject.getClassPrototype(scope, "Array")); + } + + /** + * Returns the prototype of the object. + */ + public Scriptable getPrototype() { + return prototype; + } + + /** + * Sets the prototype of the object. + */ + public void setPrototype(Scriptable m) { + prototype = m; } public boolean has(String id, Scriptable start) { @@ -118,4 +133,5 @@ public class NativeJavaArray extends NativeJavaObject { Object array; int length; Class cls; + Scriptable prototype; }